@willbooster/tree-sitter-kotlin 1.7.3 → 1.7.4

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
@@ -61,7 +61,7 @@ module.exports = grammar({
61
61
 
62
62
  [$.function_value_parameters, $.function_type_parameters],
63
63
  [$.parenthesized_type, $.function_type_parameters],
64
- [$.multi_variable_declaration, $.function_type_parameters],
64
+ [$._multi_variable_declaration, $.function_type_parameters],
65
65
 
66
66
  [$.class_modifier, $._reserved_identifier],
67
67
  [$.platform_modifier, $._reserved_identifier],
@@ -88,6 +88,7 @@ module.exports = grammar({
88
88
  extras: ($) => [/\s/, $.line_comment, $.block_comment],
89
89
 
90
90
  externals: ($) => [
91
+ $._destructuring_type_start,
91
92
  $._semi,
92
93
  $._class_member_semi,
93
94
  // Unlike properties, these declarations can end before another member on the same line.
@@ -346,7 +347,9 @@ module.exports = grammar({
346
347
 
347
348
  variable_declaration: ($) => prec(1, seq(repeat($.annotation), $._identifier, optional(seq(':', $.type)))),
348
349
 
349
- multi_variable_declaration: ($) => seq('(', optionalCommaSep1($.variable_declaration), ')'),
350
+ multi_variable_declaration: ($) => $._multi_variable_declaration,
351
+
352
+ _multi_variable_declaration: ($) => seq('(', optionalCommaSep1($.variable_declaration), ')'),
350
353
 
351
354
  property_delegate: ($) => seq('by', $.expression),
352
355
 
@@ -730,7 +733,11 @@ module.exports = grammar({
730
733
 
731
734
  lambda_parameters: ($) => seq(commaSep1($._lambda_parameter), optional(',')),
732
735
 
733
- _lambda_parameter: ($) => choice($.variable_declaration, $.multi_variable_declaration),
736
+ _lambda_parameter: ($) =>
737
+ choice($.variable_declaration, alias($._destructuring_lambda_parameter, $.multi_variable_declaration)),
738
+
739
+ _destructuring_lambda_parameter: ($) =>
740
+ seq($._multi_variable_declaration, optional(seq(alias($._destructuring_type_start, ':'), field('type', $.type)))),
734
741
 
735
742
  anonymous_function: ($) =>
736
743
  prec.right(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-kotlin",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Kotlin grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -1667,7 +1667,18 @@
1667
1667
  {
1668
1668
  "type": "multi_variable_declaration",
1669
1669
  "named": true,
1670
- "fields": {},
1670
+ "fields": {
1671
+ "type": {
1672
+ "multiple": false,
1673
+ "required": false,
1674
+ "types": [
1675
+ {
1676
+ "type": "type",
1677
+ "named": true
1678
+ }
1679
+ ]
1680
+ }
1681
+ },
1671
1682
  "children": {
1672
1683
  "multiple": true,
1673
1684
  "required": false,
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "1.7.3",
16
+ "version": "1.7.4",
17
17
  "license": "MIT",
18
18
  "description": "Kotlin grammar for tree-sitter",
19
19
  "authors": [