@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 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: ($) => prec(1, seq(field('name', $.lifetime), optional(field('bounds', $.trait_bounds)))),
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: ($) => prec(1, seq("'", choice($.identifier, alias(choice('static', '_'), $.identifier)))),
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: ($) => prec(1, seq('for', '<', optional(seq(sepBy1(',', prec(1, $.lifetime)), optional(','))), '>')),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "14.0.3",
3
+ "version": "14.0.4",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -25,7 +25,7 @@
25
25
  }
26
26
  ],
27
27
  "metadata": {
28
- "version": "14.0.3",
28
+ "version": "14.0.4",
29
29
  "license": "MIT",
30
30
  "description": "Rust grammar for tree-sitter",
31
31
  "authors": [