@willbooster/tree-sitter-zig 16.0.1 → 17.0.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/README.md +4 -6
- package/grammar.js +8 -7
- package/package.json +1 -1
- package/src/node-types.json +12 -4
- package/tree-sitter-zig.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -18,12 +18,10 @@ which upstream's tree-sitter runtimes reject, and is tested and supported with t
|
|
|
18
18
|
version 23.1.0 or later in the 23.x series. It parses as the parser in upstream's 1.1.2 packages does, with these
|
|
19
19
|
exceptions:
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
a field access, a binary expression, and so on. tree-sitter CLI 0.27 generates this fork's reading from the same
|
|
26
|
-
grammar. This generator difference applies only to those `for`-loop range ends.
|
|
21
|
+
- A range outside slice brackets or a `for` operand is a syntax error. A sentinel also requires a range,
|
|
22
|
+
so `a[0:0]` is a syntax error. In `for (0..(n))`, `for (0..&x)`, and `for (0..-n)`, the expression
|
|
23
|
+
after `..` is the right operand of the range. Upstream's packaged parser can use the open range as
|
|
24
|
+
the start of a larger expression in these positions.
|
|
27
25
|
- The names `true`, `false`, `null`, and `undefined` can label blocks in statements and expressions or name parameters.
|
|
28
26
|
- Labeled blocks used as indices or slice bounds retain their `block_label` inside the expression,
|
|
29
27
|
instead of splitting the label colon into an index and a sentinel.
|
package/grammar.js
CHANGED
|
@@ -363,10 +363,7 @@ module.exports = grammar({
|
|
|
363
363
|
_for_prefix: $ => seq(
|
|
364
364
|
'for',
|
|
365
365
|
'(',
|
|
366
|
-
|
|
367
|
-
$.expression,
|
|
368
|
-
optional(seq('..', $.expression)),
|
|
369
|
-
)),
|
|
366
|
+
optionalCommaSep1(choice($.range_expression, $.expression)),
|
|
370
367
|
')',
|
|
371
368
|
$.payload,
|
|
372
369
|
),
|
|
@@ -621,7 +618,6 @@ module.exports = grammar({
|
|
|
621
618
|
$.index_expression,
|
|
622
619
|
$.dereference_expression,
|
|
623
620
|
$.null_coercion_expression,
|
|
624
|
-
$.range_expression,
|
|
625
621
|
$.call_expression,
|
|
626
622
|
prec.right(alias($._function_prototype, $.function_signature)),
|
|
627
623
|
$.identifier,
|
|
@@ -720,8 +716,13 @@ module.exports = grammar({
|
|
|
720
716
|
index_expression: $ => prec(PREC.MEMBER, seq(
|
|
721
717
|
field('object', $.expression),
|
|
722
718
|
'[',
|
|
723
|
-
|
|
724
|
-
|
|
719
|
+
choice(
|
|
720
|
+
field('index', $.expression),
|
|
721
|
+
seq(
|
|
722
|
+
field('index', $.range_expression),
|
|
723
|
+
optional(seq(':', field('sentinel', $.expression))),
|
|
724
|
+
),
|
|
725
|
+
),
|
|
725
726
|
']',
|
|
726
727
|
)),
|
|
727
728
|
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -169,10 +169,6 @@
|
|
|
169
169
|
"type": "pointer_type",
|
|
170
170
|
"named": true
|
|
171
171
|
},
|
|
172
|
-
{
|
|
173
|
-
"type": "range_expression",
|
|
174
|
-
"named": true
|
|
175
|
-
},
|
|
176
172
|
{
|
|
177
173
|
"type": "slice_type",
|
|
178
174
|
"named": true
|
|
@@ -1417,6 +1413,10 @@
|
|
|
1417
1413
|
{
|
|
1418
1414
|
"type": "payload",
|
|
1419
1415
|
"named": true
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
"type": "range_expression",
|
|
1419
|
+
"named": true
|
|
1420
1420
|
}
|
|
1421
1421
|
]
|
|
1422
1422
|
}
|
|
@@ -1459,6 +1459,10 @@
|
|
|
1459
1459
|
{
|
|
1460
1460
|
"type": "payload",
|
|
1461
1461
|
"named": true
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
"type": "range_expression",
|
|
1465
|
+
"named": true
|
|
1462
1466
|
}
|
|
1463
1467
|
]
|
|
1464
1468
|
}
|
|
@@ -1755,6 +1759,10 @@
|
|
|
1755
1759
|
{
|
|
1756
1760
|
"type": "expression",
|
|
1757
1761
|
"named": true
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
"type": "range_expression",
|
|
1765
|
+
"named": true
|
|
1758
1766
|
}
|
|
1759
1767
|
]
|
|
1760
1768
|
},
|
package/tree-sitter-zig.wasm
CHANGED
|
Binary file
|