@willbooster/tree-sitter-rust 20.0.2 → 21.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/grammar.js CHANGED
@@ -206,6 +206,7 @@ module.exports = grammar({
206
206
  sym('_orphan_doc_missing_owner'),
207
207
  sym('_trailing_type_bound_plus'),
208
208
  sym('shebang'),
209
+ sym('_break_before_brace'),
209
210
  ],
210
211
 
211
212
  supertypes: ($) => [
@@ -236,6 +237,7 @@ module.exports = grammar({
236
237
  ],
237
238
 
238
239
  conflicts: ($) => [
240
+ [$.break_expression],
239
241
  [$.array_expression, $._array_assignee_expression],
240
242
  [$.tuple_expression, $._tuple_assignee_expression],
241
243
  [$.arguments, $._assignee_arguments],
@@ -1263,7 +1265,7 @@ module.exports = grammar({
1263
1265
  prec(
1264
1266
  PREC.unary,
1265
1267
  seq(
1266
- '&',
1268
+ alias(token(prec(1, '&')), '&'),
1267
1269
  choice(seq('raw', choice('const', $.mutable_specifier)), optional($.mutable_specifier)),
1268
1270
  field('value', $._expression)
1269
1271
  )
@@ -1594,15 +1596,24 @@ module.exports = grammar({
1594
1596
  ),
1595
1597
 
1596
1598
  closure_parameters: ($) =>
1597
- seq(
1598
- '|',
1599
- optional(seq(sepBy1(',', seq(repeat($.attribute_item), choice($._pattern, $.parameter))), optional(','))),
1600
- '|'
1599
+ choice(
1600
+ '||',
1601
+ seq(
1602
+ '|',
1603
+ optional(seq(sepBy1(',', seq(repeat($.attribute_item), choice($._pattern, $.parameter))), optional(','))),
1604
+ '|'
1605
+ )
1601
1606
  ),
1602
1607
 
1603
1608
  label: ($) => seq("'", $.identifier),
1604
1609
 
1605
- break_expression: ($) => prec.left(seq($._break_expression_head, optional($._expression))),
1610
+ break_expression: ($) =>
1611
+ choice(
1612
+ prec.dynamic(1, prec.left(seq($._break_expression_head, $._expression))),
1613
+ // A brace can open the body of an enclosing header, even after a nested operand.
1614
+ seq($._break_expression_head, sym('_break_before_brace'), optional(prec.dynamic(-1, prec.left($._expression)))),
1615
+ $._break_expression_head
1616
+ ),
1606
1617
 
1607
1618
  _break_expression_head: ($) => prec.right(seq('break', optional($.label))),
1608
1619
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "20.0.2",
3
+ "version": "21.0.0",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "parsing",
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "20.0.2",
19
+ "version": "21.0.0",
20
20
  "license": "MIT",
21
21
  "description": "Rust grammar for tree-sitter",
22
22
  "authors": [