@willbooster/tree-sitter-kotlin 1.5.0 → 1.5.2

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(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-kotlin",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Kotlin grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -28,7 +28,7 @@
28
28
  "lint": "bun wb lint",
29
29
  "lint-fix": "bun wb lint --fix",
30
30
  "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
31
- "release": "wb release",
31
+ "release": "node script/release.mjs",
32
32
  "prestart": "bun run build-wasm",
33
33
  "start": "tree-sitter playground",
34
34
  "test": "bun wb test",
@@ -46,7 +46,7 @@
46
46
  "@willbooster/oxfmt-config": "1.2.2",
47
47
  "@willbooster/oxlint-config": "1.4.8",
48
48
  "@willbooster/wb": "22.11.5",
49
- "@willbooster/web-tree-sitter": "1.0.0",
49
+ "@willbooster/web-tree-sitter": "1.0.7",
50
50
  "conventional-changelog-conventionalcommits": "10.4.0",
51
51
  "lefthook": "2.1.14",
52
52
  "oxfmt": "0.70.0",
@@ -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
  {
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "1.5.0",
16
+ "version": "1.5.2",
17
17
  "license": "MIT",
18
18
  "description": "Kotlin grammar for tree-sitter",
19
19
  "authors": [