@willbooster/tree-sitter-zig 1.0.1 → 1.0.2
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 +3 -0
- package/grammar.js +9 -2
- package/package.json +3 -3
- package/src/node-types.json +8 -0
- package/tree-sitter-zig.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,9 @@ rejects it. It parses as the parser in upstream's 1.1.2 packages does, with thes
|
|
|
27
27
|
- A NUL character inside a token such as a string or a comment is part of that token, where upstream's lexer reports
|
|
28
28
|
an error.
|
|
29
29
|
|
|
30
|
+
- Boolean negation is a `unary_expression`. Inferred error unions (`!T`) occur only in function return types;
|
|
31
|
+
their payload includes suffixes such as calls and field access (`!List(T)` or `!ns.Result`). Explicit error
|
|
32
|
+
unions (`E!T`) retain their error and payload types.
|
|
30
33
|
- Empty `struct`, `opaque`, `enum`, and `union` declarations have no fields, instead of synthesized zero-width
|
|
31
34
|
`container_field` and `identifier` nodes.
|
|
32
35
|
|
package/grammar.js
CHANGED
|
@@ -208,9 +208,16 @@ module.exports = grammar({
|
|
|
208
208
|
optional($.address_space),
|
|
209
209
|
optional($.link_section),
|
|
210
210
|
optional($.calling_convention),
|
|
211
|
-
field('type', choice(
|
|
211
|
+
field('type', choice(
|
|
212
|
+
$.type_expression,
|
|
213
|
+
$.if_type_expression,
|
|
214
|
+
$.comptime_type_expression,
|
|
215
|
+
alias($._inferred_error_union_type, $.error_union_type),
|
|
216
|
+
)),
|
|
212
217
|
),
|
|
213
218
|
|
|
219
|
+
_inferred_error_union_type: $ => prec.right(-1, seq('!', field('ok', $.type_expression))),
|
|
220
|
+
|
|
214
221
|
parameters: $ => seq('(', optionalCommaSep($.parameter), ')'),
|
|
215
222
|
|
|
216
223
|
parameter: $ => choice(
|
|
@@ -698,7 +705,7 @@ module.exports = grammar({
|
|
|
698
705
|
)),
|
|
699
706
|
|
|
700
707
|
error_union_type: $ => prec.right(2, seq(
|
|
701
|
-
|
|
708
|
+
field('error', $.type_expression),
|
|
702
709
|
'!',
|
|
703
710
|
field('ok', $.type_expression),
|
|
704
711
|
)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-zig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Zig grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@willbooster/web-tree-sitter": "2.0.1",
|
|
51
51
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
52
52
|
"lefthook": "2.1.16",
|
|
53
|
-
"oxfmt": "0.
|
|
54
|
-
"oxlint": "1.
|
|
53
|
+
"oxfmt": "0.72.0",
|
|
54
|
+
"oxlint": "1.87.0",
|
|
55
55
|
"oxlint-tsgolint": "7.0.2003",
|
|
56
56
|
"playwright": "1.63.0",
|
|
57
57
|
"semantic-release": "25.0.9",
|
package/src/node-types.json
CHANGED
|
@@ -1486,6 +1486,10 @@
|
|
|
1486
1486
|
"type": "comptime_type_expression",
|
|
1487
1487
|
"named": true
|
|
1488
1488
|
},
|
|
1489
|
+
{
|
|
1490
|
+
"type": "error_union_type",
|
|
1491
|
+
"named": true
|
|
1492
|
+
},
|
|
1489
1493
|
{
|
|
1490
1494
|
"type": "if_type_expression",
|
|
1491
1495
|
"named": true
|
|
@@ -1550,6 +1554,10 @@
|
|
|
1550
1554
|
"type": "comptime_type_expression",
|
|
1551
1555
|
"named": true
|
|
1552
1556
|
},
|
|
1557
|
+
{
|
|
1558
|
+
"type": "error_union_type",
|
|
1559
|
+
"named": true
|
|
1560
|
+
},
|
|
1553
1561
|
{
|
|
1554
1562
|
"type": "if_type_expression",
|
|
1555
1563
|
"named": true
|
package/tree-sitter-zig.wasm
CHANGED
|
Binary file
|