@willbooster/tree-sitter-rust 13.0.0 → 14.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-rust/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-rust/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-20.43.2-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.48.9-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-rust.svg)](https://crates.io/crates/willbooster-tree-sitter-rust)
10
10
 
11
11
  Rust grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -18,13 +18,14 @@ This fork fixes parsing bugs and raises conformance with [The Rust Reference](ht
18
18
 
19
19
  The npm package ships `tree-sitter-rust.wasm` for
20
20
  [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
21
- browsers, and Cloudflare Workers. The parser requires version 13.0.0 or later within major version 13 of that runtime.
21
+ browsers, and Cloudflare Workers. The parser requires version 15.0.0 or later within major version 15 of that runtime.
22
22
  It carries the WillBooster ABI number, which upstream's `web-tree-sitter` rejects.
23
23
 
24
24
  In Node.js and Bun, load the grammar from its path:
25
25
 
26
26
  ```js
27
27
  import { fileURLToPath } from 'node:url';
28
+
28
29
  import { Language, Parser } from '@willbooster/web-tree-sitter';
29
30
 
30
31
  await Parser.init();
@@ -37,9 +38,9 @@ const tree = parser.parse('fn main() {}\n');
37
38
  In browsers, load the grammar from its URL. With Vite:
38
39
 
39
40
  ```js
41
+ import rustUrl from '@willbooster/tree-sitter-rust/tree-sitter-rust.wasm?url';
40
42
  import { Language, Parser } from '@willbooster/web-tree-sitter';
41
43
  import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
42
- import rustUrl from '@willbooster/tree-sitter-rust/tree-sitter-rust.wasm?url';
43
44
 
44
45
  await Parser.init({ locateFile: () => runtimeUrl });
45
46
  const parser = new Parser();
@@ -49,9 +50,9 @@ parser.setLanguage(await Language.load(rustUrl));
49
50
  In Cloudflare Workers, which do not allow compiling Wasm at run time, import both `.wasm` files as modules:
50
51
 
51
52
  ```js
53
+ import rust from '@willbooster/tree-sitter-rust/tree-sitter-rust.wasm';
52
54
  import { Language, Parser } from '@willbooster/web-tree-sitter';
53
55
  import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
54
- import rust from '@willbooster/tree-sitter-rust/tree-sitter-rust.wasm';
55
56
 
56
57
  await Parser.init({ wasmModule: runtime });
57
58
  const parser = new Parser();
@@ -68,11 +69,11 @@ documentation or line documentation for fenced examples with these queries.
68
69
 
69
70
  In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-rust) and on
70
71
  [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
71
- fuzzed with. The parser requires version 13.0.0 or later within major version 13 of that runtime; upstream's
72
+ fuzzed with. The parser requires version 15.0.0 or later within major version 15 of that runtime; upstream's
72
73
  `tree-sitter` crate rejects it:
73
74
 
74
75
  ```sh
75
- cargo add willbooster-tree-sitter@13.0.0 --rename tree-sitter
76
+ cargo add willbooster-tree-sitter@15.0.0 --rename tree-sitter
76
77
  cargo add willbooster-tree-sitter-rust --rename tree-sitter-rust
77
78
  ```
78
79
 
package/grammar.js CHANGED
@@ -154,6 +154,7 @@ module.exports = grammar({
154
154
  sym('_orphan_line_doc_comment_start'),
155
155
  sym('_orphan_block_doc_comment_start'),
156
156
  sym('_orphan_doc_missing_owner'),
157
+ sym('_trailing_type_bound_plus'),
157
158
  ],
158
159
 
159
160
  supertypes: ($) => [
@@ -193,6 +194,7 @@ module.exports = grammar({
193
194
  // Local ambiguity due to anonymous types:
194
195
  // See https://internals.rust-lang.org/t/pre-rfc-deprecating-anonymous-parameters/3710
195
196
  [$._type, $._pattern],
197
+ [$._type, $._trailing_bounded_type],
196
198
  [$.unit_type, $.tuple_pattern],
197
199
  [$.scoped_identifier, $.scoped_type_identifier],
198
200
  [$.parameters, $.tuple_struct_pattern],
@@ -660,6 +662,7 @@ module.exports = grammar({
660
662
  $.function_type,
661
663
  $.dynamic_type,
662
664
  $.bounded_type,
665
+ alias($._trailing_bounded_type, $.bounded_type),
663
666
  $.macro_invocation,
664
667
  $.never_type,
665
668
  $.array_type,
@@ -860,6 +863,7 @@ module.exports = grammar({
860
863
  $.never_type,
861
864
  $.dynamic_type,
862
865
  $.bounded_type,
866
+ alias($._trailing_bounded_type, $.bounded_type),
863
867
  $.removed_trait_bound,
864
868
  $.modified_trait_bound,
865
869
  alias(choice(...primitiveTypes), sym('primitive_type'))
@@ -962,6 +966,13 @@ module.exports = grammar({
962
966
  )
963
967
  ),
964
968
 
969
+ _trailing_bounded_type: ($) =>
970
+ seq(
971
+ choice($.dynamic_type, $.abstract_type),
972
+ repeat(seq('+', choice($.lifetime, $._type, $.use_bounds, prec.dynamic(-2, $.higher_ranked_trait_bound)))),
973
+ alias(sym('_trailing_type_bound_plus'), '+')
974
+ ),
975
+
965
976
  use_bounds: ($) =>
966
977
  seq('use', token(prec(1, '<')), sepBy(',', choice($.lifetime, $._type_identifier)), optional(','), '>'),
967
978
 
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "13.0.0",
3
+ "version": "14.0.0",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
7
7
  "parsing",
8
- "tree-sitter",
9
- "rust"
8
+ "rust",
9
+ "tree-sitter"
10
10
  ],
11
+ "license": "MIT",
12
+ "author": "WillBooster Inc.",
11
13
  "repository": {
12
14
  "type": "git",
13
15
  "url": "git+https://github.com/WillBooster/tree-sitter-rust.git"
14
16
  },
15
- "license": "MIT",
16
- "author": "WillBooster Inc.",
17
17
  "files": [
18
18
  "grammar.js",
19
19
  "queries/*.scm",
@@ -21,6 +21,10 @@
21
21
  "src/node-types.json",
22
22
  "*.wasm"
23
23
  ],
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org/"
27
+ },
24
28
  "scripts": {
25
29
  "build-wasm": "script/generate --build-wasm",
26
30
  "build/ci": "bun run build-wasm",
@@ -43,33 +47,26 @@
43
47
  "devDependencies": {
44
48
  "@tsconfig/bun": "1.0.11",
45
49
  "@types/bun": "1.4.3",
46
- "@vitest/browser-playwright": "5.0.3",
47
- "@willbooster/oxfmt-config": "1.2.2",
48
- "@willbooster/oxlint-config": "1.4.8",
49
- "@willbooster/wb": "22.26.2",
50
- "@willbooster/web-tree-sitter": "13.0.0",
50
+ "@vitest/browser-playwright": "5.0.5",
51
+ "@willbooster/oxlint-config": "1.4.9",
52
+ "@willbooster/wb": "22.29.3",
53
+ "@willbooster/web-tree-sitter": "15.0.0",
51
54
  "conventional-changelog-conventionalcommits": "10.4.1",
52
55
  "lefthook": "2.2.2",
53
- "oxfmt": "0.73.0",
54
56
  "oxlint": "1.88.0",
55
57
  "oxlint-tsgolint": "7.0.2004",
56
- "playwright": "1.64.0",
58
+ "playwright": "1.64.1",
57
59
  "semantic-release": "25.0.9",
58
- "sort-package-json": "4.0.0",
59
60
  "vite": "8.3.4",
60
- "vitest": "5.0.3",
61
- "wrangler": "4.149.0"
61
+ "vitest": "5.0.5",
62
+ "wrangler": "4.151.1"
62
63
  },
63
64
  "peerDependencies": {
64
- "@willbooster/web-tree-sitter": "^13.0.0"
65
+ "@willbooster/web-tree-sitter": "^15.0.0"
65
66
  },
66
67
  "peerDependenciesMeta": {
67
68
  "@willbooster/web-tree-sitter": {
68
69
  "optional": true
69
70
  }
70
- },
71
- "publishConfig": {
72
- "access": "public",
73
- "registry": "https://registry.npmjs.org/"
74
71
  }
75
72
  }
Binary file
package/tree-sitter.json CHANGED
@@ -25,7 +25,7 @@
25
25
  }
26
26
  ],
27
27
  "metadata": {
28
- "version": "13.0.0",
28
+ "version": "14.0.0",
29
29
  "license": "MIT",
30
30
  "description": "Rust grammar for tree-sitter",
31
31
  "authors": [