@willbooster/tree-sitter-kotlin 1.7.3 → 1.7.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 +15 -5
- package/package.json +1 -1
- package/src/node-types.json +12 -1
- package/tree-sitter-kotlin.wasm +0 -0
- package/tree-sitter.json +1 -1
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
|
-
[$.
|
|
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.
|
|
@@ -133,6 +134,8 @@ module.exports = grammar({
|
|
|
133
134
|
'where',
|
|
134
135
|
$._separated_member_start,
|
|
135
136
|
$._unseparated_member_start,
|
|
137
|
+
$._infix_position,
|
|
138
|
+
$._companion_name_position,
|
|
136
139
|
],
|
|
137
140
|
|
|
138
141
|
inline: ($) => [$._statements, $._identifier, $._control_structure_body],
|
|
@@ -270,7 +273,7 @@ module.exports = grammar({
|
|
|
270
273
|
'companion',
|
|
271
274
|
'object',
|
|
272
275
|
optional($._unseparated_member_start),
|
|
273
|
-
optional(field('name', $.identifier)),
|
|
276
|
+
optional(seq(optional($._companion_name_position), field('name', $.identifier))),
|
|
274
277
|
optional(seq(':', $.delegation_specifiers)),
|
|
275
278
|
optional($.class_body)
|
|
276
279
|
),
|
|
@@ -346,7 +349,9 @@ module.exports = grammar({
|
|
|
346
349
|
|
|
347
350
|
variable_declaration: ($) => prec(1, seq(repeat($.annotation), $._identifier, optional(seq(':', $.type)))),
|
|
348
351
|
|
|
349
|
-
multi_variable_declaration: ($) =>
|
|
352
|
+
multi_variable_declaration: ($) => $._multi_variable_declaration,
|
|
353
|
+
|
|
354
|
+
_multi_variable_declaration: ($) => seq('(', optionalCommaSep1($.variable_declaration), ')'),
|
|
350
355
|
|
|
351
356
|
property_delegate: ($) => seq('by', $.expression),
|
|
352
357
|
|
|
@@ -702,7 +707,8 @@ module.exports = grammar({
|
|
|
702
707
|
|
|
703
708
|
range_expression: ($) => prec.left(PREC.RANGE, seq($.expression, choice('..', '..<'), $.expression)),
|
|
704
709
|
|
|
705
|
-
infix_expression: ($) =>
|
|
710
|
+
infix_expression: ($) =>
|
|
711
|
+
prec.left(PREC.INFIX, seq($.expression, optional($._infix_position), $.identifier, $.expression)),
|
|
706
712
|
|
|
707
713
|
// Right-associative so that a trailing lambda after arguments belongs to the same call (`f(x) { … }`), as in
|
|
708
714
|
// Kotlin, instead of calling the result of `f(x)`.
|
|
@@ -730,7 +736,11 @@ module.exports = grammar({
|
|
|
730
736
|
|
|
731
737
|
lambda_parameters: ($) => seq(commaSep1($._lambda_parameter), optional(',')),
|
|
732
738
|
|
|
733
|
-
_lambda_parameter: ($) =>
|
|
739
|
+
_lambda_parameter: ($) =>
|
|
740
|
+
choice($.variable_declaration, alias($._destructuring_lambda_parameter, $.multi_variable_declaration)),
|
|
741
|
+
|
|
742
|
+
_destructuring_lambda_parameter: ($) =>
|
|
743
|
+
seq($._multi_variable_declaration, optional(seq(alias($._destructuring_type_start, ':'), field('type', $.type)))),
|
|
734
744
|
|
|
735
745
|
anonymous_function: ($) =>
|
|
736
746
|
prec.right(
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -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,
|
package/tree-sitter-kotlin.wasm
CHANGED
|
Binary file
|