@willbooster/tree-sitter-rust 14.0.3 → 14.0.4
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/grammar.js +20 -3
- package/package.json +1 -1
- package/tree-sitter-rust.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -265,6 +265,7 @@ module.exports = grammar({
|
|
|
265
265
|
reserved: {
|
|
266
266
|
global: () => globalKeywords,
|
|
267
267
|
token_tree: () => [],
|
|
268
|
+
lifetime_declaration: () => [...globalKeywords, 'r#static', 'r#_'],
|
|
268
269
|
},
|
|
269
270
|
|
|
270
271
|
word: ($) => $.identifier,
|
|
@@ -858,7 +859,11 @@ module.exports = grammar({
|
|
|
858
859
|
)
|
|
859
860
|
),
|
|
860
861
|
|
|
861
|
-
lifetime_parameter: ($) =>
|
|
862
|
+
lifetime_parameter: ($) =>
|
|
863
|
+
prec(
|
|
864
|
+
1,
|
|
865
|
+
seq(field('name', alias($._lifetime_declaration, $.lifetime)), optional(field('bounds', $.trait_bounds)))
|
|
866
|
+
),
|
|
862
867
|
|
|
863
868
|
let_declaration: ($) =>
|
|
864
869
|
seq(
|
|
@@ -935,11 +940,23 @@ module.exports = grammar({
|
|
|
935
940
|
|
|
936
941
|
qualified_type: ($) => seq(field('type', $._type), 'as', field('alias', $._type)),
|
|
937
942
|
|
|
938
|
-
lifetime: ($) =>
|
|
943
|
+
lifetime: ($) =>
|
|
944
|
+
prec(1, seq("'", choice($.identifier, alias(choice('static', '_', 'r#static', 'r#_'), $.identifier)))),
|
|
945
|
+
|
|
946
|
+
_lifetime_declaration: ($) => prec(1, seq("'", reserved('lifetime_declaration', $.identifier))),
|
|
939
947
|
|
|
940
948
|
array_type: ($) => seq('[', field('element', $._type), optional(seq(';', field('length', $._expression))), ']'),
|
|
941
949
|
|
|
942
|
-
for_lifetimes: ($) =>
|
|
950
|
+
for_lifetimes: ($) =>
|
|
951
|
+
prec(
|
|
952
|
+
1,
|
|
953
|
+
seq(
|
|
954
|
+
'for',
|
|
955
|
+
'<',
|
|
956
|
+
optional(seq(sepBy1(',', prec(1, alias($._lifetime_declaration, $.lifetime))), optional(','))),
|
|
957
|
+
'>'
|
|
958
|
+
)
|
|
959
|
+
),
|
|
943
960
|
|
|
944
961
|
function_type: ($) =>
|
|
945
962
|
seq(
|
package/package.json
CHANGED
package/tree-sitter-rust.wasm
CHANGED
|
Binary file
|