@sshadows/tree-sitter-al 3.2.1 → 3.3.1
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/grammar.js +27 -0
- package/package.json +1 -1
- package/queries/highlights.scm +2 -0
- package/src/grammar.json +16 -0
- package/src/node-types.json +10 -0
- package/src/parser.c +77248 -56270
- package/src/scanner.c +179 -137
- package/tree-sitter-al.wasm +0 -0
package/grammar.js
CHANGED
|
@@ -88,6 +88,8 @@ module.exports = grammar({
|
|
|
88
88
|
$.pragma,
|
|
89
89
|
$.preproc_region,
|
|
90
90
|
$.preproc_endregion,
|
|
91
|
+
$.preproc_define,
|
|
92
|
+
$.preproc_undef,
|
|
91
93
|
/\uFEFF/, // BOM
|
|
92
94
|
],
|
|
93
95
|
|
|
@@ -3221,6 +3223,31 @@ module.exports = grammar({
|
|
|
3221
3223
|
|
|
3222
3224
|
preproc_endregion: $ => new RustRegex('(?i)#[ \\t]*endregion[^\\n\\r]*'),
|
|
3223
3225
|
|
|
3226
|
+
// Symbol definition directives. Line-level like #pragma/#region: they take a
|
|
3227
|
+
// single symbol name, never open or close a conditional, and so must NOT
|
|
3228
|
+
// touch the scanner's #if/#endif depth counter.
|
|
3229
|
+
//
|
|
3230
|
+
// Positionally the AL compiler is far stricter than this rule — verified
|
|
3231
|
+
// against alc 18.0.37 (full accept/reject matrix in
|
|
3232
|
+
// docs/preproc-define-undef.md):
|
|
3233
|
+
// * accepted ONLY before the first real token of the file — comments,
|
|
3234
|
+
// #pragma, #region/#endregion and whole #if/#else/#endif blocks may
|
|
3235
|
+
// precede or wrap them, but a `namespace`, `using` or object
|
|
3236
|
+
// declaration ends the window (error AL0625, "Cannot define/undefine
|
|
3237
|
+
// preprocessor symbols after first token in file")
|
|
3238
|
+
// * the symbol must be a bare identifier — letters, digits, underscores
|
|
3239
|
+
// (error AL0107 on a missing or quoted name)
|
|
3240
|
+
// * only a trailing `//` comment may follow the symbol (error AL0631)
|
|
3241
|
+
// * `#` and the directive must share a line (error AL0621)
|
|
3242
|
+
// Per "parse structure, don't validate", those are semantic checks for a
|
|
3243
|
+
// linter, so these stay `extras` alongside the other line-level directives.
|
|
3244
|
+
// That also buys reachability for free: file-leading position, inside a
|
|
3245
|
+
// leading pragma-only #if block, and after leading comments/pragmas are all
|
|
3246
|
+
// the same rule with no new parser states and no GLR conflicts.
|
|
3247
|
+
preproc_define: $ => new RustRegex('(?i)#[ \\t]*define[^\\n\\r]*'),
|
|
3248
|
+
|
|
3249
|
+
preproc_undef: $ => new RustRegex('(?i)#[ \\t]*undef[^\\n\\r]*'),
|
|
3250
|
+
|
|
3224
3251
|
// =====================================================================
|
|
3225
3252
|
// Statements
|
|
3226
3253
|
// =====================================================================
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
package/src/grammar.json
CHANGED
|
@@ -15559,6 +15559,14 @@
|
|
|
15559
15559
|
"type": "PATTERN",
|
|
15560
15560
|
"value": "(?i)#[ \\t]*endregion[^\\n\\r]*"
|
|
15561
15561
|
},
|
|
15562
|
+
"preproc_define": {
|
|
15563
|
+
"type": "PATTERN",
|
|
15564
|
+
"value": "(?i)#[ \\t]*define[^\\n\\r]*"
|
|
15565
|
+
},
|
|
15566
|
+
"preproc_undef": {
|
|
15567
|
+
"type": "PATTERN",
|
|
15568
|
+
"value": "(?i)#[ \\t]*undef[^\\n\\r]*"
|
|
15569
|
+
},
|
|
15562
15570
|
"_statement": {
|
|
15563
15571
|
"type": "PREC_RIGHT",
|
|
15564
15572
|
"value": 0,
|
|
@@ -19606,6 +19614,14 @@
|
|
|
19606
19614
|
"type": "SYMBOL",
|
|
19607
19615
|
"name": "preproc_endregion"
|
|
19608
19616
|
},
|
|
19617
|
+
{
|
|
19618
|
+
"type": "SYMBOL",
|
|
19619
|
+
"name": "preproc_define"
|
|
19620
|
+
},
|
|
19621
|
+
{
|
|
19622
|
+
"type": "SYMBOL",
|
|
19623
|
+
"name": "preproc_undef"
|
|
19624
|
+
},
|
|
19609
19625
|
{
|
|
19610
19626
|
"type": "PATTERN",
|
|
19611
19627
|
"value": "\\uFEFF"
|
package/src/node-types.json
CHANGED
|
@@ -25271,6 +25271,11 @@
|
|
|
25271
25271
|
"type": "preproc_close",
|
|
25272
25272
|
"named": true
|
|
25273
25273
|
},
|
|
25274
|
+
{
|
|
25275
|
+
"type": "preproc_define",
|
|
25276
|
+
"named": true,
|
|
25277
|
+
"extra": true
|
|
25278
|
+
},
|
|
25274
25279
|
{
|
|
25275
25280
|
"type": "preproc_endregion",
|
|
25276
25281
|
"named": true,
|
|
@@ -25293,6 +25298,11 @@
|
|
|
25293
25298
|
"type": "preproc_split_end",
|
|
25294
25299
|
"named": true
|
|
25295
25300
|
},
|
|
25301
|
+
{
|
|
25302
|
+
"type": "preproc_undef",
|
|
25303
|
+
"named": true,
|
|
25304
|
+
"extra": true
|
|
25305
|
+
},
|
|
25296
25306
|
{
|
|
25297
25307
|
"type": "procedure_keyword",
|
|
25298
25308
|
"named": true
|