@willbooster/tree-sitter-ruby 2.0.6 → 2.0.7

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
@@ -78,6 +78,7 @@ module.exports = grammar({
78
78
  $._constant_suffix,
79
79
  $._hash_splat_star_star,
80
80
  $._binary_star_star,
81
+ $._modulo_assignment,
81
82
  $._element_reference_bracket,
82
83
  $._short_interpolation,
83
84
  $._line_comment,
@@ -925,7 +926,7 @@ module.exports = grammar({
925
926
  PREC.ASSIGN,
926
927
  seq(
927
928
  field('left', $._chained_lhs),
928
- field('operator', choice('+=', '-=', '*=', '**=', '/=', '||=', '|=', '&&=', '&=', '%=', '>>=', '<<=', '^=')),
929
+ field('operator', assignmentOperator($)),
929
930
  field('right', choice($._expression, alias($.rescue_modifier_expression, $.rescue_modifier)))
930
931
  )
931
932
  ),
@@ -955,11 +956,7 @@ module.exports = grammar({
955
956
  operator_assignment: ($) =>
956
957
  prec.right(
957
958
  PREC.ASSIGN,
958
- seq(
959
- field('left', $._lhs),
960
- field('operator', choice('+=', '-=', '*=', '**=', '/=', '||=', '|=', '&&=', '&=', '%=', '>>=', '<<=', '^=')),
961
- field('right', $._arg_rhs)
962
- )
959
+ seq(field('left', $._lhs), field('operator', assignmentOperator($)), field('right', $._arg_rhs))
963
960
  ),
964
961
 
965
962
  command_operator_assignment: ($) =>
@@ -967,7 +964,7 @@ module.exports = grammar({
967
964
  PREC.ASSIGN,
968
965
  seq(
969
966
  field('left', $._lhs),
970
- field('operator', choice('+=', '-=', '*=', '**=', '/=', '||=', '|=', '&&=', '&=', '%=', '>>=', '<<=', '^=')),
967
+ field('operator', assignmentOperator($)),
971
968
  field('right', choice($._expression, alias($.rescue_modifier_expression, $.rescue_modifier)))
972
969
  )
973
970
  ),
@@ -1281,6 +1278,27 @@ function commaSep(rule) {
1281
1278
  return optional(commaSep1(rule));
1282
1279
  }
1283
1280
 
1281
+ /**
1282
+ * @param {GrammarSymbols<string>} $
1283
+ */
1284
+ function assignmentOperator($) {
1285
+ return choice(
1286
+ '+=',
1287
+ '-=',
1288
+ '*=',
1289
+ '**=',
1290
+ '/=',
1291
+ '||=',
1292
+ '|=',
1293
+ '&&=',
1294
+ '&=',
1295
+ alias($._modulo_assignment, '%='),
1296
+ '>>=',
1297
+ '<<=',
1298
+ '^='
1299
+ );
1300
+ }
1301
+
1284
1302
  /**
1285
1303
  * @param {RuleOrLiteral} operand
1286
1304
  * @param {RuleOrLiteral} sign
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-ruby",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Ruby grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -19,7 +19,7 @@
19
19
  }
20
20
  ],
21
21
  "metadata": {
22
- "version": "2.0.6",
22
+ "version": "2.0.7",
23
23
  "license": "MIT",
24
24
  "description": "Ruby grammar for tree-sitter",
25
25
  "authors": [