basant307/AI_Governance_Project
048
1/*2Language: Visual Basic .NET3Description: Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework.4Authors: Poren Chiang <ren.chiang@gmail.com>, Jan Pilzer5Website: https://docs.microsoft.com/dotnet/visual-basic/getting-started6Category: common7*/8 9/** @type LanguageFn */10function vbnet(hljs) {11 const regex = hljs.regex;12 /**13 * Character Literal14 * Either a single character ("a"C) or an escaped double quote (""""C).15 */16 const CHARACTER = {17 className: 'string',18 begin: /"(""|[^/n])"C\b/19 };20 21 const STRING = {22 className: 'string',23 begin: /"/,24 end: /"/,25 illegal: /\n/,26 contains: [27 {28 // double quote escape29 begin: /""/ }30 ]31 };32 33 /** Date Literals consist of a date, a time, or both separated by whitespace, surrounded by # */34 const MM_DD_YYYY = /\d{1,2}\/\d{1,2}\/\d{4}/;35 const YYYY_MM_DD = /\d{4}-\d{1,2}-\d{1,2}/;36 const TIME_12H = /(\d|1[012])(:\d+){0,2} *(AM|PM)/;37 const TIME_24H = /\d{1,2}(:\d{1,2}){1,2}/;38 const DATE = {39 className: 'literal',40 variants: [41 {42 // #YYYY-MM-DD# (ISO-Date) or #M/D/YYYY# (US-Date)43 begin: regex.concat(/# */, regex.either(YYYY_MM_DD, MM_DD_YYYY), / *#/) },44 {45 // #H:mm[:ss]# (24h Time)46 begin: regex.concat(/# */, TIME_24H, / *#/) },47 {48 // #h[:mm[:ss]] A# (12h Time)49 begin: regex.concat(/# */, TIME_12H, / *#/) },50 {51 // date plus time52 begin: regex.concat(53 /# */,54 regex.either(YYYY_MM_DD, MM_DD_YYYY),55 / +/,56 regex.either(TIME_12H, TIME_24H),57 / *#/58 ) }59 ]60 };61 62 const NUMBER = {63 className: 'number',64 relevance: 0,65 variants: [66 {67 // Float68 begin: /\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ },69 {70 // Integer (base 10)71 begin: /\b\d[\d_]*((U?[SIL])|[%&])?/ },72 {73 // Integer (base 16)74 begin: /&H[\dA-F_]+((U?[SIL])|[%&])?/ },75 {76 // Integer (base 8)77 begin: /&O[0-7_]+((U?[SIL])|[%&])?/ },78 {79 // Integer (base 2)80 begin: /&B[01_]+((U?[SIL])|[%&])?/ }81 ]82 };83 84 const LABEL = {85 className: 'label',86 begin: /^\w+:/87 };88 89 const DOC_COMMENT = hljs.COMMENT(/'''/, /$/, { contains: [90 {91 className: 'doctag',92 begin: /<\/?/,93 end: />/94 }95 ] });96 97 const COMMENT = hljs.COMMENT(null, /$/, { variants: [98 { begin: /'/ },99 {100 // TODO: Use multi-class for leading spaces101 begin: /([\t ]|^)REM(?=\s)/ }102 ] });103 104 const DIRECTIVES = {105 className: 'meta',106 // TODO: Use multi-class for indentation once available107 begin: /[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,108 end: /$/,109 keywords: { keyword:110 'const disable else elseif enable end externalsource if region then' },111 contains: [ COMMENT ]112 };113 114 return {115 name: 'Visual Basic .NET',116 aliases: [ 'vb' ],117 case_insensitive: true,118 classNameAliases: { label: 'symbol' },119 keywords: {120 keyword:121 'addhandler alias aggregate ansi as async assembly auto binary by byref byval ' /* a-b */122 + 'call case catch class compare const continue custom declare default delegate dim distinct do ' /* c-d */123 + 'each equals else elseif end enum erase error event exit explicit finally for friend from function ' /* e-f */124 + 'get global goto group handles if implements imports in inherits interface into iterator ' /* g-i */125 + 'join key let lib loop me mid module mustinherit mustoverride mybase myclass ' /* j-m */126 + 'namespace narrowing new next notinheritable notoverridable ' /* n */127 + 'of off on operator option optional order overloads overridable overrides ' /* o */128 + 'paramarray partial preserve private property protected public ' /* p */129 + 'raiseevent readonly redim removehandler resume return ' /* r */130 + 'select set shadows shared skip static step stop structure strict sub synclock ' /* s */131 + 'take text then throw to try unicode until using when where while widening with withevents writeonly yield' /* t-y */,132 built_in:133 // Operators https://docs.microsoft.com/dotnet/visual-basic/language-reference/operators134 'addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor '135 // Type Conversion Functions https://docs.microsoft.com/dotnet/visual-basic/language-reference/functions/type-conversion-functions136 + 'cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort',137 type:138 // Data types https://docs.microsoft.com/dotnet/visual-basic/language-reference/data-types139 'boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort',140 literal: 'true false nothing'141 },142 illegal:143 '//|\\{|\\}|endif|gosub|variant|wend|^\\$ ' /* reserved deprecated keywords */,144 contains: [145 CHARACTER,146 STRING,147 DATE,148 NUMBER,149 LABEL,150 DOC_COMMENT,151 COMMENT,152 DIRECTIVES153 ]154 };155}156 157export { vbnet as default };158 