@willbooster/tree-sitter-rust 15.0.0 → 16.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 +4 -4
- package/grammar.js +25 -13
- package/package.json +6 -6
- package/tree-sitter-rust.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-rust/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](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
|
|
@@ -25,7 +25,7 @@ the trees that error recovery produces may change; such changes are released as
|
|
|
25
25
|
|
|
26
26
|
The npm package ships `tree-sitter-rust.wasm` for
|
|
27
27
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
|
|
28
|
-
browsers, and Cloudflare Workers. The parser requires version 15.0.0 or later within major
|
|
28
|
+
browsers, and Cloudflare Workers. The parser requires version 15.0.0 or later within major versions 15 and 16 of that runtime.
|
|
29
29
|
It carries the WillBooster ABI number, which upstream's `web-tree-sitter` rejects.
|
|
30
30
|
|
|
31
31
|
In Node.js and Bun, load the grammar from its path:
|
|
@@ -70,11 +70,11 @@ The package also ships the node types in `src/node-types.json`.
|
|
|
70
70
|
|
|
71
71
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-rust) and on
|
|
72
72
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
73
|
-
fuzzed with. The parser requires version 15.0.0 or later within major
|
|
73
|
+
fuzzed with. The parser requires version 15.0.0 or later within major versions 15 and 16 of that runtime; upstream's
|
|
74
74
|
`tree-sitter` crate rejects it:
|
|
75
75
|
|
|
76
76
|
```sh
|
|
77
|
-
cargo add willbooster-tree-sitter@
|
|
77
|
+
cargo add willbooster-tree-sitter@16.0.0 --rename tree-sitter
|
|
78
78
|
cargo add willbooster-tree-sitter-rust --rename tree-sitter-rust
|
|
79
79
|
```
|
|
80
80
|
|
package/grammar.js
CHANGED
|
@@ -313,7 +313,8 @@ module.exports = grammar({
|
|
|
313
313
|
attributableDeclaration(
|
|
314
314
|
$,
|
|
315
315
|
alias($._associated_const_item, $.const_item),
|
|
316
|
-
alias($._associated_type_item, $.type_item)
|
|
316
|
+
alias($._associated_type_item, $.type_item),
|
|
317
|
+
alias($._associated_type_declaration, $.associated_type)
|
|
317
318
|
),
|
|
318
319
|
|
|
319
320
|
_associated_attributed_declaration: ($) =>
|
|
@@ -779,16 +780,9 @@ module.exports = grammar({
|
|
|
779
780
|
trait_alias_bounds: ($) =>
|
|
780
781
|
seq(sepBy1('+', choice($._type, $.lifetime, $.higher_ranked_trait_bound)), optional('+')),
|
|
781
782
|
|
|
782
|
-
associated_type: ($) =>
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
'type',
|
|
786
|
-
field('name', $._type_identifier),
|
|
787
|
-
field('type_parameters', optional($.type_parameters)),
|
|
788
|
-
field('bounds', optional($.trait_bounds)),
|
|
789
|
-
optional($.where_clause),
|
|
790
|
-
';'
|
|
791
|
-
),
|
|
783
|
+
associated_type: ($) => associatedType($),
|
|
784
|
+
|
|
785
|
+
_associated_type_declaration: ($) => associatedType($, [optional('default')]),
|
|
792
786
|
|
|
793
787
|
trait_bounds: ($) =>
|
|
794
788
|
prec.right(
|
|
@@ -1998,8 +1992,9 @@ module.exports = grammar({
|
|
|
1998
1992
|
* @param {import('@willbooster/web-tree-sitter/dsl').GrammarSymbols<'empty_statement' | 'inner_attribute_item' | 'macro_invocation' | 'macro_definition' | 'decl_macro' | 'mod_item' | 'foreign_mod_item' | 'struct_item' | 'union_item' | 'enum_item' | 'type_item' | 'function_item' | 'function_signature_item' | 'impl_item' | 'trait_item' | 'trait_alias' | 'associated_type' | 'let_declaration' | 'use_declaration' | 'extern_crate_declaration' | 'static_item' | '_safe_function_signature_item' | '_qualified_static_item'>} $
|
|
1999
1993
|
* @param {import('@willbooster/web-tree-sitter/dsl').RuleOrLiteral} constant
|
|
2000
1994
|
* @param {import('@willbooster/web-tree-sitter/dsl').RuleOrLiteral} [typeAlias]
|
|
1995
|
+
* @param {import('@willbooster/web-tree-sitter/dsl').RuleOrLiteral} [typeDeclaration]
|
|
2001
1996
|
*/
|
|
2002
|
-
function attributableDeclaration($, constant, typeAlias = $.type_item) {
|
|
1997
|
+
function attributableDeclaration($, constant, typeAlias = $.type_item, typeDeclaration = $.associated_type) {
|
|
2003
1998
|
return choice(
|
|
2004
1999
|
constant,
|
|
2005
2000
|
$.macro_invocation,
|
|
@@ -2016,7 +2011,7 @@ function attributableDeclaration($, constant, typeAlias = $.type_item) {
|
|
|
2016
2011
|
$.impl_item,
|
|
2017
2012
|
$.trait_item,
|
|
2018
2013
|
$.trait_alias,
|
|
2019
|
-
|
|
2014
|
+
typeDeclaration,
|
|
2020
2015
|
$.let_declaration,
|
|
2021
2016
|
$.use_declaration,
|
|
2022
2017
|
$.extern_crate_declaration,
|
|
@@ -2026,6 +2021,23 @@ function attributableDeclaration($, constant, typeAlias = $.type_item) {
|
|
|
2026
2021
|
);
|
|
2027
2022
|
}
|
|
2028
2023
|
|
|
2024
|
+
/**
|
|
2025
|
+
* @param {import('@willbooster/web-tree-sitter/dsl').GrammarSymbols<'visibility_modifier' | '_type_identifier' | 'type_parameters' | 'trait_bounds' | 'where_clause'>} $
|
|
2026
|
+
* @param {import('@willbooster/web-tree-sitter/dsl').RuleOrLiteral[]} [modifier]
|
|
2027
|
+
*/
|
|
2028
|
+
function associatedType($, modifier = []) {
|
|
2029
|
+
return seq(
|
|
2030
|
+
optional($.visibility_modifier),
|
|
2031
|
+
...modifier,
|
|
2032
|
+
'type',
|
|
2033
|
+
field('name', $._type_identifier),
|
|
2034
|
+
field('type_parameters', optional($.type_parameters)),
|
|
2035
|
+
field('bounds', optional($.trait_bounds)),
|
|
2036
|
+
optional($.where_clause),
|
|
2037
|
+
';'
|
|
2038
|
+
);
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2029
2041
|
/**
|
|
2030
2042
|
* @param {import('@willbooster/web-tree-sitter/dsl').GrammarSymbols<'visibility_modifier' | '_type' | '_expression'>} $
|
|
2031
2043
|
* @param {import('@willbooster/web-tree-sitter/dsl').RuleOrLiteral} name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-rust",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"description": "Rust grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -48,20 +48,20 @@
|
|
|
48
48
|
"@types/bun": "1.4.4",
|
|
49
49
|
"@vitest/browser-playwright": "5.0.5",
|
|
50
50
|
"@willbooster/oxlint-config": "1.4.9",
|
|
51
|
-
"@willbooster/wb": "
|
|
52
|
-
"@willbooster/web-tree-sitter": "
|
|
51
|
+
"@willbooster/wb": "23.0.2",
|
|
52
|
+
"@willbooster/web-tree-sitter": "16.0.2",
|
|
53
53
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
54
54
|
"lefthook": "2.2.2",
|
|
55
55
|
"oxlint": "1.89.0",
|
|
56
56
|
"oxlint-tsgolint": "7.0.2005",
|
|
57
57
|
"playwright": "1.64.1",
|
|
58
58
|
"semantic-release": "25.0.9",
|
|
59
|
-
"vite": "8.3.
|
|
59
|
+
"vite": "8.3.5",
|
|
60
60
|
"vitest": "5.0.5",
|
|
61
|
-
"wrangler": "4.
|
|
61
|
+
"wrangler": "4.152.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^15.0.0"
|
|
64
|
+
"@willbooster/web-tree-sitter": "^15.0.0 || ^16.0.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-rust.wasm
CHANGED
|
Binary file
|