vb.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. define('vs/basic-languages/vb/vb',["require", "exports"], function (require, exports) {
  6. "use strict";
  7. Object.defineProperty(exports, "__esModule", { value: true });
  8. exports.language = exports.conf = void 0;
  9. exports.conf = {
  10. comments: {
  11. lineComment: "'",
  12. blockComment: ['/*', '*/']
  13. },
  14. brackets: [
  15. ['{', '}'],
  16. ['[', ']'],
  17. ['(', ')'],
  18. ['<', '>'],
  19. ['addhandler', 'end addhandler'],
  20. ['class', 'end class'],
  21. ['enum', 'end enum'],
  22. ['event', 'end event'],
  23. ['function', 'end function'],
  24. ['get', 'end get'],
  25. ['if', 'end if'],
  26. ['interface', 'end interface'],
  27. ['module', 'end module'],
  28. ['namespace', 'end namespace'],
  29. ['operator', 'end operator'],
  30. ['property', 'end property'],
  31. ['raiseevent', 'end raiseevent'],
  32. ['removehandler', 'end removehandler'],
  33. ['select', 'end select'],
  34. ['set', 'end set'],
  35. ['structure', 'end structure'],
  36. ['sub', 'end sub'],
  37. ['synclock', 'end synclock'],
  38. ['try', 'end try'],
  39. ['while', 'end while'],
  40. ['with', 'end with'],
  41. ['using', 'end using'],
  42. ['do', 'loop'],
  43. ['for', 'next']
  44. ],
  45. autoClosingPairs: [
  46. { open: '{', close: '}', notIn: ['string', 'comment'] },
  47. { open: '[', close: ']', notIn: ['string', 'comment'] },
  48. { open: '(', close: ')', notIn: ['string', 'comment'] },
  49. { open: '"', close: '"', notIn: ['string', 'comment'] },
  50. { open: '<', close: '>', notIn: ['string', 'comment'] }
  51. ],
  52. folding: {
  53. markers: {
  54. start: new RegExp('^\\s*#Region\\b'),
  55. end: new RegExp('^\\s*#End Region\\b')
  56. }
  57. }
  58. };
  59. exports.language = {
  60. defaultToken: '',
  61. tokenPostfix: '.vb',
  62. ignoreCase: true,
  63. brackets: [
  64. { token: 'delimiter.bracket', open: '{', close: '}' },
  65. { token: 'delimiter.array', open: '[', close: ']' },
  66. { token: 'delimiter.parenthesis', open: '(', close: ')' },
  67. { token: 'delimiter.angle', open: '<', close: '>' },
  68. // Special bracket statement pairs
  69. // according to https://msdn.microsoft.com/en-us/library/tsw2a11z.aspx
  70. {
  71. token: 'keyword.tag-addhandler',
  72. open: 'addhandler',
  73. close: 'end addhandler'
  74. },
  75. { token: 'keyword.tag-class', open: 'class', close: 'end class' },
  76. { token: 'keyword.tag-enum', open: 'enum', close: 'end enum' },
  77. { token: 'keyword.tag-event', open: 'event', close: 'end event' },
  78. {
  79. token: 'keyword.tag-function',
  80. open: 'function',
  81. close: 'end function'
  82. },
  83. { token: 'keyword.tag-get', open: 'get', close: 'end get' },
  84. { token: 'keyword.tag-if', open: 'if', close: 'end if' },
  85. {
  86. token: 'keyword.tag-interface',
  87. open: 'interface',
  88. close: 'end interface'
  89. },
  90. { token: 'keyword.tag-module', open: 'module', close: 'end module' },
  91. {
  92. token: 'keyword.tag-namespace',
  93. open: 'namespace',
  94. close: 'end namespace'
  95. },
  96. {
  97. token: 'keyword.tag-operator',
  98. open: 'operator',
  99. close: 'end operator'
  100. },
  101. {
  102. token: 'keyword.tag-property',
  103. open: 'property',
  104. close: 'end property'
  105. },
  106. {
  107. token: 'keyword.tag-raiseevent',
  108. open: 'raiseevent',
  109. close: 'end raiseevent'
  110. },
  111. {
  112. token: 'keyword.tag-removehandler',
  113. open: 'removehandler',
  114. close: 'end removehandler'
  115. },
  116. { token: 'keyword.tag-select', open: 'select', close: 'end select' },
  117. { token: 'keyword.tag-set', open: 'set', close: 'end set' },
  118. {
  119. token: 'keyword.tag-structure',
  120. open: 'structure',
  121. close: 'end structure'
  122. },
  123. { token: 'keyword.tag-sub', open: 'sub', close: 'end sub' },
  124. {
  125. token: 'keyword.tag-synclock',
  126. open: 'synclock',
  127. close: 'end synclock'
  128. },
  129. { token: 'keyword.tag-try', open: 'try', close: 'end try' },
  130. { token: 'keyword.tag-while', open: 'while', close: 'end while' },
  131. { token: 'keyword.tag-with', open: 'with', close: 'end with' },
  132. // Other pairs
  133. { token: 'keyword.tag-using', open: 'using', close: 'end using' },
  134. { token: 'keyword.tag-do', open: 'do', close: 'loop' },
  135. { token: 'keyword.tag-for', open: 'for', close: 'next' }
  136. ],
  137. keywords: [
  138. 'AddHandler',
  139. 'AddressOf',
  140. 'Alias',
  141. 'And',
  142. 'AndAlso',
  143. 'As',
  144. 'Async',
  145. 'Boolean',
  146. 'ByRef',
  147. 'Byte',
  148. 'ByVal',
  149. 'Call',
  150. 'Case',
  151. 'Catch',
  152. 'CBool',
  153. 'CByte',
  154. 'CChar',
  155. 'CDate',
  156. 'CDbl',
  157. 'CDec',
  158. 'Char',
  159. 'CInt',
  160. 'Class',
  161. 'CLng',
  162. 'CObj',
  163. 'Const',
  164. 'Continue',
  165. 'CSByte',
  166. 'CShort',
  167. 'CSng',
  168. 'CStr',
  169. 'CType',
  170. 'CUInt',
  171. 'CULng',
  172. 'CUShort',
  173. 'Date',
  174. 'Decimal',
  175. 'Declare',
  176. 'Default',
  177. 'Delegate',
  178. 'Dim',
  179. 'DirectCast',
  180. 'Do',
  181. 'Double',
  182. 'Each',
  183. 'Else',
  184. 'ElseIf',
  185. 'End',
  186. 'EndIf',
  187. 'Enum',
  188. 'Erase',
  189. 'Error',
  190. 'Event',
  191. 'Exit',
  192. 'False',
  193. 'Finally',
  194. 'For',
  195. 'Friend',
  196. 'Function',
  197. 'Get',
  198. 'GetType',
  199. 'GetXMLNamespace',
  200. 'Global',
  201. 'GoSub',
  202. 'GoTo',
  203. 'Handles',
  204. 'If',
  205. 'Implements',
  206. 'Imports',
  207. 'In',
  208. 'Inherits',
  209. 'Integer',
  210. 'Interface',
  211. 'Is',
  212. 'IsNot',
  213. 'Let',
  214. 'Lib',
  215. 'Like',
  216. 'Long',
  217. 'Loop',
  218. 'Me',
  219. 'Mod',
  220. 'Module',
  221. 'MustInherit',
  222. 'MustOverride',
  223. 'MyBase',
  224. 'MyClass',
  225. 'NameOf',
  226. 'Namespace',
  227. 'Narrowing',
  228. 'New',
  229. 'Next',
  230. 'Not',
  231. 'Nothing',
  232. 'NotInheritable',
  233. 'NotOverridable',
  234. 'Object',
  235. 'Of',
  236. 'On',
  237. 'Operator',
  238. 'Option',
  239. 'Optional',
  240. 'Or',
  241. 'OrElse',
  242. 'Out',
  243. 'Overloads',
  244. 'Overridable',
  245. 'Overrides',
  246. 'ParamArray',
  247. 'Partial',
  248. 'Private',
  249. 'Property',
  250. 'Protected',
  251. 'Public',
  252. 'RaiseEvent',
  253. 'ReadOnly',
  254. 'ReDim',
  255. 'RemoveHandler',
  256. 'Resume',
  257. 'Return',
  258. 'SByte',
  259. 'Select',
  260. 'Set',
  261. 'Shadows',
  262. 'Shared',
  263. 'Short',
  264. 'Single',
  265. 'Static',
  266. 'Step',
  267. 'Stop',
  268. 'String',
  269. 'Structure',
  270. 'Sub',
  271. 'SyncLock',
  272. 'Then',
  273. 'Throw',
  274. 'To',
  275. 'True',
  276. 'Try',
  277. 'TryCast',
  278. 'TypeOf',
  279. 'UInteger',
  280. 'ULong',
  281. 'UShort',
  282. 'Using',
  283. 'Variant',
  284. 'Wend',
  285. 'When',
  286. 'While',
  287. 'Widening',
  288. 'With',
  289. 'WithEvents',
  290. 'WriteOnly',
  291. 'Xor'
  292. ],
  293. tagwords: [
  294. 'If',
  295. 'Sub',
  296. 'Select',
  297. 'Try',
  298. 'Class',
  299. 'Enum',
  300. 'Function',
  301. 'Get',
  302. 'Interface',
  303. 'Module',
  304. 'Namespace',
  305. 'Operator',
  306. 'Set',
  307. 'Structure',
  308. 'Using',
  309. 'While',
  310. 'With',
  311. 'Do',
  312. 'Loop',
  313. 'For',
  314. 'Next',
  315. 'Property',
  316. 'Continue',
  317. 'AddHandler',
  318. 'RemoveHandler',
  319. 'Event',
  320. 'RaiseEvent',
  321. 'SyncLock'
  322. ],
  323. // we include these common regular expressions
  324. symbols: /[=><!~?;\.,:&|+\-*\/\^%]+/,
  325. integersuffix: /U?[DI%L&S@]?/,
  326. floatsuffix: /[R#F!]?/,
  327. // The main tokenizer for our languages
  328. tokenizer: {
  329. root: [
  330. // whitespace
  331. { include: '@whitespace' },
  332. // special ending tag-words
  333. [/next(?!\w)/, { token: 'keyword.tag-for' }],
  334. [/loop(?!\w)/, { token: 'keyword.tag-do' }],
  335. // usual ending tags
  336. [
  337. /end\s+(?!for|do)(addhandler|class|enum|event|function|get|if|interface|module|namespace|operator|property|raiseevent|removehandler|select|set|structure|sub|synclock|try|while|with|using)/,
  338. { token: 'keyword.tag-$1' }
  339. ],
  340. // identifiers, tagwords, and keywords
  341. [
  342. /[a-zA-Z_]\w*/,
  343. {
  344. cases: {
  345. '@tagwords': { token: 'keyword.tag-$0' },
  346. '@keywords': { token: 'keyword.$0' },
  347. '@default': 'identifier'
  348. }
  349. }
  350. ],
  351. // Preprocessor directive
  352. [/^\s*#\w+/, 'keyword'],
  353. // numbers
  354. [/\d*\d+e([\-+]?\d+)?(@floatsuffix)/, 'number.float'],
  355. [/\d*\.\d+(e[\-+]?\d+)?(@floatsuffix)/, 'number.float'],
  356. [/&H[0-9a-f]+(@integersuffix)/, 'number.hex'],
  357. [/&0[0-7]+(@integersuffix)/, 'number.octal'],
  358. [/\d+(@integersuffix)/, 'number'],
  359. // date literal
  360. [/#.*#/, 'number'],
  361. // delimiters and operators
  362. [/[{}()\[\]]/, '@brackets'],
  363. [/@symbols/, 'delimiter'],
  364. // strings
  365. [/["\u201c\u201d]/, { token: 'string.quote', next: '@string' }]
  366. ],
  367. whitespace: [
  368. [/[ \t\r\n]+/, ''],
  369. [/(\'|REM(?!\w)).*$/, 'comment']
  370. ],
  371. string: [
  372. [/[^"\u201c\u201d]+/, 'string'],
  373. [/["\u201c\u201d]{2}/, 'string.escape'],
  374. [/["\u201c\u201d]C?/, { token: 'string.quote', next: '@pop' }]
  375. ]
  376. }
  377. };
  378. });