tree-sitter-nsis 0.1.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 +20 -0
- package/README.md +21 -0
- package/grammar.js +301 -0
- package/package.json +43 -0
- package/queries/folds.scm +7 -0
- package/queries/highlights.scm +122 -0
- package/queries/indents.scm +17 -0
- package/src/grammar.json +1173 -0
- package/src/node-types.json +1148 -0
- package/src/parser.c +13907 -0
- package/src/tree_sitter/alloc.h +54 -0
- package/src/tree_sitter/array.h +291 -0
- package/src/tree_sitter/parser.h +286 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jan T. Sott
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# tree-sitter-nsis
|
|
2
|
+
|
|
3
|
+
> NSIS grammar for tree-sitter
|
|
4
|
+
|
|
5
|
+
[](https://github.com/idleberg/tree-sitter-nsis/blob/main/LICENSE)
|
|
6
|
+
[](https://www.npmjs.org/package/tree-sitter-nsis)
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
> [!WARNING]
|
|
10
|
+
>
|
|
11
|
+
> This package is in an experimental change and things might break.
|
|
12
|
+
|
|
13
|
+
## Installation đŋ
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
pnpm install tree-sitter-nsis
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## License Šī¸
|
|
20
|
+
|
|
21
|
+
[The MIT License](LICENSE) - Feel free to use, modify, and distribute this code.
|
package/grammar.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/// <reference types="tree-sitter-cli/dsl" />
|
|
2
|
+
// @ts-check
|
|
3
|
+
|
|
4
|
+
module.exports = grammar({
|
|
5
|
+
name: 'nsis',
|
|
6
|
+
|
|
7
|
+
extras: $ => [
|
|
8
|
+
/[ \t\r]/,
|
|
9
|
+
$.line_continuation,
|
|
10
|
+
$.comment,
|
|
11
|
+
$.block_comment,
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
word: $ => $.identifier,
|
|
15
|
+
|
|
16
|
+
conflicts: $ => [],
|
|
17
|
+
|
|
18
|
+
rules: {
|
|
19
|
+
source_file: $ => repeat($._toplevel),
|
|
20
|
+
|
|
21
|
+
_toplevel: $ => choice(
|
|
22
|
+
$.function_definition,
|
|
23
|
+
$.section_definition,
|
|
24
|
+
$.section_group,
|
|
25
|
+
$.page_ex_block,
|
|
26
|
+
$.macro_definition,
|
|
27
|
+
$.preproc_conditional,
|
|
28
|
+
$.statement,
|
|
29
|
+
$.label,
|
|
30
|
+
$._newline,
|
|
31
|
+
),
|
|
32
|
+
|
|
33
|
+
_newline: _ => /\n/,
|
|
34
|
+
|
|
35
|
+
// ââ Block Definitions ââ
|
|
36
|
+
|
|
37
|
+
function_definition: $ => seq(
|
|
38
|
+
alias(/function/i, 'Function'),
|
|
39
|
+
field('name', $._value),
|
|
40
|
+
$._newline,
|
|
41
|
+
repeat($._body_item),
|
|
42
|
+
alias(/functionend/i, 'FunctionEnd'),
|
|
43
|
+
),
|
|
44
|
+
|
|
45
|
+
section_definition: $ => seq(
|
|
46
|
+
alias(/section/i, 'Section'),
|
|
47
|
+
repeat(field('parameter', $._value)),
|
|
48
|
+
$._newline,
|
|
49
|
+
repeat($._body_item),
|
|
50
|
+
alias(/sectionend/i, 'SectionEnd'),
|
|
51
|
+
),
|
|
52
|
+
|
|
53
|
+
section_group: $ => seq(
|
|
54
|
+
alias(/sectiongroup/i, 'SectionGroup'),
|
|
55
|
+
repeat(field('parameter', $._value)),
|
|
56
|
+
$._newline,
|
|
57
|
+
repeat(choice(
|
|
58
|
+
$.section_definition,
|
|
59
|
+
$.section_group,
|
|
60
|
+
$.preproc_conditional,
|
|
61
|
+
$.statement,
|
|
62
|
+
$.label,
|
|
63
|
+
$._newline,
|
|
64
|
+
)),
|
|
65
|
+
alias(/sectiongroupend/i, 'SectionGroupEnd'),
|
|
66
|
+
),
|
|
67
|
+
|
|
68
|
+
page_ex_block: $ => seq(
|
|
69
|
+
alias(/pageex/i, 'PageEx'),
|
|
70
|
+
optional(field('type', $._value)),
|
|
71
|
+
$._newline,
|
|
72
|
+
repeat($._body_item),
|
|
73
|
+
alias(/pageexend/i, 'PageExEnd'),
|
|
74
|
+
),
|
|
75
|
+
|
|
76
|
+
macro_definition: $ => seq(
|
|
77
|
+
alias(/!macro/i, '!macro'),
|
|
78
|
+
field('name', $.identifier),
|
|
79
|
+
repeat(field('parameter', $.identifier)),
|
|
80
|
+
$._newline,
|
|
81
|
+
repeat($._macro_body_item),
|
|
82
|
+
alias(/!macroend/i, '!macroend'),
|
|
83
|
+
),
|
|
84
|
+
|
|
85
|
+
_body_item: $ => choice(
|
|
86
|
+
$.preproc_conditional,
|
|
87
|
+
$.statement,
|
|
88
|
+
$.label,
|
|
89
|
+
$._newline,
|
|
90
|
+
),
|
|
91
|
+
|
|
92
|
+
_macro_body_item: $ => choice(
|
|
93
|
+
$.function_definition,
|
|
94
|
+
$.section_definition,
|
|
95
|
+
$.section_group,
|
|
96
|
+
$.page_ex_block,
|
|
97
|
+
$.macro_definition,
|
|
98
|
+
$.preproc_conditional,
|
|
99
|
+
$.statement,
|
|
100
|
+
$.label,
|
|
101
|
+
$._newline,
|
|
102
|
+
),
|
|
103
|
+
|
|
104
|
+
// ââ Preprocessor Conditionals ââ
|
|
105
|
+
|
|
106
|
+
preproc_conditional: $ => seq(
|
|
107
|
+
field('keyword', alias(
|
|
108
|
+
$._preproc_if_keyword,
|
|
109
|
+
$.preproc_keyword,
|
|
110
|
+
)),
|
|
111
|
+
repeat($._value),
|
|
112
|
+
$._newline,
|
|
113
|
+
repeat($._body_item),
|
|
114
|
+
repeat($.preproc_else),
|
|
115
|
+
alias(/!endif/i, '!endif'),
|
|
116
|
+
),
|
|
117
|
+
|
|
118
|
+
preproc_else: $ => seq(
|
|
119
|
+
alias(/!else/i, '!else'),
|
|
120
|
+
optional(seq(
|
|
121
|
+
field('modifier', $.identifier),
|
|
122
|
+
repeat($._value),
|
|
123
|
+
)),
|
|
124
|
+
$._newline,
|
|
125
|
+
repeat($._body_item),
|
|
126
|
+
),
|
|
127
|
+
|
|
128
|
+
_preproc_if_keyword: _ => choice(
|
|
129
|
+
/!ifdef/i,
|
|
130
|
+
/!ifndef/i,
|
|
131
|
+
/!ifmacrodef/i,
|
|
132
|
+
/!ifmacrondef/i,
|
|
133
|
+
/!if/i,
|
|
134
|
+
),
|
|
135
|
+
|
|
136
|
+
// ââ Statements ââ
|
|
137
|
+
|
|
138
|
+
statement: $ => seq(
|
|
139
|
+
choice(
|
|
140
|
+
$.preproc_directive,
|
|
141
|
+
$.plugin_call,
|
|
142
|
+
$.variable_declaration,
|
|
143
|
+
$.command,
|
|
144
|
+
),
|
|
145
|
+
$._newline,
|
|
146
|
+
),
|
|
147
|
+
|
|
148
|
+
preproc_directive: $ => seq(
|
|
149
|
+
field('directive', $.preproc_keyword),
|
|
150
|
+
repeat(field('argument', $._value)),
|
|
151
|
+
),
|
|
152
|
+
|
|
153
|
+
preproc_keyword: _ => choice(
|
|
154
|
+
/!addincludedir/i,
|
|
155
|
+
/!addplugindir/i,
|
|
156
|
+
/!appendfile/i,
|
|
157
|
+
/!assert/i,
|
|
158
|
+
/!cd/i,
|
|
159
|
+
/!define/i,
|
|
160
|
+
/!delfile/i,
|
|
161
|
+
/!echo/i,
|
|
162
|
+
/!error/i,
|
|
163
|
+
/!execute/i,
|
|
164
|
+
/!finalize/i,
|
|
165
|
+
/!getdllversion/i,
|
|
166
|
+
/!gettlbversion/i,
|
|
167
|
+
/!include/i,
|
|
168
|
+
/!insertmacro/i,
|
|
169
|
+
/!makensis/i,
|
|
170
|
+
/!packhdr/i,
|
|
171
|
+
/!pragma/i,
|
|
172
|
+
/!searchparse/i,
|
|
173
|
+
/!searchreplace/i,
|
|
174
|
+
/!system/i,
|
|
175
|
+
/!tempfile/i,
|
|
176
|
+
/!undef/i,
|
|
177
|
+
/!uninstfinalize/i,
|
|
178
|
+
/!verbose/i,
|
|
179
|
+
/!warning/i,
|
|
180
|
+
),
|
|
181
|
+
|
|
182
|
+
command: $ => prec.right(seq(
|
|
183
|
+
field('name', $.identifier),
|
|
184
|
+
repeat(field('argument', $._value)),
|
|
185
|
+
)),
|
|
186
|
+
|
|
187
|
+
plugin_call: $ => seq(
|
|
188
|
+
field('plugin', $.identifier),
|
|
189
|
+
token.immediate('::'),
|
|
190
|
+
field('function', $.identifier),
|
|
191
|
+
repeat(field('argument', $._value)),
|
|
192
|
+
),
|
|
193
|
+
|
|
194
|
+
variable_declaration: $ => seq(
|
|
195
|
+
alias(/var/i, 'Var'),
|
|
196
|
+
optional($.flag),
|
|
197
|
+
field('name', $.identifier),
|
|
198
|
+
),
|
|
199
|
+
|
|
200
|
+
label: $ => seq(
|
|
201
|
+
field('name', $.identifier),
|
|
202
|
+
token.immediate(':'),
|
|
203
|
+
),
|
|
204
|
+
|
|
205
|
+
// ââ Values ââ
|
|
206
|
+
|
|
207
|
+
_value: $ => choice(
|
|
208
|
+
$.string,
|
|
209
|
+
$.raw_string,
|
|
210
|
+
$.backtick_string,
|
|
211
|
+
$.variable,
|
|
212
|
+
$.define_reference,
|
|
213
|
+
$.lang_string_reference,
|
|
214
|
+
$.number,
|
|
215
|
+
$.flag,
|
|
216
|
+
$.label_reference,
|
|
217
|
+
$.comparison_operator,
|
|
218
|
+
$.pipe_operator,
|
|
219
|
+
$.identifier,
|
|
220
|
+
),
|
|
221
|
+
|
|
222
|
+
pipe_operator: _ => '|',
|
|
223
|
+
|
|
224
|
+
label_reference: _ => /:[a-zA-Z_.][a-zA-Z0-9_.]*/,
|
|
225
|
+
|
|
226
|
+
// ââ Strings ââ
|
|
227
|
+
|
|
228
|
+
string: $ => seq(
|
|
229
|
+
'"',
|
|
230
|
+
repeat(choice(
|
|
231
|
+
$.string_content,
|
|
232
|
+
$._interpolation,
|
|
233
|
+
)),
|
|
234
|
+
'"',
|
|
235
|
+
),
|
|
236
|
+
|
|
237
|
+
raw_string: $ => seq(
|
|
238
|
+
"'",
|
|
239
|
+
repeat(choice(
|
|
240
|
+
$.raw_string_content,
|
|
241
|
+
$._interpolation,
|
|
242
|
+
)),
|
|
243
|
+
"'",
|
|
244
|
+
),
|
|
245
|
+
|
|
246
|
+
backtick_string: $ => seq(
|
|
247
|
+
'`',
|
|
248
|
+
repeat(choice(
|
|
249
|
+
$.backtick_string_content,
|
|
250
|
+
$._interpolation,
|
|
251
|
+
)),
|
|
252
|
+
'`',
|
|
253
|
+
),
|
|
254
|
+
|
|
255
|
+
_interpolation: $ => choice(
|
|
256
|
+
$.variable,
|
|
257
|
+
$.define_reference,
|
|
258
|
+
$.lang_string_reference,
|
|
259
|
+
$.escape_sequence,
|
|
260
|
+
),
|
|
261
|
+
|
|
262
|
+
string_content: _ => prec(-1, /[^"\n$]+/),
|
|
263
|
+
raw_string_content: _ => prec(-1, /[^'\n$]+/),
|
|
264
|
+
backtick_string_content: _ => prec(-1, /[^`\n$]+/),
|
|
265
|
+
|
|
266
|
+
escape_sequence: _ => token(choice(
|
|
267
|
+
/\$\\./,
|
|
268
|
+
'$$',
|
|
269
|
+
)),
|
|
270
|
+
|
|
271
|
+
// ââ Variables & References ââ
|
|
272
|
+
|
|
273
|
+
variable: _ => /\$([a-zA-Z_]\w*|[0-9])/,
|
|
274
|
+
|
|
275
|
+
define_reference: _ => /\$\{[\!\w\.:\^-]+\}/,
|
|
276
|
+
|
|
277
|
+
lang_string_reference: _ => /\$\([\!\w\.:\^-]+\)/,
|
|
278
|
+
|
|
279
|
+
// ââ Literals ââ
|
|
280
|
+
|
|
281
|
+
number: _ => /[+-]?[0-9]+(\.[0-9]+)?|0[xX][0-9a-fA-F]+/,
|
|
282
|
+
|
|
283
|
+
flag: _ => /\/[a-zA-Z_]\w*(=[^\s]*)?/,
|
|
284
|
+
|
|
285
|
+
comparison_operator: _ => choice('=', '!=', '<>', '<', '>'),
|
|
286
|
+
|
|
287
|
+
identifier: _ => /[a-zA-Z_.][a-zA-Z0-9_.]*/,
|
|
288
|
+
|
|
289
|
+
// ââ Comments & Whitespace ââ
|
|
290
|
+
|
|
291
|
+
comment: _ => token(seq(/[;#]/, /[^\n]*/)),
|
|
292
|
+
|
|
293
|
+
block_comment: _ => token(seq(
|
|
294
|
+
'/*',
|
|
295
|
+
/[^*]*\*+([^/*][^*]*\*+)*/,
|
|
296
|
+
'/',
|
|
297
|
+
)),
|
|
298
|
+
|
|
299
|
+
line_continuation: _ => token(seq('\\', /\r?\n/)),
|
|
300
|
+
},
|
|
301
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-sitter-nsis",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "NSIS grammar for tree-sitter",
|
|
5
|
+
"repository": "https://github.com/idleberg/tree-sitter-nsis",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Jan T. Sott",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"nsis",
|
|
10
|
+
"tree-sitter",
|
|
11
|
+
"parser"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"grammar.js",
|
|
15
|
+
"queries/*",
|
|
16
|
+
"src/**",
|
|
17
|
+
"*.wasm"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"generate": "tree-sitter generate",
|
|
21
|
+
"test": "tree-sitter test",
|
|
22
|
+
"parse": "tree-sitter parse"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@commitlint/cli": "^21.0.1",
|
|
26
|
+
"@commitlint/config-conventional": "^21.0.1",
|
|
27
|
+
"@idleberg/configs": "^0.4.2",
|
|
28
|
+
"tree-sitter-cli": "^0.25.0"
|
|
29
|
+
},
|
|
30
|
+
"tree-sitter": [
|
|
31
|
+
{
|
|
32
|
+
"scope": "source.nsis",
|
|
33
|
+
"file-types": [
|
|
34
|
+
"nsi",
|
|
35
|
+
"nsh"
|
|
36
|
+
],
|
|
37
|
+
"highlights": "queries/highlights.scm",
|
|
38
|
+
"folds": "queries/folds.scm",
|
|
39
|
+
"indents": "queries/indents.scm"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"packageManager": "pnpm@11.1.2"
|
|
43
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
; ââ Block Keywords ââ
|
|
2
|
+
|
|
3
|
+
(function_definition "Function" @keyword.function)
|
|
4
|
+
(function_definition "FunctionEnd" @keyword.function)
|
|
5
|
+
|
|
6
|
+
(section_definition "Section" @keyword)
|
|
7
|
+
(section_definition "SectionEnd" @keyword)
|
|
8
|
+
|
|
9
|
+
(section_group "SectionGroup" @keyword)
|
|
10
|
+
(section_group "SectionGroupEnd" @keyword)
|
|
11
|
+
|
|
12
|
+
(page_ex_block "PageEx" @keyword)
|
|
13
|
+
(page_ex_block "PageExEnd" @keyword)
|
|
14
|
+
|
|
15
|
+
(macro_definition "!macro" @keyword.directive)
|
|
16
|
+
(macro_definition "!macroend" @keyword.directive)
|
|
17
|
+
|
|
18
|
+
; ââ Block Names ââ
|
|
19
|
+
|
|
20
|
+
(function_definition
|
|
21
|
+
name: (_) @function)
|
|
22
|
+
|
|
23
|
+
(section_definition
|
|
24
|
+
parameter: (_) @string.special)
|
|
25
|
+
|
|
26
|
+
(macro_definition
|
|
27
|
+
name: (identifier) @function.macro)
|
|
28
|
+
|
|
29
|
+
(macro_definition
|
|
30
|
+
parameter: (identifier) @variable.parameter)
|
|
31
|
+
|
|
32
|
+
; ââ Preprocessor ââ
|
|
33
|
+
|
|
34
|
+
(preproc_conditional
|
|
35
|
+
keyword: (preproc_keyword) @keyword.directive)
|
|
36
|
+
|
|
37
|
+
(preproc_conditional "!endif" @keyword.directive)
|
|
38
|
+
|
|
39
|
+
(preproc_else "!else" @keyword.directive)
|
|
40
|
+
|
|
41
|
+
(preproc_directive
|
|
42
|
+
directive: (preproc_keyword) @keyword.directive)
|
|
43
|
+
|
|
44
|
+
; ââ Variable Declaration ââ
|
|
45
|
+
|
|
46
|
+
(variable_declaration "Var" @keyword)
|
|
47
|
+
(variable_declaration
|
|
48
|
+
name: (identifier) @variable)
|
|
49
|
+
|
|
50
|
+
; ââ Plugin Calls ââ
|
|
51
|
+
|
|
52
|
+
(plugin_call
|
|
53
|
+
plugin: (identifier) @module)
|
|
54
|
+
(plugin_call
|
|
55
|
+
"::" @punctuation.delimiter)
|
|
56
|
+
(plugin_call
|
|
57
|
+
function: (identifier) @function.method)
|
|
58
|
+
|
|
59
|
+
; ââ Labels ââ
|
|
60
|
+
|
|
61
|
+
(label
|
|
62
|
+
name: (identifier) @label)
|
|
63
|
+
|
|
64
|
+
(label_reference) @label
|
|
65
|
+
|
|
66
|
+
; ââ Constants ââ
|
|
67
|
+
|
|
68
|
+
(identifier) @constant
|
|
69
|
+
(#match? @constant "^(?i)(ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR|HKCR32|HKCR64|HKCU|HKCU32|HKCU64|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKLM32|HKLM64|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)$")
|
|
70
|
+
|
|
71
|
+
; ââ Booleans ââ
|
|
72
|
+
|
|
73
|
+
(identifier) @boolean
|
|
74
|
+
(#match? @boolean "^(?i)(true|on|false|off)$")
|
|
75
|
+
|
|
76
|
+
; ââ Commands ââ
|
|
77
|
+
|
|
78
|
+
(command
|
|
79
|
+
name: (identifier) @keyword
|
|
80
|
+
(#match? @keyword "^(?i)(Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CPU|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetRegView|GetShellVarContext|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfAltRegView|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestAppendCustomString|ManifestDisableWindowFiltering|ManifestDPIAware|ManifestGdiScaling|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadMemory|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressionLevel|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|UnsafeStrCpy|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)$"))
|
|
81
|
+
|
|
82
|
+
; ââ Deprecated Commands ââ
|
|
83
|
+
|
|
84
|
+
(command
|
|
85
|
+
name: (identifier) @keyword.deprecated
|
|
86
|
+
(#match? @keyword.deprecated "^(?i)(CompareDLLVersions|CompareFileTimes|DirShow|DisabledBitmap|EnabledBitmap|GetFullDLLPath|GetParent|GetWinampInstPath|LangStringUP|PackEXEHeader|SectionDivider|SetPluginUnload|SubSection|SubSectionEnd|UninstallExeName)$"))
|
|
87
|
+
|
|
88
|
+
; ââ Variables & References ââ
|
|
89
|
+
|
|
90
|
+
(variable) @variable
|
|
91
|
+
(define_reference) @constant.macro
|
|
92
|
+
(lang_string_reference) @string.special
|
|
93
|
+
|
|
94
|
+
; ââ Built-in Variables ââ
|
|
95
|
+
|
|
96
|
+
(variable) @variable.builtin
|
|
97
|
+
(#match? @variable.builtin "^\\$(?i)(ADMINTOOLS|APPDATA|CDBURN_AREA|CMDLINE|COMMONFILES|COOKIES|DESKTOP|DOCUMENTS|EXEDIR|EXEFILE|EXEPATH|FAVORITES|FONTS|HISTORY|HWNDPARENT|INSTDIR|INTERNET_CACHE|LANGUAGE|LOCALAPPDATA|MUSIC|NETHOOD|NSIS_MAX_STRLEN|NSIS_VERSION|NSISDIR|OUTDIR|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES|PROGRAMFILES32|PROGRAMFILES64|QUICKLAUNCH|RECENT|RESOURCES|RESOURCES_LOCALIZED|SENDTO|SMPROGRAMS|SMSTARTUP|STARTMENU|SYSDIR|TEMP|TEMPLATES|VIDEOS|WINDIR)$")
|
|
98
|
+
|
|
99
|
+
; ââ Strings ââ
|
|
100
|
+
|
|
101
|
+
(string) @string
|
|
102
|
+
(raw_string) @string
|
|
103
|
+
(backtick_string) @string
|
|
104
|
+
(escape_sequence) @string.escape
|
|
105
|
+
|
|
106
|
+
; ââ Numbers ââ
|
|
107
|
+
|
|
108
|
+
(number) @number
|
|
109
|
+
|
|
110
|
+
; ââ Flags ââ
|
|
111
|
+
|
|
112
|
+
(flag) @attribute
|
|
113
|
+
|
|
114
|
+
; ââ Operators ââ
|
|
115
|
+
|
|
116
|
+
(comparison_operator) @operator
|
|
117
|
+
(pipe_operator) @operator
|
|
118
|
+
|
|
119
|
+
; ââ Comments ââ
|
|
120
|
+
|
|
121
|
+
(comment) @comment.line
|
|
122
|
+
(block_comment) @comment.block
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
(function_definition) @indent
|
|
2
|
+
(function_definition "FunctionEnd" @outdent)
|
|
3
|
+
|
|
4
|
+
(section_definition) @indent
|
|
5
|
+
(section_definition "SectionEnd" @outdent)
|
|
6
|
+
|
|
7
|
+
(section_group) @indent
|
|
8
|
+
(section_group "SectionGroupEnd" @outdent)
|
|
9
|
+
|
|
10
|
+
(page_ex_block) @indent
|
|
11
|
+
(page_ex_block "PageExEnd" @outdent)
|
|
12
|
+
|
|
13
|
+
(macro_definition) @indent
|
|
14
|
+
(macro_definition "!macroend" @outdent)
|
|
15
|
+
|
|
16
|
+
(preproc_conditional) @indent
|
|
17
|
+
(preproc_conditional "!endif" @outdent)
|