@willbooster/tree-sitter-kotlin 1.7.2 → 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 +20 -11
- 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
|
@@ -14,8 +14,9 @@ const PREC = {
|
|
|
14
14
|
ADD: 10,
|
|
15
15
|
MULTIPLY: 11,
|
|
16
16
|
AS: 12,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
PREFIX: 13,
|
|
18
|
+
CALL: 14,
|
|
19
|
+
POSTFIX: 14,
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
// oxlint-disable-next-line unicorn/prefer-module -- This package is CommonJS, so tree-sitter loads grammar.js as CommonJS.
|
|
@@ -27,6 +28,7 @@ module.exports = grammar({
|
|
|
27
28
|
[$.class_body, $.enum_class_body],
|
|
28
29
|
|
|
29
30
|
[$.binary_expression, $.call_expression],
|
|
31
|
+
[$.unary_expression, $.binary_expression, $.call_expression],
|
|
30
32
|
[$.binary_expression, $.in_expression, $.call_expression],
|
|
31
33
|
[$.binary_expression, $.infix_expression, $.call_expression],
|
|
32
34
|
[$.binary_expression, $.range_expression, $.call_expression],
|
|
@@ -59,7 +61,7 @@ module.exports = grammar({
|
|
|
59
61
|
|
|
60
62
|
[$.function_value_parameters, $.function_type_parameters],
|
|
61
63
|
[$.parenthesized_type, $.function_type_parameters],
|
|
62
|
-
[$.
|
|
64
|
+
[$._multi_variable_declaration, $.function_type_parameters],
|
|
63
65
|
|
|
64
66
|
[$.class_modifier, $._reserved_identifier],
|
|
65
67
|
[$.platform_modifier, $._reserved_identifier],
|
|
@@ -86,6 +88,7 @@ module.exports = grammar({
|
|
|
86
88
|
extras: ($) => [/\s/, $.line_comment, $.block_comment],
|
|
87
89
|
|
|
88
90
|
externals: ($) => [
|
|
91
|
+
$._destructuring_type_start,
|
|
89
92
|
$._semi,
|
|
90
93
|
$._class_member_semi,
|
|
91
94
|
// Unlike properties, these declarations can end before another member on the same line.
|
|
@@ -344,7 +347,9 @@ module.exports = grammar({
|
|
|
344
347
|
|
|
345
348
|
variable_declaration: ($) => prec(1, seq(repeat($.annotation), $._identifier, optional(seq(':', $.type)))),
|
|
346
349
|
|
|
347
|
-
multi_variable_declaration: ($) =>
|
|
350
|
+
multi_variable_declaration: ($) => $._multi_variable_declaration,
|
|
351
|
+
|
|
352
|
+
_multi_variable_declaration: ($) => seq('(', optionalCommaSep1($.variable_declaration), ')'),
|
|
348
353
|
|
|
349
354
|
property_delegate: ($) => seq('by', $.expression),
|
|
350
355
|
|
|
@@ -637,12 +642,12 @@ module.exports = grammar({
|
|
|
637
642
|
),
|
|
638
643
|
|
|
639
644
|
unary_expression: ($) =>
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
seq(field('operator', choice('++', '--', '+', '-', '!')), field('argument', $.expression))
|
|
644
|
-
|
|
645
|
-
)
|
|
645
|
+
choice(
|
|
646
|
+
prec.right(
|
|
647
|
+
PREC.PREFIX,
|
|
648
|
+
seq(field('operator', choice('++', '--', '+', '-', '!')), field('argument', $.expression))
|
|
649
|
+
),
|
|
650
|
+
prec.left(PREC.POSTFIX, seq(field('argument', $.expression), field('operator', choice('++', '--', '!!'))))
|
|
646
651
|
),
|
|
647
652
|
|
|
648
653
|
annotated_expression: ($) => seq($.annotation, $.expression),
|
|
@@ -728,7 +733,11 @@ module.exports = grammar({
|
|
|
728
733
|
|
|
729
734
|
lambda_parameters: ($) => seq(commaSep1($._lambda_parameter), optional(',')),
|
|
730
735
|
|
|
731
|
-
_lambda_parameter: ($) =>
|
|
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)))),
|
|
732
741
|
|
|
733
742
|
anonymous_function: ($) =>
|
|
734
743
|
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
|