]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/vbnet.js
1 /*! `vbnet` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
7 Language: Visual Basic .NET
8 Description: Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework.
9 Authors: Poren Chiang <ren.chiang@gmail.com>, Jan Pilzer
10 Website: https://docs.microsoft.com/dotnet/visual-basic/getting-started
14 /** @type LanguageFn */
15 function vbnet(hljs
) {
16 const regex
= hljs
.regex
;
19 * Either a single character ("a"C) or an escaped double quote (""""C).
23 begin: /"(""|[^/n
])"C\b/
33 // double quote escape
38 /** Date Literals consist of a date, a time, or both separated by whitespace, surrounded by # */
39 const MM_DD_YYYY = /\d{1,2}\/\d{1,2}\/\d{4}/;
40 const YYYY_MM_DD = /\d{4}-\d{1,2}-\d{1,2}/;
41 const TIME_12H = /(\d|1[012])(:\d+){0,2} *(AM|PM)/;
42 const TIME_24H = /\d{1,2}(:\d{1,2}){1,2}/;
47 // #YYYY-MM-DD# (ISO-Date) or #M/D/YYYY# (US-Date)
48 begin: regex.concat(/# */, regex.either(YYYY_MM_DD, MM_DD_YYYY), / *#/) },
50 // #H:mm[:ss]# (24h Time)
51 begin: regex.concat(/# */, TIME_24H, / *#/) },
53 // #h[:mm[:ss]] A# (12h Time)
54 begin: regex.concat(/# */, TIME_12H, / *#/) },
59 regex.either(YYYY_MM_DD, MM_DD_YYYY),
61 regex.either(TIME_12H, TIME_24H),
73 begin: /\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ },
76 begin: /\b\d[\d_]*((U?[SIL])|[%&])?/ },
79 begin: /&H[\dA-F_]+((U?[SIL])|[%&])?/ },
82 begin: /&O[0-7_]+((U?[SIL])|[%&])?/ },
85 begin: /&B[01_]+((U?[SIL])|[%&])?/ }
94 const DOC_COMMENT = hljs.COMMENT(/'''/, /$/, { contains: [
102 const COMMENT = hljs.COMMENT(null, /$/, { variants: [
105 // TODO: Use multi-class for leading spaces
106 begin: /([\t ]|^)REM(?=\s)/ }
111 // TODO: Use multi-class for indentation once available
112 begin: /[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,
115 'const disable else elseif enable end externalsource if region then' },
116 contains: [ COMMENT ]
120 name: 'Visual Basic .NET',
122 case_insensitive: true,
123 classNameAliases: { label: 'symbol' },
126 'addhandler alias aggregate ansi as async assembly auto binary by byref byval ' /* a-b */
127 + 'call case catch class compare const continue custom declare default delegate dim distinct do ' /* c-d */
128 + 'each equals else elseif end enum erase error event exit explicit finally for friend from function ' /* e-f */
129 + 'get global goto group handles if implements imports in inherits interface into iterator ' /* g-i */
130 + 'join key let lib loop me mid module mustinherit mustoverride mybase myclass ' /* j-m */
131 + 'namespace narrowing new next notinheritable notoverridable ' /* n */
132 + 'of off on operator option optional order overloads overridable overrides ' /* o */
133 + 'paramarray partial preserve private property protected public ' /* p */
134 + 'raiseevent readonly redim removehandler resume return ' /* r */
135 + 'select set shadows shared skip static step stop structure strict sub synclock ' /* s */
136 + 'take text then throw to try unicode until using when where while widening with withevents writeonly yield' /* t-y */,
138 // Operators https://docs.microsoft.com/dotnet/visual-basic/language-reference/operators
139 'addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor '
140 // Type Conversion Functions https://docs.microsoft.com/dotnet/visual-basic/language-reference/functions/type-conversion-functions
141 + 'cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort',
143 // Data types https://docs.microsoft.com/dotnet/visual-basic/language-reference/data-types
144 'boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort',
145 literal: 'true false nothing'
148 '//|\\{|\\}|endif|gosub|variant|wend|^\\$ ' /* reserved deprecated keywords */,
166 hljs.registerLanguage('vbnet', hljsGrammar);