]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/nsis.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / nsis.js
1 /*! `nsis` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: NSIS
7 Description: Nullsoft Scriptable Install System
8 Author: Jan T. Sott <jan.sott@gmail.com>
9 Website: https://nsis.sourceforge.io/Main_Page
10 Category: scripting
11 */
12
13
14 function nsis(hljs) {
15 const regex = hljs.regex;
16 const LANGUAGE_CONSTANTS = [
17 "ADMINTOOLS",
18 "APPDATA",
19 "CDBURN_AREA",
20 "CMDLINE",
21 "COMMONFILES32",
22 "COMMONFILES64",
23 "COMMONFILES",
24 "COOKIES",
25 "DESKTOP",
26 "DOCUMENTS",
27 "EXEDIR",
28 "EXEFILE",
29 "EXEPATH",
30 "FAVORITES",
31 "FONTS",
32 "HISTORY",
33 "HWNDPARENT",
34 "INSTDIR",
35 "INTERNET_CACHE",
36 "LANGUAGE",
37 "LOCALAPPDATA",
38 "MUSIC",
39 "NETHOOD",
40 "OUTDIR",
41 "PICTURES",
42 "PLUGINSDIR",
43 "PRINTHOOD",
44 "PROFILE",
45 "PROGRAMFILES32",
46 "PROGRAMFILES64",
47 "PROGRAMFILES",
48 "QUICKLAUNCH",
49 "RECENT",
50 "RESOURCES_LOCALIZED",
51 "RESOURCES",
52 "SENDTO",
53 "SMPROGRAMS",
54 "SMSTARTUP",
55 "STARTMENU",
56 "SYSDIR",
57 "TEMP",
58 "TEMPLATES",
59 "VIDEOS",
60 "WINDIR"
61 ];
62
63 const PARAM_NAMES = [
64 "ARCHIVE",
65 "FILE_ATTRIBUTE_ARCHIVE",
66 "FILE_ATTRIBUTE_NORMAL",
67 "FILE_ATTRIBUTE_OFFLINE",
68 "FILE_ATTRIBUTE_READONLY",
69 "FILE_ATTRIBUTE_SYSTEM",
70 "FILE_ATTRIBUTE_TEMPORARY",
71 "HKCR",
72 "HKCU",
73 "HKDD",
74 "HKEY_CLASSES_ROOT",
75 "HKEY_CURRENT_CONFIG",
76 "HKEY_CURRENT_USER",
77 "HKEY_DYN_DATA",
78 "HKEY_LOCAL_MACHINE",
79 "HKEY_PERFORMANCE_DATA",
80 "HKEY_USERS",
81 "HKLM",
82 "HKPD",
83 "HKU",
84 "IDABORT",
85 "IDCANCEL",
86 "IDIGNORE",
87 "IDNO",
88 "IDOK",
89 "IDRETRY",
90 "IDYES",
91 "MB_ABORTRETRYIGNORE",
92 "MB_DEFBUTTON1",
93 "MB_DEFBUTTON2",
94 "MB_DEFBUTTON3",
95 "MB_DEFBUTTON4",
96 "MB_ICONEXCLAMATION",
97 "MB_ICONINFORMATION",
98 "MB_ICONQUESTION",
99 "MB_ICONSTOP",
100 "MB_OK",
101 "MB_OKCANCEL",
102 "MB_RETRYCANCEL",
103 "MB_RIGHT",
104 "MB_RTLREADING",
105 "MB_SETFOREGROUND",
106 "MB_TOPMOST",
107 "MB_USERICON",
108 "MB_YESNO",
109 "NORMAL",
110 "OFFLINE",
111 "READONLY",
112 "SHCTX",
113 "SHELL_CONTEXT",
114 "SYSTEM|TEMPORARY",
115 ];
116
117 const COMPILER_FLAGS = [
118 "addincludedir",
119 "addplugindir",
120 "appendfile",
121 "assert",
122 "cd",
123 "define",
124 "delfile",
125 "echo",
126 "else",
127 "endif",
128 "error",
129 "execute",
130 "finalize",
131 "getdllversion",
132 "gettlbversion",
133 "if",
134 "ifdef",
135 "ifmacrodef",
136 "ifmacrondef",
137 "ifndef",
138 "include",
139 "insertmacro",
140 "macro",
141 "macroend",
142 "makensis",
143 "packhdr",
144 "searchparse",
145 "searchreplace",
146 "system",
147 "tempfile",
148 "undef",
149 "uninstfinalize",
150 "verbose",
151 "warning",
152 ];
153
154 const CONSTANTS = {
155 className: 'variable.constant',
156 begin: regex.concat(/\$/, regex.either(...LANGUAGE_CONSTANTS))
157 };
158
159 const DEFINES = {
160 // ${defines}
161 className: 'variable',
162 begin: /\$+\{[\!\w.:-]+\}/
163 };
164
165 const VARIABLES = {
166 // $variables
167 className: 'variable',
168 begin: /\$+\w[\w\.]*/,
169 illegal: /\(\)\{\}/
170 };
171
172 const LANGUAGES = {
173 // $(language_strings)
174 className: 'variable',
175 begin: /\$+\([\w^.:!-]+\)/
176 };
177
178 const PARAMETERS = {
179 // command parameters
180 className: 'params',
181 begin: regex.either(...PARAM_NAMES)
182 };
183
184 const COMPILER = {
185 // !compiler_flags
186 className: 'keyword',
187 begin: regex.concat(
188 /!/,
189 regex.either(...COMPILER_FLAGS)
190 )
191 };
192
193 const ESCAPE_CHARS = {
194 // $\n, $\r, $\t, $$
195 className: 'char.escape',
196 begin: /\$(\\[nrt]|\$)/
197 };
198
199 const PLUGINS = {
200 // plug::ins
201 className: 'title.function',
202 begin: /\w+::\w+/
203 };
204
205 const STRING = {
206 className: 'string',
207 variants: [
208 {
209 begin: '"',
210 end: '"'
211 },
212 {
213 begin: '\'',
214 end: '\''
215 },
216 {
217 begin: '`',
218 end: '`'
219 }
220 ],
221 illegal: /\n/,
222 contains: [
223 ESCAPE_CHARS,
224 CONSTANTS,
225 DEFINES,
226 VARIABLES,
227 LANGUAGES
228 ]
229 };
230
231 const KEYWORDS = [
232 "Abort",
233 "AddBrandingImage",
234 "AddSize",
235 "AllowRootDirInstall",
236 "AllowSkipFiles",
237 "AutoCloseWindow",
238 "BGFont",
239 "BGGradient",
240 "BrandingText",
241 "BringToFront",
242 "Call",
243 "CallInstDLL",
244 "Caption",
245 "ChangeUI",
246 "CheckBitmap",
247 "ClearErrors",
248 "CompletedText",
249 "ComponentText",
250 "CopyFiles",
251 "CRCCheck",
252 "CreateDirectory",
253 "CreateFont",
254 "CreateShortCut",
255 "Delete",
256 "DeleteINISec",
257 "DeleteINIStr",
258 "DeleteRegKey",
259 "DeleteRegValue",
260 "DetailPrint",
261 "DetailsButtonText",
262 "DirText",
263 "DirVar",
264 "DirVerify",
265 "EnableWindow",
266 "EnumRegKey",
267 "EnumRegValue",
268 "Exch",
269 "Exec",
270 "ExecShell",
271 "ExecShellWait",
272 "ExecWait",
273 "ExpandEnvStrings",
274 "File",
275 "FileBufSize",
276 "FileClose",
277 "FileErrorText",
278 "FileOpen",
279 "FileRead",
280 "FileReadByte",
281 "FileReadUTF16LE",
282 "FileReadWord",
283 "FileWriteUTF16LE",
284 "FileSeek",
285 "FileWrite",
286 "FileWriteByte",
287 "FileWriteWord",
288 "FindClose",
289 "FindFirst",
290 "FindNext",
291 "FindWindow",
292 "FlushINI",
293 "GetCurInstType",
294 "GetCurrentAddress",
295 "GetDlgItem",
296 "GetDLLVersion",
297 "GetDLLVersionLocal",
298 "GetErrorLevel",
299 "GetFileTime",
300 "GetFileTimeLocal",
301 "GetFullPathName",
302 "GetFunctionAddress",
303 "GetInstDirError",
304 "GetKnownFolderPath",
305 "GetLabelAddress",
306 "GetTempFileName",
307 "GetWinVer",
308 "Goto",
309 "HideWindow",
310 "Icon",
311 "IfAbort",
312 "IfErrors",
313 "IfFileExists",
314 "IfRebootFlag",
315 "IfRtlLanguage",
316 "IfShellVarContextAll",
317 "IfSilent",
318 "InitPluginsDir",
319 "InstallButtonText",
320 "InstallColors",
321 "InstallDir",
322 "InstallDirRegKey",
323 "InstProgressFlags",
324 "InstType",
325 "InstTypeGetText",
326 "InstTypeSetText",
327 "Int64Cmp",
328 "Int64CmpU",
329 "Int64Fmt",
330 "IntCmp",
331 "IntCmpU",
332 "IntFmt",
333 "IntOp",
334 "IntPtrCmp",
335 "IntPtrCmpU",
336 "IntPtrOp",
337 "IsWindow",
338 "LangString",
339 "LicenseBkColor",
340 "LicenseData",
341 "LicenseForceSelection",
342 "LicenseLangString",
343 "LicenseText",
344 "LoadAndSetImage",
345 "LoadLanguageFile",
346 "LockWindow",
347 "LogSet",
348 "LogText",
349 "ManifestDPIAware",
350 "ManifestLongPathAware",
351 "ManifestMaxVersionTested",
352 "ManifestSupportedOS",
353 "MessageBox",
354 "MiscButtonText",
355 "Name|0",
356 "Nop",
357 "OutFile",
358 "Page",
359 "PageCallbacks",
360 "PEAddResource",
361 "PEDllCharacteristics",
362 "PERemoveResource",
363 "PESubsysVer",
364 "Pop",
365 "Push",
366 "Quit",
367 "ReadEnvStr",
368 "ReadINIStr",
369 "ReadRegDWORD",
370 "ReadRegStr",
371 "Reboot",
372 "RegDLL",
373 "Rename",
374 "RequestExecutionLevel",
375 "ReserveFile",
376 "Return",
377 "RMDir",
378 "SearchPath",
379 "SectionGetFlags",
380 "SectionGetInstTypes",
381 "SectionGetSize",
382 "SectionGetText",
383 "SectionIn",
384 "SectionSetFlags",
385 "SectionSetInstTypes",
386 "SectionSetSize",
387 "SectionSetText",
388 "SendMessage",
389 "SetAutoClose",
390 "SetBrandingImage",
391 "SetCompress",
392 "SetCompressor",
393 "SetCompressorDictSize",
394 "SetCtlColors",
395 "SetCurInstType",
396 "SetDatablockOptimize",
397 "SetDateSave",
398 "SetDetailsPrint",
399 "SetDetailsView",
400 "SetErrorLevel",
401 "SetErrors",
402 "SetFileAttributes",
403 "SetFont",
404 "SetOutPath",
405 "SetOverwrite",
406 "SetRebootFlag",
407 "SetRegView",
408 "SetShellVarContext",
409 "SetSilent",
410 "ShowInstDetails",
411 "ShowUninstDetails",
412 "ShowWindow",
413 "SilentInstall",
414 "SilentUnInstall",
415 "Sleep",
416 "SpaceTexts",
417 "StrCmp",
418 "StrCmpS",
419 "StrCpy",
420 "StrLen",
421 "SubCaption",
422 "Unicode",
423 "UninstallButtonText",
424 "UninstallCaption",
425 "UninstallIcon",
426 "UninstallSubCaption",
427 "UninstallText",
428 "UninstPage",
429 "UnRegDLL",
430 "Var",
431 "VIAddVersionKey",
432 "VIFileVersion",
433 "VIProductVersion",
434 "WindowIcon",
435 "WriteINIStr",
436 "WriteRegBin",
437 "WriteRegDWORD",
438 "WriteRegExpandStr",
439 "WriteRegMultiStr",
440 "WriteRegNone",
441 "WriteRegStr",
442 "WriteUninstaller",
443 "XPStyle"
444 ];
445
446 const LITERALS = [
447 "admin",
448 "all",
449 "auto",
450 "both",
451 "bottom",
452 "bzip2",
453 "colored",
454 "components",
455 "current",
456 "custom",
457 "directory",
458 "false",
459 "force",
460 "hide",
461 "highest",
462 "ifdiff",
463 "ifnewer",
464 "instfiles",
465 "lastused",
466 "leave",
467 "left",
468 "license",
469 "listonly",
470 "lzma",
471 "nevershow",
472 "none",
473 "normal",
474 "notset",
475 "off",
476 "on",
477 "open",
478 "print",
479 "right",
480 "show",
481 "silent",
482 "silentlog",
483 "smooth",
484 "textonly",
485 "top",
486 "true",
487 "try",
488 "un.components",
489 "un.custom",
490 "un.directory",
491 "un.instfiles",
492 "un.license",
493 "uninstConfirm",
494 "user",
495 "Win10",
496 "Win7",
497 "Win8",
498 "WinVista",
499 "zlib"
500 ];
501
502 const FUNCTION_DEFINITION = {
503 match: [
504 /Function/,
505 /\s+/,
506 regex.concat(/(\.)?/, hljs.IDENT_RE)
507 ],
508 scope: {
509 1: "keyword",
510 3: "title.function"
511 }
512 };
513
514 // Var Custom.Variable.Name.Item
515 // Var /GLOBAL Custom.Variable.Name.Item
516 const VARIABLE_NAME_RE = /[A-Za-z][\w.]*/;
517 const VARIABLE_DEFINITION = {
518 match: [
519 /Var/,
520 /\s+/,
521 /(?:\/GLOBAL\s+)?/,
522 VARIABLE_NAME_RE
523 ],
524 scope: {
525 1: "keyword",
526 3: "params",
527 4: "variable"
528 }
529 };
530
531 return {
532 name: 'NSIS',
533 case_insensitive: true,
534 keywords: {
535 keyword: KEYWORDS,
536 literal: LITERALS
537 },
538 contains: [
539 hljs.HASH_COMMENT_MODE,
540 hljs.C_BLOCK_COMMENT_MODE,
541 hljs.COMMENT(
542 ';',
543 '$',
544 { relevance: 0 }
545 ),
546 VARIABLE_DEFINITION,
547 FUNCTION_DEFINITION,
548 { beginKeywords: 'Function PageEx Section SectionGroup FunctionEnd SectionEnd', },
549 STRING,
550 COMPILER,
551 DEFINES,
552 VARIABLES,
553 LANGUAGES,
554 PARAMETERS,
555 PLUGINS,
556 hljs.NUMBER_MODE
557 ]
558 };
559 }
560
561 return nsis;
562
563 })();
564 ;
565 export default hljsGrammar;