]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/vbscript.js
Initial commit.
[flow-web.git] / static / highlight / languages / vbscript.js
1 /*! `vbscript` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: VBScript
8 Description: VBScript ("Microsoft Visual Basic Scripting Edition") is an Active Scripting language developed by Microsoft that is modeled on Visual Basic.
9 Author: Nikita Ledyaev <lenikita@yandex.ru>
10 Contributors: Michal Gabrukiewicz <mgabru@gmail.com>
11 Website: https://en.wikipedia.org/wiki/VBScript
12 Category: scripting
13 */
14
15 /** @type LanguageFn */
16 function vbscript(hljs) {
17 const regex = hljs.regex;
18 const BUILT_IN_FUNCTIONS = [
19 "lcase",
20 "month",
21 "vartype",
22 "instrrev",
23 "ubound",
24 "setlocale",
25 "getobject",
26 "rgb",
27 "getref",
28 "string",
29 "weekdayname",
30 "rnd",
31 "dateadd",
32 "monthname",
33 "now",
34 "day",
35 "minute",
36 "isarray",
37 "cbool",
38 "round",
39 "formatcurrency",
40 "conversions",
41 "csng",
42 "timevalue",
43 "second",
44 "year",
45 "space",
46 "abs",
47 "clng",
48 "timeserial",
49 "fixs",
50 "len",
51 "asc",
52 "isempty",
53 "maths",
54 "dateserial",
55 "atn",
56 "timer",
57 "isobject",
58 "filter",
59 "weekday",
60 "datevalue",
61 "ccur",
62 "isdate",
63 "instr",
64 "datediff",
65 "formatdatetime",
66 "replace",
67 "isnull",
68 "right",
69 "sgn",
70 "array",
71 "snumeric",
72 "log",
73 "cdbl",
74 "hex",
75 "chr",
76 "lbound",
77 "msgbox",
78 "ucase",
79 "getlocale",
80 "cos",
81 "cdate",
82 "cbyte",
83 "rtrim",
84 "join",
85 "hour",
86 "oct",
87 "typename",
88 "trim",
89 "strcomp",
90 "int",
91 "createobject",
92 "loadpicture",
93 "tan",
94 "formatnumber",
95 "mid",
96 "split",
97 "cint",
98 "sin",
99 "datepart",
100 "ltrim",
101 "sqr",
102 "time",
103 "derived",
104 "eval",
105 "date",
106 "formatpercent",
107 "exp",
108 "inputbox",
109 "left",
110 "ascw",
111 "chrw",
112 "regexp",
113 "cstr",
114 "err"
115 ];
116 const BUILT_IN_OBJECTS = [
117 "server",
118 "response",
119 "request",
120 // take no arguments so can be called without ()
121 "scriptengine",
122 "scriptenginebuildversion",
123 "scriptengineminorversion",
124 "scriptenginemajorversion"
125 ];
126
127 const BUILT_IN_CALL = {
128 begin: regex.concat(regex.either(...BUILT_IN_FUNCTIONS), "\\s*\\("),
129 // relevance 0 because this is acting as a beginKeywords really
130 relevance: 0,
131 keywords: { built_in: BUILT_IN_FUNCTIONS }
132 };
133
134 const LITERALS = [
135 "true",
136 "false",
137 "null",
138 "nothing",
139 "empty"
140 ];
141
142 const KEYWORDS = [
143 "call",
144 "class",
145 "const",
146 "dim",
147 "do",
148 "loop",
149 "erase",
150 "execute",
151 "executeglobal",
152 "exit",
153 "for",
154 "each",
155 "next",
156 "function",
157 "if",
158 "then",
159 "else",
160 "on",
161 "error",
162 "option",
163 "explicit",
164 "new",
165 "private",
166 "property",
167 "let",
168 "get",
169 "public",
170 "randomize",
171 "redim",
172 "rem",
173 "select",
174 "case",
175 "set",
176 "stop",
177 "sub",
178 "while",
179 "wend",
180 "with",
181 "end",
182 "to",
183 "elseif",
184 "is",
185 "or",
186 "xor",
187 "and",
188 "not",
189 "class_initialize",
190 "class_terminate",
191 "default",
192 "preserve",
193 "in",
194 "me",
195 "byval",
196 "byref",
197 "step",
198 "resume",
199 "goto"
200 ];
201
202 return {
203 name: 'VBScript',
204 aliases: [ 'vbs' ],
205 case_insensitive: true,
206 keywords: {
207 keyword: KEYWORDS,
208 built_in: BUILT_IN_OBJECTS,
209 literal: LITERALS
210 },
211 illegal: '//',
212 contains: [
213 BUILT_IN_CALL,
214 hljs.inherit(hljs.QUOTE_STRING_MODE, { contains: [ { begin: '""' } ] }),
215 hljs.COMMENT(
216 /'/,
217 /$/,
218 { relevance: 0 }
219 ),
220 hljs.C_NUMBER_MODE
221 ]
222 };
223 }
224
225 return vbscript;
226
227 })();
228
229 hljs.registerLanguage('vbscript', hljsGrammar);
230 })();