@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/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nsis/codemirror",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "NSIS language support for CodeMirror 6",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/idleberg/nsis-javascript-tools.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/idleberg/nsis-javascript-tools/tree/main/packages/codemirror#readme",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.mts",
|
|
16
|
+
"default": "./dist/index.mjs"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.cts",
|
|
20
|
+
"default": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"src",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"codemirror",
|
|
31
|
+
"lezer",
|
|
32
|
+
"nsis",
|
|
33
|
+
"nullsoft",
|
|
34
|
+
"syntax"
|
|
35
|
+
],
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@codemirror/autocomplete": "^6.20.3",
|
|
38
|
+
"@codemirror/language": "^6.12.3",
|
|
39
|
+
"@lezer/highlight": "^1.2.3",
|
|
40
|
+
"@lezer/lr": "^1.4.10"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@lezer/generator": "^1.8.0",
|
|
44
|
+
"vite": "^8.0.16",
|
|
45
|
+
"vitest": "^4.1.9"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"prebuild": "npm run build:lezer",
|
|
49
|
+
"build": "tsdown",
|
|
50
|
+
"build:lezer": "lezer-generator src/nsis.grammar --output src/parser",
|
|
51
|
+
"start": "npm run build:lezer && vite",
|
|
52
|
+
"test": "vitest run"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/highlight.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { styleTags, tags as t } from '@lezer/highlight';
|
|
2
|
+
|
|
3
|
+
export const nsisHighlighting = styleTags({
|
|
4
|
+
CommandName: t.keyword,
|
|
5
|
+
'Function FunctionEnd Section SectionEnd SectionGroup SectionGroupEnd PageEx PageExEnd Var': t.keyword,
|
|
6
|
+
PreprocKeyword: t.processingInstruction,
|
|
7
|
+
PreprocIf: t.processingInstruction,
|
|
8
|
+
PreprocElse: t.processingInstruction,
|
|
9
|
+
PreprocEndif: t.processingInstruction,
|
|
10
|
+
PreprocMacro: t.processingInstruction,
|
|
11
|
+
PreprocMacroEnd: t.processingInstruction,
|
|
12
|
+
Constant: t.constant(t.name),
|
|
13
|
+
ArgumentValue: t.atom,
|
|
14
|
+
Variable: t.variableName,
|
|
15
|
+
DefineReference: t.special(t.variableName),
|
|
16
|
+
LangStringReference: t.special(t.string),
|
|
17
|
+
Flag: t.attributeName,
|
|
18
|
+
Number: t.number,
|
|
19
|
+
String: t.string,
|
|
20
|
+
RawString: t.string,
|
|
21
|
+
BacktickString: t.string,
|
|
22
|
+
'DQEscape SQEscape BTEscape': t.escape,
|
|
23
|
+
'DQVariable SQVariable BTVariable': t.variableName,
|
|
24
|
+
'DQDefineRef SQDefineRef BTDefineRef': t.special(t.variableName),
|
|
25
|
+
'DQLangRef SQLangRef BTLangRef': t.special(t.string),
|
|
26
|
+
LineComment: t.lineComment,
|
|
27
|
+
BlockComment: t.blockComment,
|
|
28
|
+
Label: t.labelName,
|
|
29
|
+
LabelReference: t.labelName,
|
|
30
|
+
'PluginCall/Identifier': t.className,
|
|
31
|
+
'::': t.punctuation,
|
|
32
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { completeFromList } from '@codemirror/autocomplete';
|
|
2
|
+
import { foldInside, foldNodeProp, indentNodeProp, LanguageSupport, LRLanguage } from '@codemirror/language';
|
|
3
|
+
import { nsisHighlighting } from './highlight';
|
|
4
|
+
import { parser } from './parser';
|
|
5
|
+
|
|
6
|
+
export const nsisLanguage = LRLanguage.define({
|
|
7
|
+
name: 'nsis',
|
|
8
|
+
parser: parser.configure({
|
|
9
|
+
props: [
|
|
10
|
+
nsisHighlighting,
|
|
11
|
+
indentNodeProp.add({
|
|
12
|
+
FunctionBlock: (cx) => cx.baseIndent + cx.unit,
|
|
13
|
+
SectionBlock: (cx) => cx.baseIndent + cx.unit,
|
|
14
|
+
SectionGroupBlock: (cx) => cx.baseIndent + cx.unit,
|
|
15
|
+
PageExBlock: (cx) => cx.baseIndent + cx.unit,
|
|
16
|
+
MacroBlock: (cx) => cx.baseIndent + cx.unit,
|
|
17
|
+
PreprocConditional: (cx) => cx.baseIndent + cx.unit,
|
|
18
|
+
}),
|
|
19
|
+
foldNodeProp.add({
|
|
20
|
+
FunctionBlock: foldInside,
|
|
21
|
+
SectionBlock: foldInside,
|
|
22
|
+
SectionGroupBlock: foldInside,
|
|
23
|
+
PageExBlock: foldInside,
|
|
24
|
+
MacroBlock: foldInside,
|
|
25
|
+
PreprocConditional: foldInside,
|
|
26
|
+
BlockComment: foldInside,
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
}),
|
|
30
|
+
languageData: {
|
|
31
|
+
commentTokens: { line: '#', block: { open: '/*', close: '*/' } },
|
|
32
|
+
closeBrackets: { brackets: ['(', '[', '{', '"', "'", '`'] },
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const commands = [
|
|
37
|
+
'Abort',
|
|
38
|
+
'AddBrandingImage',
|
|
39
|
+
'AddSize',
|
|
40
|
+
'AllowRootDirInstall',
|
|
41
|
+
'AllowSkipFiles',
|
|
42
|
+
'AutoCloseWindow',
|
|
43
|
+
'BGFont',
|
|
44
|
+
'BGGradient',
|
|
45
|
+
'BrandingText',
|
|
46
|
+
'BringToFront',
|
|
47
|
+
'Call',
|
|
48
|
+
'CallInstDLL',
|
|
49
|
+
'Caption',
|
|
50
|
+
'ChangeUI',
|
|
51
|
+
'CheckBitmap',
|
|
52
|
+
'ClearErrors',
|
|
53
|
+
'CompletedText',
|
|
54
|
+
'ComponentText',
|
|
55
|
+
'CopyFiles',
|
|
56
|
+
'CPU',
|
|
57
|
+
'CRCCheck',
|
|
58
|
+
'CreateDirectory',
|
|
59
|
+
'CreateFont',
|
|
60
|
+
'CreateShortCut',
|
|
61
|
+
'Delete',
|
|
62
|
+
'DeleteINISec',
|
|
63
|
+
'DeleteINIStr',
|
|
64
|
+
'DeleteRegKey',
|
|
65
|
+
'DeleteRegValue',
|
|
66
|
+
'DetailPrint',
|
|
67
|
+
'DetailsButtonText',
|
|
68
|
+
'DirText',
|
|
69
|
+
'DirVar',
|
|
70
|
+
'DirVerify',
|
|
71
|
+
'EnableWindow',
|
|
72
|
+
'EnumRegKey',
|
|
73
|
+
'EnumRegValue',
|
|
74
|
+
'Exch',
|
|
75
|
+
'Exec',
|
|
76
|
+
'ExecShell',
|
|
77
|
+
'ExecShellWait',
|
|
78
|
+
'ExecWait',
|
|
79
|
+
'ExpandEnvStrings',
|
|
80
|
+
'File',
|
|
81
|
+
'FileBufSize',
|
|
82
|
+
'FileClose',
|
|
83
|
+
'FileErrorText',
|
|
84
|
+
'FileOpen',
|
|
85
|
+
'FileRead',
|
|
86
|
+
'FileReadByte',
|
|
87
|
+
'FileReadUTF16LE',
|
|
88
|
+
'FileReadWord',
|
|
89
|
+
'FileSeek',
|
|
90
|
+
'FileWrite',
|
|
91
|
+
'FileWriteByte',
|
|
92
|
+
'FileWriteUTF16LE',
|
|
93
|
+
'FileWriteWord',
|
|
94
|
+
'FindClose',
|
|
95
|
+
'FindFirst',
|
|
96
|
+
'FindNext',
|
|
97
|
+
'FindWindow',
|
|
98
|
+
'FlushINI',
|
|
99
|
+
'Function',
|
|
100
|
+
'FunctionEnd',
|
|
101
|
+
'GetCurInstType',
|
|
102
|
+
'GetCurrentAddress',
|
|
103
|
+
'GetDlgItem',
|
|
104
|
+
'GetDLLVersion',
|
|
105
|
+
'GetDLLVersionLocal',
|
|
106
|
+
'GetErrorLevel',
|
|
107
|
+
'GetFileTime',
|
|
108
|
+
'GetFileTimeLocal',
|
|
109
|
+
'GetFullPathName',
|
|
110
|
+
'GetFunctionAddress',
|
|
111
|
+
'GetInstDirError',
|
|
112
|
+
'GetKnownFolderPath',
|
|
113
|
+
'GetLabelAddress',
|
|
114
|
+
'GetRegView',
|
|
115
|
+
'GetShellVarContext',
|
|
116
|
+
'GetTempFileName',
|
|
117
|
+
'GetWinVer',
|
|
118
|
+
'Goto',
|
|
119
|
+
'HideWindow',
|
|
120
|
+
'Icon',
|
|
121
|
+
'IfAbort',
|
|
122
|
+
'IfAltRegView',
|
|
123
|
+
'IfErrors',
|
|
124
|
+
'IfFileExists',
|
|
125
|
+
'IfRebootFlag',
|
|
126
|
+
'IfRtlLanguage',
|
|
127
|
+
'IfShellVarContextAll',
|
|
128
|
+
'IfSilent',
|
|
129
|
+
'InitPluginsDir',
|
|
130
|
+
'InstallButtonText',
|
|
131
|
+
'InstallColors',
|
|
132
|
+
'InstallDir',
|
|
133
|
+
'InstallDirRegKey',
|
|
134
|
+
'InstProgressFlags',
|
|
135
|
+
'InstType',
|
|
136
|
+
'InstTypeGetText',
|
|
137
|
+
'InstTypeSetText',
|
|
138
|
+
'Int64Cmp',
|
|
139
|
+
'Int64CmpU',
|
|
140
|
+
'Int64Fmt',
|
|
141
|
+
'IntCmp',
|
|
142
|
+
'IntCmpU',
|
|
143
|
+
'IntFmt',
|
|
144
|
+
'IntOp',
|
|
145
|
+
'IntPtrCmp',
|
|
146
|
+
'IntPtrCmpU',
|
|
147
|
+
'IntPtrOp',
|
|
148
|
+
'IsWindow',
|
|
149
|
+
'LangString',
|
|
150
|
+
'LicenseBkColor',
|
|
151
|
+
'LicenseData',
|
|
152
|
+
'LicenseForceSelection',
|
|
153
|
+
'LicenseLangString',
|
|
154
|
+
'LicenseText',
|
|
155
|
+
'LoadAndSetImage',
|
|
156
|
+
'LoadLanguageFile',
|
|
157
|
+
'LockWindow',
|
|
158
|
+
'LogSet',
|
|
159
|
+
'LogText',
|
|
160
|
+
'ManifestAppendCustomString',
|
|
161
|
+
'ManifestDisableWindowFiltering',
|
|
162
|
+
'ManifestDPIAware',
|
|
163
|
+
'ManifestDPIAwareness',
|
|
164
|
+
'ManifestGdiScaling',
|
|
165
|
+
'ManifestLongPathAware',
|
|
166
|
+
'ManifestMaxVersionTested',
|
|
167
|
+
'ManifestSupportedOS',
|
|
168
|
+
'MessageBox',
|
|
169
|
+
'MiscButtonText',
|
|
170
|
+
'Name',
|
|
171
|
+
'Nop',
|
|
172
|
+
'OutFile',
|
|
173
|
+
'Page',
|
|
174
|
+
'PageCallbacks',
|
|
175
|
+
'PageEx',
|
|
176
|
+
'PageExEnd',
|
|
177
|
+
'PEAddResource',
|
|
178
|
+
'PEDllCharacteristics',
|
|
179
|
+
'PERemoveResource',
|
|
180
|
+
'PESubsysVer',
|
|
181
|
+
'Pop',
|
|
182
|
+
'Push',
|
|
183
|
+
'Quit',
|
|
184
|
+
'ReadEnvStr',
|
|
185
|
+
'ReadINIStr',
|
|
186
|
+
'ReadMemory',
|
|
187
|
+
'ReadRegDWORD',
|
|
188
|
+
'ReadRegStr',
|
|
189
|
+
'Reboot',
|
|
190
|
+
'RegDLL',
|
|
191
|
+
'Rename',
|
|
192
|
+
'RequestExecutionLevel',
|
|
193
|
+
'ReserveFile',
|
|
194
|
+
'Return',
|
|
195
|
+
'RMDir',
|
|
196
|
+
'SearchPath',
|
|
197
|
+
'Section',
|
|
198
|
+
'SectionEnd',
|
|
199
|
+
'SectionGroup',
|
|
200
|
+
'SectionGroupEnd',
|
|
201
|
+
'SectionGetFlags',
|
|
202
|
+
'SectionGetInstTypes',
|
|
203
|
+
'SectionGetSize',
|
|
204
|
+
'SectionGetText',
|
|
205
|
+
'SectionIn',
|
|
206
|
+
'SectionInstType',
|
|
207
|
+
'SectionSetFlags',
|
|
208
|
+
'SectionSetInstTypes',
|
|
209
|
+
'SectionSetSize',
|
|
210
|
+
'SectionSetText',
|
|
211
|
+
'SendMessage',
|
|
212
|
+
'SetAutoClose',
|
|
213
|
+
'SetBrandingImage',
|
|
214
|
+
'SetCompress',
|
|
215
|
+
'SetCompressionLevel',
|
|
216
|
+
'SetCompressor',
|
|
217
|
+
'SetCompressorDictSize',
|
|
218
|
+
'SetCtlColors',
|
|
219
|
+
'SetCurInstType',
|
|
220
|
+
'SetDatablockOptimize',
|
|
221
|
+
'SetDateSave',
|
|
222
|
+
'SetDetailsPrint',
|
|
223
|
+
'SetDetailsView',
|
|
224
|
+
'SetErrorLevel',
|
|
225
|
+
'SetErrors',
|
|
226
|
+
'SetFileAttributes',
|
|
227
|
+
'SetFont',
|
|
228
|
+
'SetOutPath',
|
|
229
|
+
'SetOverwrite',
|
|
230
|
+
'SetRebootFlag',
|
|
231
|
+
'SetRegView',
|
|
232
|
+
'SetShellVarContext',
|
|
233
|
+
'SetSilent',
|
|
234
|
+
'ShowInstDetails',
|
|
235
|
+
'ShowUninstDetails',
|
|
236
|
+
'ShowWindow',
|
|
237
|
+
'SilentInstall',
|
|
238
|
+
'SilentUnInstall',
|
|
239
|
+
'Sleep',
|
|
240
|
+
'SpaceTexts',
|
|
241
|
+
'StrCmp',
|
|
242
|
+
'StrCmpS',
|
|
243
|
+
'StrCpy',
|
|
244
|
+
'StrLen',
|
|
245
|
+
'SubCaption',
|
|
246
|
+
'Target',
|
|
247
|
+
'Unicode',
|
|
248
|
+
'UnsafeStrCpy',
|
|
249
|
+
'UninstallButtonText',
|
|
250
|
+
'UninstallCaption',
|
|
251
|
+
'UninstallIcon',
|
|
252
|
+
'UninstallSubCaption',
|
|
253
|
+
'UninstallText',
|
|
254
|
+
'UninstPage',
|
|
255
|
+
'UnRegDLL',
|
|
256
|
+
'Var',
|
|
257
|
+
'VIAddVersionKey',
|
|
258
|
+
'VIFileVersion',
|
|
259
|
+
'VIProductVersion',
|
|
260
|
+
'WindowIcon',
|
|
261
|
+
'WriteINIStr',
|
|
262
|
+
'WriteRegBin',
|
|
263
|
+
'WriteRegDWORD',
|
|
264
|
+
'WriteRegExpandStr',
|
|
265
|
+
'WriteRegMultiStr',
|
|
266
|
+
'WriteRegNone',
|
|
267
|
+
'WriteRegStr',
|
|
268
|
+
'WriteUninstaller',
|
|
269
|
+
'XPStyle',
|
|
270
|
+
];
|
|
271
|
+
|
|
272
|
+
const preprocDirectives = [
|
|
273
|
+
'!addincludedir',
|
|
274
|
+
'!addplugindir',
|
|
275
|
+
'!appendfile',
|
|
276
|
+
'!appendmemfile',
|
|
277
|
+
'!assert',
|
|
278
|
+
'!cd',
|
|
279
|
+
'!define',
|
|
280
|
+
'!delfile',
|
|
281
|
+
'!echo',
|
|
282
|
+
'!else',
|
|
283
|
+
'!endif',
|
|
284
|
+
'!error',
|
|
285
|
+
'!execute',
|
|
286
|
+
'!finalize',
|
|
287
|
+
'!getdllversion',
|
|
288
|
+
'!gettlbversion',
|
|
289
|
+
'!if',
|
|
290
|
+
'!ifdef',
|
|
291
|
+
'!ifndef',
|
|
292
|
+
'!ifmacrodef',
|
|
293
|
+
'!ifmacrondef',
|
|
294
|
+
'!include',
|
|
295
|
+
'!insertmacro',
|
|
296
|
+
'!macro',
|
|
297
|
+
'!macroend',
|
|
298
|
+
'!macroundef',
|
|
299
|
+
'!makensis',
|
|
300
|
+
'!packhdr',
|
|
301
|
+
'!pragma',
|
|
302
|
+
'!searchparse',
|
|
303
|
+
'!searchreplace',
|
|
304
|
+
'!system',
|
|
305
|
+
'!tempfile',
|
|
306
|
+
'!undef',
|
|
307
|
+
'!uninstfinalize',
|
|
308
|
+
'!verbose',
|
|
309
|
+
'!warning',
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
const nsisCompletion = completeFromList(
|
|
313
|
+
commands
|
|
314
|
+
.map((c) => ({ label: c, type: 'keyword' }))
|
|
315
|
+
.concat(preprocDirectives.map((d) => ({ label: d, type: 'keyword' }))),
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
export function nsis() {
|
|
319
|
+
return new LanguageSupport(nsisLanguage, [nsisLanguage.data.of({ autocomplete: nsisCompletion })]);
|
|
320
|
+
}
|
package/src/nsis.grammar
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
@top Script { (statement | Block | PreprocConditional | newline)* trailingStatement? }
|
|
2
|
+
|
|
3
|
+
trailingStatement { PreprocDirective | PluginCall | VariableDeclaration | Command }
|
|
4
|
+
|
|
5
|
+
@precedence {
|
|
6
|
+
pluginCall @left,
|
|
7
|
+
command @left
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Block {
|
|
11
|
+
FunctionBlock |
|
|
12
|
+
SectionBlock |
|
|
13
|
+
SectionGroupBlock |
|
|
14
|
+
PageExBlock |
|
|
15
|
+
MacroBlock
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
FunctionBlock {
|
|
19
|
+
kw<"Function"> value* newline
|
|
20
|
+
body
|
|
21
|
+
kw<"FunctionEnd">
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
SectionBlock {
|
|
25
|
+
kw<"Section"> value* newline
|
|
26
|
+
body
|
|
27
|
+
kw<"SectionEnd">
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
SectionGroupBlock {
|
|
31
|
+
kw<"SectionGroup"> value* newline
|
|
32
|
+
(SectionBlock | SectionGroupBlock | PreprocConditional | statement | newline)*
|
|
33
|
+
kw<"SectionGroupEnd">
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
PageExBlock {
|
|
37
|
+
kw<"PageEx"> value* newline
|
|
38
|
+
body
|
|
39
|
+
kw<"PageExEnd">
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
MacroBlock {
|
|
43
|
+
PreprocMacro Identifier (Identifier)* newline
|
|
44
|
+
macroBody
|
|
45
|
+
PreprocMacroEnd
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
body {
|
|
49
|
+
(MacroBlock | PreprocConditional | statement | Label | newline)*
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
macroBody {
|
|
53
|
+
(FunctionBlock | SectionBlock | SectionGroupBlock | PageExBlock | MacroBlock | PreprocConditional | statement | Label | newline)*
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
PreprocConditional {
|
|
57
|
+
PreprocIf value* newline
|
|
58
|
+
body
|
|
59
|
+
(PreprocElse value* newline body)*
|
|
60
|
+
PreprocEndif
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
statement {
|
|
64
|
+
(PreprocDirective | PluginCall | VariableDeclaration | Command) newline
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
PreprocDirective {
|
|
68
|
+
PreprocKeyword value*
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
PluginCall {
|
|
72
|
+
Identifier !pluginCall ColonColon Identifier value*
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
VariableDeclaration {
|
|
76
|
+
kw<"Var"> Flag? Identifier
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Command {
|
|
80
|
+
CommandName !command value*
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
value {
|
|
84
|
+
String |
|
|
85
|
+
RawString |
|
|
86
|
+
BacktickString |
|
|
87
|
+
Variable |
|
|
88
|
+
DefineReference |
|
|
89
|
+
LangStringReference |
|
|
90
|
+
Number |
|
|
91
|
+
Flag |
|
|
92
|
+
LabelReference |
|
|
93
|
+
Constant |
|
|
94
|
+
ArgumentValue |
|
|
95
|
+
Identifier
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
String { '"' (dqContent | DQEscape | DQVariable | DQDefineRef | DQLangRef)* '"' }
|
|
99
|
+
RawString { "'" (sqContent | SQEscape | SQVariable | SQDefineRef | SQLangRef)* "'" }
|
|
100
|
+
BacktickString { '`' (btContent | BTEscape | BTVariable | BTDefineRef | BTLangRef)* '`' }
|
|
101
|
+
|
|
102
|
+
@external tokens dqTokenizer from "./string-tokens.ts" { dqContent, DQEscape, DQVariable, DQDefineRef, DQLangRef }
|
|
103
|
+
@external tokens sqTokenizer from "./string-tokens.ts" { sqContent, SQEscape, SQVariable, SQDefineRef, SQLangRef }
|
|
104
|
+
@external tokens btTokenizer from "./string-tokens.ts" { btContent, BTEscape, BTVariable, BTDefineRef, BTLangRef }
|
|
105
|
+
|
|
106
|
+
Label { Identifier ":" }
|
|
107
|
+
|
|
108
|
+
@skip { space | LineComment | BlockComment | LineContinuation }
|
|
109
|
+
|
|
110
|
+
@tokens {
|
|
111
|
+
space { $[ \t\r]+ }
|
|
112
|
+
|
|
113
|
+
newline { "\n" }
|
|
114
|
+
|
|
115
|
+
LineComment { (";" | "#") ![\n]* }
|
|
116
|
+
|
|
117
|
+
BlockComment { "/*" blockCommentRest }
|
|
118
|
+
|
|
119
|
+
blockCommentRest { ![*] blockCommentRest | "*" blockCommentAfterStar }
|
|
120
|
+
|
|
121
|
+
blockCommentAfterStar { "/" | ![/*] blockCommentRest | "*" blockCommentAfterStar }
|
|
122
|
+
|
|
123
|
+
LineContinuation { "\\" "\n" }
|
|
124
|
+
|
|
125
|
+
Variable { "$" $[a-zA-Z_] $[a-zA-Z0-9_.]* | "$" $[0-9] }
|
|
126
|
+
|
|
127
|
+
DefineReference { "${" ![}]+ "}" }
|
|
128
|
+
|
|
129
|
+
LangStringReference { "$(" ![)]+ ")" }
|
|
130
|
+
|
|
131
|
+
Number { ("+" | "-")? ($[0-9]+ ("." $[0-9]+)? | "0" $[xX] $[0-9a-fA-F]+) }
|
|
132
|
+
|
|
133
|
+
Flag { "/" $[a-zA-Z_] $[a-zA-Z0-9_]* ("=" ![\s]*)? }
|
|
134
|
+
|
|
135
|
+
LabelReference { ":" $[a-zA-Z_.] $[a-zA-Z0-9_.]* }
|
|
136
|
+
|
|
137
|
+
Constant { $[A-Z] $[A-Z0-9_]+ }
|
|
138
|
+
|
|
139
|
+
ColonColon { "::" }
|
|
140
|
+
|
|
141
|
+
Identifier { $[a-zA-Z_.] $[a-zA-Z0-9_.]* | "!" $[a-zA-Z_] $[a-zA-Z0-9_]* }
|
|
142
|
+
|
|
143
|
+
":" "/" '"' "'" '`'
|
|
144
|
+
|
|
145
|
+
@precedence { BlockComment, LineComment, LabelReference, Number, Variable, DefineReference, LangStringReference, Flag, ColonColon, Constant, Identifier, space, ":" }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
kw<term> { @specialize[@name={term}]<Identifier, term> }
|
|
149
|
+
|
|
150
|
+
CommandName {
|
|
151
|
+
@specialize[@name=CommandName]<Identifier,
|
|
152
|
+
"Abort" | "AddBrandingImage" | "AddSize" | "AllowRootDirInstall" | "AllowSkipFiles" |
|
|
153
|
+
"AutoCloseWindow" | "BGFont" | "BGGradient" | "BrandingText" | "BringToFront" |
|
|
154
|
+
"Call" | "CallInstDLL" | "Caption" | "ChangeUI" | "CheckBitmap" |
|
|
155
|
+
"ClearErrors" | "CompletedText" | "ComponentText" | "CopyFiles" | "CPU" | "CRCCheck" |
|
|
156
|
+
"CreateDirectory" | "CreateFont" | "CreateShortCut" |
|
|
157
|
+
"Delete" | "DeleteINISec" | "DeleteINIStr" | "DeleteRegKey" | "DeleteRegValue" |
|
|
158
|
+
"DetailPrint" | "DetailsButtonText" | "DirText" | "DirVar" | "DirVerify" |
|
|
159
|
+
"EnableWindow" | "EnumRegKey" | "EnumRegValue" | "Exch" | "Exec" |
|
|
160
|
+
"ExecShell" | "ExecShellWait" | "ExecWait" | "ExpandEnvStrings" |
|
|
161
|
+
"File" | "FileBufSize" | "FileClose" | "FileErrorText" | "FileOpen" |
|
|
162
|
+
"FileRead" | "FileReadByte" | "FileReadUTF16LE" | "FileReadWord" |
|
|
163
|
+
"FileSeek" | "FileWrite" | "FileWriteByte" | "FileWriteUTF16LE" | "FileWriteWord" |
|
|
164
|
+
"FindClose" | "FindFirst" | "FindNext" | "FindWindow" | "FlushINI" |
|
|
165
|
+
"GetCurInstType" | "GetCurrentAddress" | "GetDlgItem" | "GetDLLVersion" | "GetDLLVersionLocal" |
|
|
166
|
+
"GetErrorLevel" | "GetFileTime" | "GetFileTimeLocal" | "GetFullPathName" |
|
|
167
|
+
"GetFunctionAddress" | "GetInstDirError" | "GetKnownFolderPath" | "GetLabelAddress" |
|
|
168
|
+
"GetRegView" | "GetShellVarContext" | "GetTempFileName" | "GetWinVer" |
|
|
169
|
+
"Goto" | "HideWindow" | "Icon" |
|
|
170
|
+
"IfAbort" | "IfAltRegView" | "IfErrors" | "IfFileExists" | "IfRebootFlag" |
|
|
171
|
+
"IfRtlLanguage" | "IfShellVarContextAll" | "IfSilent" |
|
|
172
|
+
"InitPluginsDir" | "InstallButtonText" | "InstallColors" | "InstallDir" | "InstallDirRegKey" |
|
|
173
|
+
"InstProgressFlags" | "InstType" | "InstTypeGetText" | "InstTypeSetText" |
|
|
174
|
+
"Int64Cmp" | "Int64CmpU" | "Int64Fmt" | "IntCmp" | "IntCmpU" | "IntFmt" | "IntOp" |
|
|
175
|
+
"IntPtrCmp" | "IntPtrCmpU" | "IntPtrOp" | "IsWindow" |
|
|
176
|
+
"LangString" | "LicenseBkColor" | "LicenseData" | "LicenseForceSelection" |
|
|
177
|
+
"LicenseLangString" | "LicenseText" | "LoadAndSetImage" | "LoadLanguageFile" | "LockWindow" |
|
|
178
|
+
"LogSet" | "LogText" |
|
|
179
|
+
"ManifestAppendCustomString" | "ManifestDisableWindowFiltering" | "ManifestDPIAware" |
|
|
180
|
+
"ManifestDPIAwareness" | "ManifestGdiScaling" | "ManifestLongPathAware" |
|
|
181
|
+
"ManifestMaxVersionTested" | "ManifestSupportedOS" |
|
|
182
|
+
"MessageBox" | "MiscButtonText" | "Name" | "Nop" | "OutFile" |
|
|
183
|
+
"Page" | "PageCallbacks" |
|
|
184
|
+
"PEAddResource" | "PEDllCharacteristics" | "PERemoveResource" | "PESubsysVer" |
|
|
185
|
+
"Pop" | "Push" | "Quit" |
|
|
186
|
+
"ReadEnvStr" | "ReadINIStr" | "ReadMemory" | "ReadRegDWORD" | "ReadRegStr" |
|
|
187
|
+
"Reboot" | "RegDLL" | "Rename" | "RequestExecutionLevel" | "ReserveFile" | "Return" | "RMDir" |
|
|
188
|
+
"SearchPath" |
|
|
189
|
+
"SectionGetFlags" | "SectionGetInstTypes" | "SectionGetSize" | "SectionGetText" |
|
|
190
|
+
"SectionIn" | "SectionInstType" |
|
|
191
|
+
"SectionSetFlags" | "SectionSetInstTypes" | "SectionSetSize" | "SectionSetText" |
|
|
192
|
+
"SendMessage" | "SetAutoClose" | "SetBrandingImage" | "SetCompress" | "SetCompressionLevel" |
|
|
193
|
+
"SetCompressor" | "SetCompressorDictSize" | "SetCtlColors" | "SetCurInstType" |
|
|
194
|
+
"SetDatablockOptimize" | "SetDateSave" | "SetDetailsPrint" | "SetDetailsView" |
|
|
195
|
+
"SetErrorLevel" | "SetErrors" | "SetFileAttributes" | "SetFont" | "SetOutPath" |
|
|
196
|
+
"SetOverwrite" | "SetRebootFlag" | "SetRegView" | "SetShellVarContext" | "SetSilent" |
|
|
197
|
+
"ShowInstDetails" | "ShowUninstDetails" | "ShowWindow" |
|
|
198
|
+
"SilentInstall" | "SilentUnInstall" | "Sleep" | "SpaceTexts" |
|
|
199
|
+
"StrCmp" | "StrCmpS" | "StrCpy" | "StrLen" | "SubCaption" |
|
|
200
|
+
"Target" | "Unicode" | "UnsafeStrCpy" |
|
|
201
|
+
"UninstallButtonText" | "UninstallCaption" | "UninstallIcon" |
|
|
202
|
+
"UninstallSubCaption" | "UninstallText" | "UninstPage" | "UnRegDLL" |
|
|
203
|
+
"VIAddVersionKey" | "VIFileVersion" | "VIProductVersion" |
|
|
204
|
+
"WindowIcon" | "WriteINIStr" | "WriteRegBin" | "WriteRegDWORD" |
|
|
205
|
+
"WriteRegExpandStr" | "WriteRegMultiStr" | "WriteRegNone" | "WriteRegStr" |
|
|
206
|
+
"WriteUninstaller" | "XPStyle"
|
|
207
|
+
>
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
PreprocKeyword {
|
|
211
|
+
@specialize[@name=PreprocKeyword]<Identifier,
|
|
212
|
+
"!addincludedir" | "!addplugindir" | "!appendfile" | "!appendmemfile" | "!assert" |
|
|
213
|
+
"!cd" | "!define" | "!delfile" | "!echo" | "!error" | "!execute" |
|
|
214
|
+
"!finalize" | "!getdllversion" | "!gettlbversion" | "!include" | "!insertmacro" |
|
|
215
|
+
"!macroundef" | "!makensis" | "!packhdr" | "!pragma" |
|
|
216
|
+
"!searchparse" | "!searchreplace" | "!system" | "!tempfile" |
|
|
217
|
+
"!undef" | "!uninstfinalize" | "!verbose" | "!warning"
|
|
218
|
+
>
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
PreprocIf {
|
|
222
|
+
@specialize[@name=PreprocIf]<Identifier,
|
|
223
|
+
"!if" | "!ifdef" | "!ifndef" | "!ifmacrodef" | "!ifmacrondef"
|
|
224
|
+
>
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
PreprocElse {
|
|
228
|
+
@specialize[@name=PreprocElse]<Identifier, "!else">
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
PreprocEndif {
|
|
232
|
+
@specialize[@name=PreprocEndif]<Identifier, "!endif">
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
PreprocMacro {
|
|
236
|
+
@specialize[@name=PreprocMacro]<Identifier, "!macro">
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
PreprocMacroEnd {
|
|
240
|
+
@specialize[@name=PreprocMacroEnd]<Identifier, "!macroend">
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
ArgumentValue {
|
|
244
|
+
@specialize[@name=ArgumentValue]<Identifier,
|
|
245
|
+
"admin" | "all" | "amd64-unicode" | "auto" | "both" | "bottom" | "bzip2" |
|
|
246
|
+
"components" | "current" | "custom" | "default" | "directory" |
|
|
247
|
+
"false" | "force" | "hide" | "highest" |
|
|
248
|
+
"ifdiff" | "ifnewer" | "instfiles" |
|
|
249
|
+
"lastused" | "leave" | "left" | "license" | "listonly" | "lzma" |
|
|
250
|
+
"nevershow" | "none" | "normal" | "notset" |
|
|
251
|
+
"off" | "on" |
|
|
252
|
+
"right" |
|
|
253
|
+
"show" | "silent" | "silentlog" |
|
|
254
|
+
"textonly" | "top" | "true" | "try" |
|
|
255
|
+
"un.components" | "un.custom" | "un.directory" | "un.instfiles" | "un.license" |
|
|
256
|
+
"uninstConfirm" | "user" |
|
|
257
|
+
"zlib"
|
|
258
|
+
>
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@detectDelim
|