@willbooster/tree-sitter-ruby 3.0.5 → 3.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
@@ -87,9 +87,10 @@ module.exports = grammar({
87
87
  $._uninterpreted,
88
88
  $._not_parenthesized,
89
89
  $._lambda_brace,
90
+ $._heredoc_literal_resume,
90
91
  ],
91
92
 
92
- extras: ($) => [$.comment, $.heredoc_body, /\s/, /\\\r?\n/],
93
+ extras: ($) => [$.comment, $.heredoc_body, $._heredoc_literal_resume, /\s/, /\\\r?\n/],
93
94
 
94
95
  word: ($) => $.identifier,
95
96
 
@@ -1207,10 +1208,20 @@ module.exports = grammar({
1207
1208
  PREC.CURLY_BLOCK,
1208
1209
  prec.dynamic(
1209
1210
  2,
1210
- seq('{', field('parameters', optional($.block_parameters)), optional(field('body', $.block_body)), '}')
1211
+ seq(
1212
+ $._block_open,
1213
+ field('parameters', optional($.block_parameters)),
1214
+ optional(field('body', $.block_body)),
1215
+ '}'
1216
+ )
1211
1217
  )
1212
1218
  ),
1213
1219
 
1220
+ // Where both a block and a hash argument can start (`foo {`, `x.y {`), the `{` would otherwise be shared until a
1221
+ // later conflict picks the hash. Reducing the brace on its own forces the choice right after it, and the precedence
1222
+ // makes it a block, as in Ruby.
1223
+ _block_open: () => prec(PREC.CURLY_BLOCK, '{'),
1224
+
1214
1225
  _arg_rhs: ($) => choice($._arg, alias($.rescue_modifier_arg, $.rescue_modifier)),
1215
1226
 
1216
1227
  _ordinary_rhs_expression: ($) => prec(PREC.ASSIGN, $._arg_rhs),
@@ -1611,6 +1622,7 @@ module.exports = grammar({
1611
1622
  seq(
1612
1623
  '\\',
1613
1624
  choice(
1625
+ /\r\n/,
1614
1626
  /[^ux0-7]/, // single character
1615
1627
  /x[0-9a-fA-F]{1,2}/, // hex code
1616
1628
  /[0-7]{1,3}/, // octal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-ruby",
3
- "version": "3.0.5",
3
+ "version": "3.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": "3.0.5",
22
+ "version": "3.0.7",
23
23
  "license": "MIT",
24
24
  "description": "Ruby grammar for tree-sitter",
25
25
  "authors": [