@willbooster/tree-sitter-ruby 3.0.3 → 3.0.5

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
@@ -86,6 +86,7 @@ module.exports = grammar({
86
86
  $._block_comment,
87
87
  $._uninterpreted,
88
88
  $._not_parenthesized,
89
+ $._lambda_brace,
89
90
  ],
90
91
 
91
92
  extras: ($) => [$.comment, $.heredoc_body, /\s/, /\\\r?\n/],
@@ -1666,7 +1667,18 @@ module.exports = grammar({
1666
1667
  )
1667
1668
  )
1668
1669
  ),
1669
- field('body', choice($.block, $.do_block))
1670
+ field('body', choice(alias($._lambda_block, $.block), $.do_block))
1671
+ ),
1672
+
1673
+ // As with parse.y's tLAMBEG, the scanner emits this `{` where a lambda body can start, so that it opens the body
1674
+ // after bare parameters even where a parameter default could take a block or start a hash (`-> a=b() { }`,
1675
+ // `-> x: { }`).
1676
+ _lambda_block: ($) =>
1677
+ seq(
1678
+ alias($._lambda_brace, '{'),
1679
+ field('parameters', optional($.block_parameters)),
1680
+ optional(field('body', $.block_body)),
1681
+ '}'
1670
1682
  ),
1671
1683
 
1672
1684
  _parenthesized_lambda_parameters: ($) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-ruby",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
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.3",
22
+ "version": "3.0.5",
23
23
  "license": "MIT",
24
24
  "description": "Ruby grammar for tree-sitter",
25
25
  "authors": [