@willbooster/tree-sitter-rust 6.0.0 → 8.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
@@ -74,7 +74,7 @@ fuzzed with. The parser requires version 7.0.5 or later within major version 7 o
74
74
  ```toml
75
75
  [dependencies]
76
76
  tree-sitter = { package = "willbooster-tree-sitter", version = "7.0.5" }
77
- tree-sitter-rust = { package = "willbooster-tree-sitter-rust", version = "6" }
77
+ tree-sitter-rust = { package = "willbooster-tree-sitter-rust", version = "8" }
78
78
  ```
79
79
 
80
80
  ```rust
@@ -82,6 +82,11 @@ let mut parser = tree_sitter::Parser::new();
82
82
  parser.set_language(&tree_sitter_rust::LANGUAGE.into())?;
83
83
  ```
84
84
 
85
+ ## Macros
86
+
87
+ A macro definition's anonymous `macro_rules!` node covers the `macro_rules` keyword. The `!` is a separate
88
+ anonymous child. A macro invocation's `macro` field contains its name, including when that name is `macro_rules`.
89
+
85
90
  ## Attributes
86
91
 
87
92
  An attribute in an expression position can produce an `attributed_expression` node with a `value` field.
package/grammar.js CHANGED
@@ -195,7 +195,6 @@ module.exports = grammar({
195
195
  [$._type, $._pattern],
196
196
  [$.unit_type, $.tuple_pattern],
197
197
  [$.scoped_identifier, $.scoped_type_identifier],
198
- [$.parameters, $._pattern],
199
198
  [$.parameters, $.tuple_struct_pattern],
200
199
  [$.visibility_modifier],
201
200
  [$.visibility_modifier, $.scoped_identifier, $.scoped_type_identifier],
@@ -267,7 +266,8 @@ module.exports = grammar({
267
266
  const rules = seq(repeat(seq($.macro_rule, ';')), optional($.macro_rule));
268
267
 
269
268
  return seq(
270
- choice('macro_rules!', seq(alias('macro_rules', 'macro_rules!'), '!')),
269
+ alias('macro_rules', 'macro_rules!'),
270
+ '!',
271
271
  field('name', choice($.identifier, $._reserved_identifier)),
272
272
  choice(seq('(', rules, ')', ';'), seq('[', rules, ']', ';'), seq('{', rules, '}'))
273
273
  );
@@ -821,10 +821,7 @@ module.exports = grammar({
821
821
  parameters: ($) =>
822
822
  seq(
823
823
  '(',
824
- sepBy(
825
- ',',
826
- seq(repeat($.attribute_item), choice($.parameter, $.self_parameter, $.variadic_parameter, '_', $._type))
827
- ),
824
+ sepBy(',', seq(repeat($.attribute_item), choice($.parameter, $.self_parameter, $.variadic_parameter, $._type))),
828
825
  optional(','),
829
826
  optional(alias($._orphan_doc_expression, $.attributed_expression)),
830
827
  ')'
@@ -857,6 +854,7 @@ module.exports = grammar({
857
854
  $.array_type,
858
855
  $.function_type,
859
856
  $._type_identifier_in_type_position,
857
+ alias('_', sym('type_identifier')),
860
858
  $.macro_invocation,
861
859
  $.never_type,
862
860
  $.dynamic_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "6.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -118,6 +118,7 @@
118
118
  "let" @keyword
119
119
  "loop" @keyword
120
120
  "macro_rules!" @keyword
121
+ (macro_definition "!" @keyword)
121
122
  "macro" @keyword
122
123
  "match" @keyword
123
124
  "mod" @keyword
Binary file
package/tree-sitter.json CHANGED
@@ -25,7 +25,7 @@
25
25
  }
26
26
  ],
27
27
  "metadata": {
28
- "version": "6.0.0",
28
+ "version": "8.0.0",
29
29
  "license": "MIT",
30
30
  "description": "Rust grammar for tree-sitter",
31
31
  "authors": [