@nsis/codemirror 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -0
- package/README.md +37 -0
- package/dist/index.cjs +772 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +770 -0
- package/package.json +54 -0
- package/src/highlight.ts +32 -0
- package/src/index.ts +320 -0
- package/src/nsis.grammar +261 -0
- package/src/parser.js +19 -0
- package/src/parser.terms.js +62 -0
- package/src/string-tokens.ts +101 -0
package/src/parser.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
import {LRParser} from "@lezer/lr"
|
|
3
|
+
import {dqTokenizer, sqTokenizer, btTokenizer} from "./string-tokens.ts"
|
|
4
|
+
const spec_Identifier = {__proto__:null,"!addincludedir":40, "!addplugindir":40, "!appendfile":40, "!appendmemfile":40, "!assert":40, "!cd":40, "!define":40, "!delfile":40, "!echo":40, "!error":40, "!execute":40, "!finalize":40, "!getdllversion":40, "!gettlbversion":40, "!include":40, "!insertmacro":40, "!macroundef":40, "!makensis":40, "!packhdr":40, "!pragma":40, "!searchparse":40, "!searchreplace":40, "!system":40, "!tempfile":40, "!undef":40, "!uninstfinalize":40, "!verbose":40, "!warning":40, admin:70, all:70, "amd64-unicode":70, auto:70, both:70, bottom:70, bzip2:70, components:70, current:70, custom:70, default:70, directory:70, false:70, force:70, hide:70, highest:70, ifdiff:70, ifnewer:70, instfiles:70, lastused:70, leave:70, left:70, license:70, listonly:70, lzma:70, nevershow:70, none:70, normal:70, notset:70, off:70, on:70, right:70, show:70, silent:70, silentlog:70, textonly:70, top:70, true:70, try:70, "un.components":70, "un.custom":70, "un.directory":70, "un.instfiles":70, "un.license":70, uninstConfirm:70, user:70, zlib:70, Var:78, Abort:84, AddBrandingImage:84, AddSize:84, AllowRootDirInstall:84, AllowSkipFiles:84, AutoCloseWindow:84, BGFont:84, BGGradient:84, BrandingText:84, BringToFront:84, Call:84, CallInstDLL:84, Caption:84, ChangeUI:84, CheckBitmap:84, ClearErrors:84, CompletedText:84, ComponentText:84, CopyFiles:84, CPU:84, CRCCheck:84, CreateDirectory:84, CreateFont:84, CreateShortCut:84, Delete:84, DeleteINISec:84, DeleteINIStr:84, DeleteRegKey:84, DeleteRegValue:84, DetailPrint:84, DetailsButtonText:84, DirText:84, DirVar:84, DirVerify:84, EnableWindow:84, EnumRegKey:84, EnumRegValue:84, Exch:84, Exec:84, ExecShell:84, ExecShellWait:84, ExecWait:84, ExpandEnvStrings:84, File:84, FileBufSize:84, FileClose:84, FileErrorText:84, FileOpen:84, FileRead:84, FileReadByte:84, FileReadUTF16LE:84, FileReadWord:84, FileSeek:84, FileWrite:84, FileWriteByte:84, FileWriteUTF16LE:84, FileWriteWord:84, FindClose:84, FindFirst:84, FindNext:84, FindWindow:84, FlushINI:84, GetCurInstType:84, GetCurrentAddress:84, GetDlgItem:84, GetDLLVersion:84, GetDLLVersionLocal:84, GetErrorLevel:84, GetFileTime:84, GetFileTimeLocal:84, GetFullPathName:84, GetFunctionAddress:84, GetInstDirError:84, GetKnownFolderPath:84, GetLabelAddress:84, GetRegView:84, GetShellVarContext:84, GetTempFileName:84, GetWinVer:84, Goto:84, HideWindow:84, Icon:84, IfAbort:84, IfAltRegView:84, IfErrors:84, IfFileExists:84, IfRebootFlag:84, IfRtlLanguage:84, IfShellVarContextAll:84, IfSilent:84, InitPluginsDir:84, InstallButtonText:84, InstallColors:84, InstallDir:84, InstallDirRegKey:84, InstProgressFlags:84, InstType:84, InstTypeGetText:84, InstTypeSetText:84, Int64Cmp:84, Int64CmpU:84, Int64Fmt:84, IntCmp:84, IntCmpU:84, IntFmt:84, IntOp:84, IntPtrCmp:84, IntPtrCmpU:84, IntPtrOp:84, IsWindow:84, LangString:84, LicenseBkColor:84, LicenseData:84, LicenseForceSelection:84, LicenseLangString:84, LicenseText:84, LoadAndSetImage:84, LoadLanguageFile:84, LockWindow:84, LogSet:84, LogText:84, ManifestAppendCustomString:84, ManifestDisableWindowFiltering:84, ManifestDPIAware:84, ManifestDPIAwareness:84, ManifestGdiScaling:84, ManifestLongPathAware:84, ManifestMaxVersionTested:84, ManifestSupportedOS:84, MessageBox:84, MiscButtonText:84, Name:84, Nop:84, OutFile:84, Page:84, PageCallbacks:84, PEAddResource:84, PEDllCharacteristics:84, PERemoveResource:84, PESubsysVer:84, Pop:84, Push:84, Quit:84, ReadEnvStr:84, ReadINIStr:84, ReadMemory:84, ReadRegDWORD:84, ReadRegStr:84, Reboot:84, RegDLL:84, Rename:84, RequestExecutionLevel:84, ReserveFile:84, Return:84, RMDir:84, SearchPath:84, SectionGetFlags:84, SectionGetInstTypes:84, SectionGetSize:84, SectionGetText:84, SectionIn:84, SectionInstType:84, SectionSetFlags:84, SectionSetInstTypes:84, SectionSetSize:84, SectionSetText:84, SendMessage:84, SetAutoClose:84, SetBrandingImage:84, SetCompress:84, SetCompressionLevel:84, SetCompressor:84, SetCompressorDictSize:84, SetCtlColors:84, SetCurInstType:84, SetDatablockOptimize:84, SetDateSave:84, SetDetailsPrint:84, SetDetailsView:84, SetErrorLevel:84, SetErrors:84, SetFileAttributes:84, SetFont:84, SetOutPath:84, SetOverwrite:84, SetRebootFlag:84, SetRegView:84, SetShellVarContext:84, SetSilent:84, ShowInstDetails:84, ShowUninstDetails:84, ShowWindow:84, SilentInstall:84, SilentUnInstall:84, Sleep:84, SpaceTexts:84, StrCmp:84, StrCmpS:84, StrCpy:84, StrLen:84, SubCaption:84, Target:84, Unicode:84, UnsafeStrCpy:84, UninstallButtonText:84, UninstallCaption:84, UninstallIcon:84, UninstallSubCaption:84, UninstallText:84, UninstPage:84, UnRegDLL:84, VIAddVersionKey:84, VIFileVersion:84, VIProductVersion:84, WindowIcon:84, WriteINIStr:84, WriteRegBin:84, WriteRegDWORD:84, WriteRegExpandStr:84, WriteRegMultiStr:84, WriteRegNone:84, WriteRegStr:84, WriteUninstaller:84, XPStyle:84, Function:90, "!macro":96, Section:100, SectionEnd:102, SectionGroup:106, "!if":112, "!ifdef":112, "!ifndef":112, "!ifmacrodef":112, "!ifmacrondef":112, "!else":116, "!endif":120, SectionGroupEnd:122, PageEx:126, PageExEnd:128, "!macroend":136, FunctionEnd:138}
|
|
5
|
+
export const parser = LRParser.deserialize({
|
|
6
|
+
version: 14,
|
|
7
|
+
states: "0zQ`QWOOOOQO'#Cn'#CnO!{QWO'#CmO#VQWO'#DQOOQO'#DV'#DVO#[QWO'#DUO#fQWO'#EZOOQO'#D]'#D]OOQO'#De'#DeO#nQWO'#DdO#uQWO'#D[OOQO'#DX'#DXOOQO'#Dt'#DtQ`QWOOQOQWOOO#zQWO'#DSO$SQWO'#D_O$ZQWO'#DbO$bQWO'#DlO$iQWO'#DYO%RQXO'#CrO%kQYO'#CtO&TQ[O'#CvOOQO'#DO'#DOOOQO'#EV'#EVOOQO'#Du'#DuO&[QWO,59XO&fQWO,59lO&kQWO,59pOOQO,5:p,5:pO&uQWO,5:OO&|QWO,5:OO'kQWO,59vOOQO-E7r-E7rOOQO,59n,59nO'sQWO,59nO'xQWO,59yO(PQWO,59yO(kQWO,59|O)^QWO,59|O)eQWO,5:WO)lQWO,5:WO*WQWO,59tO*_QWO,59tOOQP'#Dv'#DvO*yQXO,59^OOQO,59^,59^OOQQ'#Dw'#DwO+QQYO,59`OOQO,59`,59`OOQS'#Dx'#DxO+XQ[O,59bOOQO,59b,59bOOQO-E7s-E7sO+`QWO1G/WO&|QWO1G/jO+jQWO'#DpO+rQWO'#EUO+wQWO1G/jOOQO'#Dy'#DyO,hQWO'#EXOOQO'#Dz'#DzO,{QWO1G/bO-TQWO1G/bOOQO1G/Y1G/YO(PQWO1G/eO-{QWO1G/eO.QQWO1G/hOOQO'#D|'#D|O.QQWO1G/hOOQO1G/h1G/hO)lQWO1G/rO.XQWO1G/rO*_QWO1G/`O.^QWO1G/`OOQP-E7t-E7tOOQO1G.x1G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pR!|!`S#P!a!}R#b#PQ!gwQ#T!eT#V!g#TQ!x![Q#[!tT#`!x#[uiQTX`abcjlntvxz!W!s!w#^Q![oQ!duQ!jyQ!l{Q!t!XQ#R!cQ#W!iQ#Y!kQ#k#_R#m#jQ#Q!aR#a!}T^O]",
|
|
10
|
+
nodeNames: "⚠ DQEscape DQVariable DQDefineRef DQLangRef SQEscape SQVariable SQDefineRef SQLangRef BTEscape BTVariable BTDefineRef BTLangRef LineComment BlockComment LineContinuation Script PreprocDirective PreprocKeyword Identifier PreprocKeyword \" String ' RawString ` BacktickString Variable DefineReference LangStringReference Number Flag LabelReference Constant ArgumentValue ArgumentValue PluginCall ColonColon VariableDeclaration Var Command CommandName CommandName Block FunctionBlock Function MacroBlock PreprocMacro PreprocMacro SectionBlock Section SectionEnd SectionGroupBlock SectionGroup PreprocConditional PreprocIf PreprocIf PreprocElse PreprocElse PreprocEndif PreprocEndif SectionGroupEnd PageExBlock PageEx PageExEnd : Label PreprocMacroEnd PreprocMacroEnd FunctionEnd",
|
|
11
|
+
maxTerm: 91,
|
|
12
|
+
skippedNodes: [0,13,14,15],
|
|
13
|
+
repeatNodeCount: 10,
|
|
14
|
+
tokenData: "-{~RfXY!gYZ!u]^!gpq!gqr!zrs#ist#ntu$Vwx'R{|'W}!O'W!O!P(w!P!Q)]!Q!R'a!R![(Q![!]+p!]!^#n!c!},o#O#P-k#R#S(w#S#T-v#T#o(w~!lR!w~XY!g]^!gpq!g~!zO!z~~!}R!c!}#W#R#S#W#T#o#W~#]Sc~!Q![#W!c!}#W#R#S#W#T#o#W~#nOe~~#sS]~OY#nZ;'S#n;'S;=`$P<%lO#n~$SP;=`<%l#n~$YUxy$l!Q![%j!c!}%o#R#S%o#T#o%o#o#p&T~$oSOy${z;'S${;'S;=`%d<%lO${~%OTOy${yz%_z;'S${;'S;=`%d<%lO${~%dOm~~%gP;=`<%l${~%oOk~~%tTk~!O!P%o!Q![%o!c!}%o#R#S%o#T#o%o~&WSO#q&d#r;'S&d;'S;=`&{<%lO&d~&gTO#q&d#q#r&v#r;'S&d;'S;=`&{<%lO&d~&{Ol~~'OP;=`<%l&d~'WOg~~'ZQ!Q!R'a!R![(Q~'fSn~!O!P'r!Q![(Q!z!{(]#l#m(]~'uP!Q!['x~'}Pn~!Q!['x~(VQn~!O!P'r!Q![(Q~(`R!Q![(i!c!i(i#T#Z(i~(nRn~!Q![(i!c!i(i#T#Z(i~(|Tc~!O!P(w!Q![(w!c!}(w#R#S(w#T#o(w~)`Sz{)l!c!}*s#R#S*s#T#o*s~)oTOz)lz{*O{;'S)l;'S;=`*m<%lO)l~*RVOz)lz{*O{!P)l!P!Q*h!Q;'S)l;'S;=`*m<%lO)l~*mO^~~*pP;=`<%l)l~*xTo~!Q![*s!_!`+X!c!}*s#R#S*s#T#o*s~+^So~O#g+X#h;'S+X;'S;=`+j<%lO+X~+mP;=`<%l+X~+uT!c~!O!P,U![!],j!c!},U#R#S,U#T#o,U~,ZTp~!O!P,U!Q![,U!c!},U#R#S,U#T#o,U~,oOu~~,tTc~!O!P(w!Q![-T!c!}-T#R#S-T#T#o(w~-[Tq~c~!O!P(w!Q![-T!c!}-T#R#S-T#T#o(w~-nPYZ-q~-vO_~~-{Oi~",
|
|
15
|
+
tokenizers: [dqTokenizer, sqTokenizer, btTokenizer, 0],
|
|
16
|
+
topRules: {"Script":[0,16]},
|
|
17
|
+
specialized: [{term: 19, get: (value) => spec_Identifier[value] || -1}],
|
|
18
|
+
tokenPrec: 710
|
|
19
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
2
|
+
export const
|
|
3
|
+
dqContent = 81,
|
|
4
|
+
DQEscape = 1,
|
|
5
|
+
DQVariable = 2,
|
|
6
|
+
DQDefineRef = 3,
|
|
7
|
+
DQLangRef = 4,
|
|
8
|
+
sqContent = 82,
|
|
9
|
+
SQEscape = 5,
|
|
10
|
+
SQVariable = 6,
|
|
11
|
+
SQDefineRef = 7,
|
|
12
|
+
SQLangRef = 8,
|
|
13
|
+
btContent = 83,
|
|
14
|
+
BTEscape = 9,
|
|
15
|
+
BTVariable = 10,
|
|
16
|
+
BTDefineRef = 11,
|
|
17
|
+
BTLangRef = 12,
|
|
18
|
+
LineComment = 13,
|
|
19
|
+
BlockComment = 14,
|
|
20
|
+
LineContinuation = 15,
|
|
21
|
+
Script = 16,
|
|
22
|
+
PreprocDirective = 17,
|
|
23
|
+
PreprocKeyword = 20,
|
|
24
|
+
Identifier = 19,
|
|
25
|
+
String = 22,
|
|
26
|
+
RawString = 24,
|
|
27
|
+
BacktickString = 26,
|
|
28
|
+
Variable = 27,
|
|
29
|
+
DefineReference = 28,
|
|
30
|
+
LangStringReference = 29,
|
|
31
|
+
Number = 30,
|
|
32
|
+
Flag = 31,
|
|
33
|
+
LabelReference = 32,
|
|
34
|
+
Constant = 33,
|
|
35
|
+
ArgumentValue = 35,
|
|
36
|
+
PluginCall = 36,
|
|
37
|
+
ColonColon = 37,
|
|
38
|
+
VariableDeclaration = 38,
|
|
39
|
+
Var = 39,
|
|
40
|
+
Command = 40,
|
|
41
|
+
CommandName = 42,
|
|
42
|
+
Block = 43,
|
|
43
|
+
FunctionBlock = 44,
|
|
44
|
+
Function = 45,
|
|
45
|
+
MacroBlock = 46,
|
|
46
|
+
PreprocMacro = 48,
|
|
47
|
+
SectionBlock = 49,
|
|
48
|
+
Section = 50,
|
|
49
|
+
SectionEnd = 51,
|
|
50
|
+
SectionGroupBlock = 52,
|
|
51
|
+
SectionGroup = 53,
|
|
52
|
+
PreprocConditional = 54,
|
|
53
|
+
PreprocIf = 56,
|
|
54
|
+
PreprocElse = 58,
|
|
55
|
+
PreprocEndif = 60,
|
|
56
|
+
SectionGroupEnd = 61,
|
|
57
|
+
PageExBlock = 62,
|
|
58
|
+
PageEx = 63,
|
|
59
|
+
PageExEnd = 64,
|
|
60
|
+
Label = 66,
|
|
61
|
+
PreprocMacroEnd = 68,
|
|
62
|
+
FunctionEnd = 69
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ExternalTokenizer } from '@lezer/lr';
|
|
2
|
+
import {
|
|
3
|
+
BTDefineRef,
|
|
4
|
+
BTEscape,
|
|
5
|
+
BTLangRef,
|
|
6
|
+
BTVariable,
|
|
7
|
+
btContent,
|
|
8
|
+
DQDefineRef,
|
|
9
|
+
DQEscape,
|
|
10
|
+
DQLangRef,
|
|
11
|
+
DQVariable,
|
|
12
|
+
dqContent,
|
|
13
|
+
SQDefineRef,
|
|
14
|
+
SQEscape,
|
|
15
|
+
SQLangRef,
|
|
16
|
+
SQVariable,
|
|
17
|
+
sqContent,
|
|
18
|
+
} from './parser.terms.js';
|
|
19
|
+
|
|
20
|
+
function makeTokenizer(
|
|
21
|
+
endChar: number,
|
|
22
|
+
content: number,
|
|
23
|
+
escapeToken: number,
|
|
24
|
+
variable: number,
|
|
25
|
+
defineRef: number,
|
|
26
|
+
langRef: number,
|
|
27
|
+
) {
|
|
28
|
+
return new ExternalTokenizer((input) => {
|
|
29
|
+
const ch = input.next;
|
|
30
|
+
if (ch < 0 || ch === endChar) return;
|
|
31
|
+
|
|
32
|
+
if (ch === 36 /* $ */) {
|
|
33
|
+
const next = input.peek(1);
|
|
34
|
+
|
|
35
|
+
// $\x escape
|
|
36
|
+
if (next === 92 /* \ */) {
|
|
37
|
+
const third = input.peek(2);
|
|
38
|
+
if (third >= 0) {
|
|
39
|
+
input.advance(3);
|
|
40
|
+
input.acceptToken(escapeToken);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// $$ escape
|
|
46
|
+
if (next === 36 /* $ */) {
|
|
47
|
+
input.advance(2);
|
|
48
|
+
input.acceptToken(escapeToken);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ${...} define reference
|
|
53
|
+
if (next === 123 /* { */) {
|
|
54
|
+
input.advance(2);
|
|
55
|
+
while (input.next >= 0 && input.next !== 125 /* } */) input.advance();
|
|
56
|
+
if (input.next === 125) input.advance();
|
|
57
|
+
input.acceptToken(defineRef);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// $(...) lang string reference
|
|
62
|
+
if (next === 40 /* ( */) {
|
|
63
|
+
input.advance(2);
|
|
64
|
+
while (input.next >= 0 && input.next !== 41 /* ) */) input.advance();
|
|
65
|
+
if (input.next === 41) input.advance();
|
|
66
|
+
input.acceptToken(langRef);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// $letter... variable
|
|
71
|
+
if ((next >= 65 && next <= 90) || (next >= 97 && next <= 122) || next === 95) {
|
|
72
|
+
input.advance(2);
|
|
73
|
+
while (true) {
|
|
74
|
+
const c = input.next;
|
|
75
|
+
if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122) || (c >= 48 && c <= 57) || c === 95 || c === 46)
|
|
76
|
+
input.advance();
|
|
77
|
+
else break;
|
|
78
|
+
}
|
|
79
|
+
input.acceptToken(variable);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// $digit variable
|
|
84
|
+
if (next >= 48 && next <= 57) {
|
|
85
|
+
input.advance(2);
|
|
86
|
+
input.acceptToken(variable);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Plain content: consume until end delimiter, $, or EOF
|
|
92
|
+
do {
|
|
93
|
+
input.advance();
|
|
94
|
+
} while (input.next >= 0 && input.next !== endChar && input.next !== 36);
|
|
95
|
+
input.acceptToken(content);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const dqTokenizer = makeTokenizer(34 /* " */, dqContent, DQEscape, DQVariable, DQDefineRef, DQLangRef);
|
|
100
|
+
export const sqTokenizer = makeTokenizer(39 /* ' */, sqContent, SQEscape, SQVariable, SQDefineRef, SQLangRef);
|
|
101
|
+
export const btTokenizer = makeTokenizer(96 /* ` */, btContent, BTEscape, BTVariable, BTDefineRef, BTLangRef);
|