@willbooster/tree-sitter-kotlin 1.5.1 → 1.5.3

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
@@ -16,6 +16,7 @@ const PREC = {
16
16
  AS: 12,
17
17
  CALL: 13,
18
18
  UNARY: 14,
19
+ DELEGATION: 15,
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.
@@ -67,7 +68,6 @@ module.exports = grammar({
67
68
  [$.visibility_modifier, $._reserved_identifier],
68
69
  [$.member_modifier, $._reserved_identifier],
69
70
 
70
- [$.explicit_delegation, $.expression],
71
71
  [$.qualified_identifier],
72
72
  [$.constructor_invocation, $._unescaped_annotation],
73
73
  [$.nullable_type],
@@ -271,7 +271,9 @@ module.exports = grammar({
271
271
 
272
272
  property_delegate: ($) => seq('by', $.expression),
273
273
 
274
- explicit_delegation: ($) => seq($.type, 'by', $.primary_expression),
274
+ // Above PREC.CALL so that, as in Kotlin, a `{` after the delegation expression starts the class body instead of a
275
+ // trailing lambda. The last operand of an operator expression still takes the lambda (#29).
276
+ explicit_delegation: ($) => prec(PREC.DELEGATION, seq($.type, 'by', $.expression)),
275
277
 
276
278
  getter: ($) =>
277
279
  prec.right(
@@ -718,11 +720,7 @@ module.exports = grammar({
718
720
 
719
721
  multiline_string_literal: ($) =>
720
722
  choice(
721
- seq(
722
- '"""',
723
- repeat(choice(alias($._multiline_string_content, $.string_content), $.interpolation)),
724
- choice('"""', '""""')
725
- ),
723
+ seq('"""', repeat(choice(alias($._multiline_string_content, $.string_content), $.interpolation)), '"""'),
726
724
  seq(
727
725
  $._multi_dollar_multiline_string_start,
728
726
  repeat(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-kotlin",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Kotlin grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -1043,7 +1043,7 @@
1043
1043
  "required": true,
1044
1044
  "types": [
1045
1045
  {
1046
- "type": "primary_expression",
1046
+ "type": "expression",
1047
1047
  "named": true
1048
1048
  },
1049
1049
  {
@@ -2745,10 +2745,6 @@
2745
2745
  "type": "\"\"\"",
2746
2746
  "named": false
2747
2747
  },
2748
- {
2749
- "type": "\"\"\"\"",
2750
- "named": false
2751
- },
2752
2748
  {
2753
2749
  "type": "$",
2754
2750
  "named": false
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "1.5.1",
16
+ "version": "1.5.3",
17
17
  "license": "MIT",
18
18
  "description": "Kotlin grammar for tree-sitter",
19
19
  "authors": [