@willbooster/tree-sitter-zig 1.0.0 → 1.0.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/README.md +6 -3
- package/grammar.js +4 -4
- package/package.json +1 -1
- package/src/node-types.json +4 -4
- package/tree-sitter-zig.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -12,10 +12,10 @@ Zig grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forke
|
|
|
12
12
|
[tree-sitter-grammars/tree-sitter-zig](https://github.com/tree-sitter-grammars/tree-sitter-zig). We are grateful
|
|
13
13
|
to its authors and contributors. This is not an official release of that project.
|
|
14
14
|
|
|
15
|
-
This fork
|
|
15
|
+
This fork builds on the grammar of upstream's version 1.1.2 and generates the parser with the
|
|
16
16
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI
|
|
17
17
|
number (`0x57420001`) and loads only with that fork's runtime, version 2.0.0 or later: upstream's tree-sitter runtime
|
|
18
|
-
rejects it. It parses as the parser in upstream's 1.1.2 packages does, with
|
|
18
|
+
rejects it. It parses as the parser in upstream's 1.1.2 packages does, with these exceptions:
|
|
19
19
|
|
|
20
20
|
- In the ranges a `for` loop iterates over, a range end whose first token can both start an expression and continue
|
|
21
21
|
the one before `..`, for example `(`, `[`, `.`, `*`, `&`, `-`, or `!` (as in `for (0..(n)) |i| {}` or
|
|
@@ -27,6 +27,9 @@ rejects it. It parses as the parser in upstream's 1.1.2 packages does, with two
|
|
|
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
|
+
- Empty `struct`, `opaque`, `enum`, and `union` declarations have no fields, instead of synthesized zero-width
|
|
31
|
+
`container_field` and `identifier` nodes.
|
|
32
|
+
|
|
30
33
|
## Usage
|
|
31
34
|
|
|
32
35
|
The npm package ships `tree-sitter-zig.wasm` for
|
|
@@ -106,7 +109,7 @@ well (e.g. `script/tree-sitter parse file.zig`).
|
|
|
106
109
|
`bun run generate` records a fresh generation profile from the applicable `test/corpus` cases, then generates
|
|
107
110
|
compact parser tables. It would also profile files tracked in `examples/`, but this repository tracks none: upstream
|
|
108
111
|
ships neither examples nor a corpus, so the cases in `test/corpus` were written for this fork, with the trees upstream's
|
|
109
|
-
packaged parser gives them, except the NUL
|
|
112
|
+
packaged parser gives them, except the NUL, `for` range, and empty-container cases, which pin this parser's reading. The parser also embeds metadata from `tree-sitter.json`.
|
|
110
113
|
After changing a grammar, `tree-sitter.json`, or a corpus case, regenerate and commit `src/`.
|
|
111
114
|
Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`, `bun run build/ci`,
|
|
112
115
|
and the release build regenerate the parsers before compiling them.
|
package/grammar.js
CHANGED
|
@@ -243,7 +243,7 @@ module.exports = grammar({
|
|
|
243
243
|
'struct',
|
|
244
244
|
optional(seq('(', $.expression, ')')),
|
|
245
245
|
'{',
|
|
246
|
-
$._container_members,
|
|
246
|
+
optional($._container_members),
|
|
247
247
|
'}',
|
|
248
248
|
),
|
|
249
249
|
|
|
@@ -251,7 +251,7 @@ module.exports = grammar({
|
|
|
251
251
|
optional(choice('extern', 'packed')),
|
|
252
252
|
'opaque',
|
|
253
253
|
'{',
|
|
254
|
-
$._container_members,
|
|
254
|
+
optional($._container_members),
|
|
255
255
|
'}',
|
|
256
256
|
),
|
|
257
257
|
|
|
@@ -260,7 +260,7 @@ module.exports = grammar({
|
|
|
260
260
|
'enum',
|
|
261
261
|
optional(seq('(', $.expression, ')')),
|
|
262
262
|
'{',
|
|
263
|
-
$._container_members,
|
|
263
|
+
optional($._container_members),
|
|
264
264
|
'}',
|
|
265
265
|
),
|
|
266
266
|
|
|
@@ -276,7 +276,7 @@ module.exports = grammar({
|
|
|
276
276
|
')',
|
|
277
277
|
)),
|
|
278
278
|
'{',
|
|
279
|
-
$._container_members,
|
|
279
|
+
optional($._container_members),
|
|
280
280
|
'}',
|
|
281
281
|
),
|
|
282
282
|
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -1217,7 +1217,7 @@
|
|
|
1217
1217
|
"fields": {},
|
|
1218
1218
|
"children": {
|
|
1219
1219
|
"multiple": true,
|
|
1220
|
-
"required":
|
|
1220
|
+
"required": false,
|
|
1221
1221
|
"types": [
|
|
1222
1222
|
{
|
|
1223
1223
|
"type": "comptime_declaration",
|
|
@@ -1910,7 +1910,7 @@
|
|
|
1910
1910
|
"fields": {},
|
|
1911
1911
|
"children": {
|
|
1912
1912
|
"multiple": true,
|
|
1913
|
-
"required":
|
|
1913
|
+
"required": false,
|
|
1914
1914
|
"types": [
|
|
1915
1915
|
{
|
|
1916
1916
|
"type": "comptime_declaration",
|
|
@@ -2188,7 +2188,7 @@
|
|
|
2188
2188
|
"fields": {},
|
|
2189
2189
|
"children": {
|
|
2190
2190
|
"multiple": true,
|
|
2191
|
-
"required":
|
|
2191
|
+
"required": false,
|
|
2192
2192
|
"types": [
|
|
2193
2193
|
{
|
|
2194
2194
|
"type": "comptime_declaration",
|
|
@@ -2391,7 +2391,7 @@
|
|
|
2391
2391
|
"fields": {},
|
|
2392
2392
|
"children": {
|
|
2393
2393
|
"multiple": true,
|
|
2394
|
-
"required":
|
|
2394
|
+
"required": false,
|
|
2395
2395
|
"types": [
|
|
2396
2396
|
{
|
|
2397
2397
|
"type": "comptime_declaration",
|
package/tree-sitter-zig.wasm
CHANGED
|
Binary file
|