@willbooster/tree-sitter-rust 9.0.0 → 10.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 +10 -4
- package/grammar.js +4 -0
- package/package.json +1 -1
- package/queries/highlights.scm +1 -0
- package/src/node-types.json +24 -0
- package/tree-sitter-rust.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -71,10 +71,9 @@ In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-
|
|
|
71
71
|
fuzzed with. The parser requires version 7.0.5 or later within major version 7 of that runtime; upstream's
|
|
72
72
|
`tree-sitter` crate rejects it:
|
|
73
73
|
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
tree-sitter-rust = { package = "willbooster-tree-sitter-rust", version = "9" }
|
|
74
|
+
```sh
|
|
75
|
+
cargo add willbooster-tree-sitter@7.0.5 --rename tree-sitter
|
|
76
|
+
cargo add willbooster-tree-sitter-rust --rename tree-sitter-rust
|
|
78
77
|
```
|
|
79
78
|
|
|
80
79
|
```rust
|
|
@@ -82,6 +81,13 @@ let mut parser = tree_sitter::Parser::new();
|
|
|
82
81
|
parser.set_language(&tree_sitter_rust::LANGUAGE.into())?;
|
|
83
82
|
```
|
|
84
83
|
|
|
84
|
+
## Box patterns
|
|
85
|
+
|
|
86
|
+
`box_pattern` exposes its operand through the `pattern` field, including anonymous `_` patterns.
|
|
87
|
+
Nested `box` patterns produce nested nodes; `box 6 | box 7` produces two boxed alternatives.
|
|
88
|
+
The `box` keyword is an anonymous token, including inside macro token trees; `r#box` remains an identifier.
|
|
89
|
+
The grammar parses this feature-gated syntax without evaluating Rust's feature attributes.
|
|
90
|
+
|
|
85
91
|
## Macros
|
|
86
92
|
|
|
87
93
|
A macro definition's anonymous `macro_rules!` node covers the `macro_rules` keyword. The `!` is a separate
|
package/grammar.js
CHANGED
|
@@ -384,6 +384,7 @@ module.exports = grammar({
|
|
|
384
384
|
'async',
|
|
385
385
|
'await',
|
|
386
386
|
'become',
|
|
387
|
+
'box',
|
|
387
388
|
'break',
|
|
388
389
|
'const',
|
|
389
390
|
'continue',
|
|
@@ -1461,6 +1462,7 @@ module.exports = grammar({
|
|
|
1461
1462
|
$.struct_pattern,
|
|
1462
1463
|
$._reserved_identifier,
|
|
1463
1464
|
$.ref_pattern,
|
|
1465
|
+
$.box_pattern,
|
|
1464
1466
|
$.slice_pattern,
|
|
1465
1467
|
$.captured_pattern,
|
|
1466
1468
|
$.reference_pattern,
|
|
@@ -1577,6 +1579,8 @@ module.exports = grammar({
|
|
|
1577
1579
|
|
|
1578
1580
|
ref_pattern: ($) => seq('ref', $._pattern),
|
|
1579
1581
|
|
|
1582
|
+
box_pattern: ($) => seq('box', field('pattern', $._pattern)),
|
|
1583
|
+
|
|
1580
1584
|
captured_pattern: ($) =>
|
|
1581
1585
|
seq(
|
|
1582
1586
|
choice($.identifier, $._reserved_identifier, alias(choice(...primitiveTypes), $.identifier)),
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
package/src/node-types.json
CHANGED
|
@@ -347,6 +347,10 @@
|
|
|
347
347
|
"type": "_literal_pattern",
|
|
348
348
|
"named": true
|
|
349
349
|
},
|
|
350
|
+
{
|
|
351
|
+
"type": "box_pattern",
|
|
352
|
+
"named": true
|
|
353
|
+
},
|
|
350
354
|
{
|
|
351
355
|
"type": "captured_pattern",
|
|
352
356
|
"named": true
|
|
@@ -1163,6 +1167,22 @@
|
|
|
1163
1167
|
]
|
|
1164
1168
|
}
|
|
1165
1169
|
},
|
|
1170
|
+
{
|
|
1171
|
+
"type": "box_pattern",
|
|
1172
|
+
"named": true,
|
|
1173
|
+
"fields": {
|
|
1174
|
+
"pattern": {
|
|
1175
|
+
"multiple": false,
|
|
1176
|
+
"required": true,
|
|
1177
|
+
"types": [
|
|
1178
|
+
{
|
|
1179
|
+
"type": "_pattern",
|
|
1180
|
+
"named": true
|
|
1181
|
+
}
|
|
1182
|
+
]
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1166
1186
|
{
|
|
1167
1187
|
"type": "bracketed_type",
|
|
1168
1188
|
"named": true,
|
|
@@ -5723,6 +5743,10 @@
|
|
|
5723
5743
|
"type": "block",
|
|
5724
5744
|
"named": false
|
|
5725
5745
|
},
|
|
5746
|
+
{
|
|
5747
|
+
"type": "box",
|
|
5748
|
+
"named": false
|
|
5749
|
+
},
|
|
5726
5750
|
{
|
|
5727
5751
|
"type": "break",
|
|
5728
5752
|
"named": false
|
package/tree-sitter-rust.wasm
CHANGED
|
Binary file
|