@willbooster/tree-sitter-kotlin 1.5.6 → 1.5.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 +6 -16
- package/package.json +1 -1
- package/src/node-types.json +1 -1
- package/tree-sitter-kotlin.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -242,7 +242,7 @@ module.exports = grammar({
|
|
|
242
242
|
|
|
243
243
|
constructor_delegation_call: ($) => seq(choice('this', 'super'), $.value_arguments),
|
|
244
244
|
|
|
245
|
-
type_parameters: ($) => seq('<', commaSep1($.type_parameter), '>'),
|
|
245
|
+
type_parameters: ($) => seq('<', commaSep1($.type_parameter), optional(','), '>'),
|
|
246
246
|
|
|
247
247
|
type_parameter: ($) => seq(optional($.type_parameter_modifiers), $.identifier, optional(seq(':', $.type))),
|
|
248
248
|
|
|
@@ -323,6 +323,7 @@ module.exports = grammar({
|
|
|
323
323
|
$.identifier,
|
|
324
324
|
optional(seq(':', $.type)),
|
|
325
325
|
optional(seq('=', $.expression)),
|
|
326
|
+
optional(','),
|
|
326
327
|
')',
|
|
327
328
|
optional(seq(':', $.type)),
|
|
328
329
|
$.function_body
|
|
@@ -473,7 +474,7 @@ module.exports = grammar({
|
|
|
473
474
|
seq(optional($.type_modifiers), choice($.user_type, 'dynamic', $.parenthesized_type, $.nullable_type)),
|
|
474
475
|
|
|
475
476
|
// `a<B>(c)` also reads as comparisons (`a < B > (c)`); like Kotlin's parser, prefer the type arguments.
|
|
476
|
-
type_arguments: ($) => prec.dynamic(1, seq('<', commaSep1($.type_projection), '>')),
|
|
477
|
+
type_arguments: ($) => prec.dynamic(1, seq('<', commaSep1($.type_projection), optional(','), '>')),
|
|
477
478
|
|
|
478
479
|
type_projection: ($) => choice(seq(repeat($.variance_modifier), $.type), '*'),
|
|
479
480
|
|
|
@@ -631,7 +632,7 @@ module.exports = grammar({
|
|
|
631
632
|
)
|
|
632
633
|
),
|
|
633
634
|
|
|
634
|
-
index_expression: ($) => prec(PREC.CALL, seq($.expression, '[',
|
|
635
|
+
index_expression: ($) => prec(PREC.CALL, seq($.expression, '[', commaSep1($.expression), optional(','), ']')),
|
|
635
636
|
|
|
636
637
|
this_expression: ($) => seq(choice('this', seq('this@', $.identifier))),
|
|
637
638
|
|
|
@@ -672,7 +673,7 @@ module.exports = grammar({
|
|
|
672
673
|
|
|
673
674
|
parenthesized_expression: ($) => seq('(', $.expression, ')'),
|
|
674
675
|
|
|
675
|
-
collection_literal: ($) => seq('[',
|
|
676
|
+
collection_literal: ($) => seq('[', optionalCommaSep1($.expression), ']'),
|
|
676
677
|
|
|
677
678
|
when_expression: ($) => seq('when', optional($.when_subject), '{', repeat($.when_entry), '}'),
|
|
678
679
|
|
|
@@ -696,7 +697,7 @@ module.exports = grammar({
|
|
|
696
697
|
try_expression: ($) =>
|
|
697
698
|
seq('try', $.block, choice(seq(repeat1($.catch_block), optional($.finally_block)), $.finally_block)),
|
|
698
699
|
|
|
699
|
-
catch_block: ($) => seq('catch', '(', repeat($.annotation), $.identifier, ':', $.type, ')', $.block),
|
|
700
|
+
catch_block: ($) => seq('catch', '(', repeat($.annotation), $.identifier, ':', $.type, optional(','), ')', $.block),
|
|
700
701
|
|
|
701
702
|
finally_block: ($) => seq('finally', $.block),
|
|
702
703
|
|
|
@@ -898,17 +899,6 @@ function optionalSep1(rule, separator) {
|
|
|
898
899
|
return optional(seq(rule, repeat(seq(separator, rule)), optional(separator)));
|
|
899
900
|
}
|
|
900
901
|
|
|
901
|
-
/**
|
|
902
|
-
* Creates a rule to optionally match one or more of the rules separated by a comma
|
|
903
|
-
*
|
|
904
|
-
* @param {Rule} rule
|
|
905
|
-
*
|
|
906
|
-
* @returns {ChoiceRule}
|
|
907
|
-
*/
|
|
908
|
-
function commaSep(rule) {
|
|
909
|
-
return optional(commaSep1(rule));
|
|
910
|
-
}
|
|
911
|
-
|
|
912
902
|
/**
|
|
913
903
|
* Creates a rule to match one or more of the rules separated by a comma
|
|
914
904
|
*
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
package/tree-sitter-kotlin.wasm
CHANGED
|
Binary file
|