@willbooster/tree-sitter-zig 14.0.4 → 16.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 CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test-rust.yml)
7
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
- [![wbfy](https://img.shields.io/badge/wbfy-21.15.1-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-22.1.1-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-zig.svg)](https://crates.io/crates/willbooster-tree-sitter-zig)
10
10
 
11
11
  Zig grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -13,9 +13,9 @@ Zig grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forke
13
13
  to its authors and contributors. This is not an official release of that project.
14
14
 
15
15
  This fork builds on the grammar of upstream's version 1.1.2 and generates the parser with the
16
- [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries ABI `0x5742000d`,
16
+ [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries ABI `0x5742000e`,
17
17
  which upstream's tree-sitter runtimes reject, and is tested and supported with the WillBooster/tree-sitter runtime,
18
- version 23.0.0 or later in the 23.x series. It parses as the parser in upstream's 1.1.2 packages does, with these
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
21
  - In the ranges a `for` loop iterates over, a range end whose first token can both start an expression and continue
@@ -24,6 +24,7 @@ exceptions:
24
24
  tree-sitter CLI 0.24, lets that token continue the expression instead, on a range without an end: a call, an index,
25
25
  a field access, a binary expression, and so on. tree-sitter CLI 0.27 generates this fork's reading from the same
26
26
  grammar. This generator difference applies only to those `for`-loop range ends.
27
+ - The names `true`, `false`, `null`, and `undefined` can label blocks in statements and expressions or name parameters.
27
28
  - Labeled blocks used as indices or slice bounds retain their `block_label` inside the expression,
28
29
  instead of splitting the label colon into an index and a sentinel.
29
30
  - A NUL character inside a token such as a string or a comment is part of that token, where upstream's lexer reports
@@ -62,7 +63,7 @@ may change; such changes are released as new major versions.
62
63
  ## Usage
63
64
 
64
65
  The npm package ships `tree-sitter-zig.wasm` for
65
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 23.0.0 or later in the 23.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
66
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 23.1.0 or later in the 23.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
66
67
  In Node.js and Bun, load the grammar from its path:
67
68
 
68
69
  ```js
@@ -110,7 +111,7 @@ In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-
110
111
  fuzzed with:
111
112
 
112
113
  ```sh
113
- cargo add willbooster-tree-sitter@23.0.0 --rename tree-sitter
114
+ cargo add willbooster-tree-sitter@23.1.0 --rename tree-sitter
114
115
  cargo add willbooster-tree-sitter-zig --rename tree-sitter-zig
115
116
  ```
116
117
 
package/grammar.js CHANGED
@@ -58,6 +58,7 @@ module.exports = grammar({
58
58
 
59
59
  conflicts: $ => [
60
60
  [$.block_label, $.primary_type_expression],
61
+ [$.block_label, $.boolean],
61
62
  [$.for_expression],
62
63
  [$.while_expression],
63
64
 
@@ -226,7 +227,7 @@ module.exports = grammar({
226
227
  seq(
227
228
  optional(choice('noalias', 'comptime')),
228
229
  optional(seq(
229
- field('name', choice($.identifier, alias($.builtin_type, $.identifier))),
230
+ field('name', choice($.identifier, alias(choice($.builtin_type, $._reserved_identifier), $.identifier))),
230
231
  alias($._declaration_name_colon, ':'),
231
232
  )),
232
233
  field('type', choice($.type_expression, $.if_type_expression, $.comptime_type_expression)),
@@ -774,7 +775,7 @@ module.exports = grammar({
774
775
  parenthesized_expression: $ => seq('(', $.expression, ')'),
775
776
 
776
777
  block_label: $ => prec.dynamic(1, seq(
777
- choice($.identifier, alias($.builtin_type, $.identifier)),
778
+ choice($.identifier, alias(choice($.builtin_type, $._reserved_identifier), $.identifier)),
778
779
  ':',
779
780
  )),
780
781
  break_label: $ => seq(':', $.identifier),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-zig",
3
- "version": "14.0.4",
3
+ "version": "16.0.0",
4
4
  "description": "Zig grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "parsing",
@@ -44,23 +44,25 @@
44
44
  "verify-full": "bun wb verify --full"
45
45
  },
46
46
  "devDependencies": {
47
+ "@semantic-release/commit-analyzer": "13.0.1",
48
+ "@semantic-release/release-notes-generator": "14.1.1",
47
49
  "@tsconfig/bun": "1.0.12",
48
- "@types/bun": "1.4.4",
49
- "@vitest/browser-playwright": "5.1.0",
50
+ "@types/bun": "1.4.5",
51
+ "@vitest/browser-playwright": "5.1.1",
50
52
  "@willbooster/oxlint-config": "1.4.9",
51
- "@willbooster/wb": "23.6.1",
52
- "@willbooster/web-tree-sitter": "23.0.2",
53
+ "@willbooster/wb": "24.3.1",
54
+ "@willbooster/web-tree-sitter": "23.1.1",
53
55
  "conventional-changelog-conventionalcommits": "10.4.1",
54
56
  "lefthook": "2.2.2",
55
- "oxlint": "1.93.0",
56
- "oxlint-tsgolint": "7.0.2007",
57
+ "oxlint": "1.94.0",
58
+ "oxlint-tsgolint": "7.0.2008",
57
59
  "playwright": "1.65.1",
58
- "semantic-release": "25.0.9",
59
- "vitest": "5.1.0",
60
+ "semantic-release": "26.0.1",
61
+ "vitest": "5.1.1",
60
62
  "wrangler": "4.156.0"
61
63
  },
62
64
  "peerDependencies": {
63
- "@willbooster/web-tree-sitter": "^23.0.0"
65
+ "@willbooster/web-tree-sitter": "^23.1.0"
64
66
  },
65
67
  "peerDependenciesMeta": {
66
68
  "@willbooster/web-tree-sitter": {
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "14.0.4",
16
+ "version": "16.0.0",
17
17
  "license": "MIT",
18
18
  "description": "Zig grammar for tree-sitter",
19
19
  "authors": [