@willbooster/tree-sitter-kotlin 1.2.0 → 1.3.1

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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @willbooster/tree-sitter-kotlin
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@willbooster/tree-sitter-kotlin.svg)](https://www.npmjs.com/package/@willbooster/tree-sitter-kotlin)
4
+ [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-kotlin.svg)](https://crates.io/crates/willbooster-tree-sitter-kotlin)
4
5
  [![license](https://img.shields.io/npm/l/@willbooster/tree-sitter-kotlin.svg)](https://www.npmjs.com/package/@willbooster/tree-sitter-kotlin)
5
6
  [![Test](https://github.com/WillBooster/tree-sitter-kotlin/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-kotlin/actions/workflows/test.yml)
6
7
  [![Test rust](https://github.com/WillBooster/tree-sitter-kotlin/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-kotlin/actions/workflows/test-rust.yml)
@@ -30,12 +31,12 @@ const tree = parser.parse('fun main() = println("Hello")\n');
30
31
 
31
32
  The package also ships the node types in `src/node-types.json`.
32
33
 
33
- In Rust, depend on the Git repository; the crate is not published to crates.io:
34
+ In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-kotlin):
34
35
 
35
36
  ```toml
36
37
  [dependencies]
37
38
  tree-sitter = "0.27"
38
- tree-sitter-kotlin = { package = "willbooster-tree-sitter-kotlin", git = "https://github.com/WillBooster/tree-sitter-kotlin", tag = "v1.1.0" }
39
+ tree-sitter-kotlin = { package = "willbooster-tree-sitter-kotlin", version = "1.2" }
39
40
  ```
40
41
 
41
42
  ```rust
package/grammar.js CHANGED
@@ -41,6 +41,10 @@ module.exports = grammar({
41
41
  [$.annotated_expression, $.type_modifiers],
42
42
  [$.annotated_expression, $.type_modifiers, $.when_subject],
43
43
  [$.annotated_expression, $.type_modifiers, $.modifiers],
44
+ [$.variable_declaration, $._loop_prefix, $.modifiers, $.type_modifiers, $.annotated_expression],
45
+ [$._loop_prefix, $.annotated_expression],
46
+ [$._loop_prefix, $.modifiers, $.type_modifiers, $.annotated_expression],
47
+ [$._loop_prefix, $.labeled_expression],
44
48
  [$.parameter_modifiers, $.type_modifiers],
45
49
  [$.function_modifier, $.type_modifiers],
46
50
  [$.function_modifier, $._reserved_identifier],
@@ -286,7 +290,7 @@ module.exports = grammar({
286
290
  for_statement: ($) =>
287
291
  prec.right(
288
292
  seq(
289
- optional($.label),
293
+ optional($._loop_prefix),
290
294
  'for',
291
295
  '(',
292
296
  repeat($.annotation),
@@ -301,7 +305,7 @@ module.exports = grammar({
301
305
  while_statement: ($) =>
302
306
  prec.right(
303
307
  seq(
304
- optional($.label),
308
+ optional($._loop_prefix),
305
309
  'while',
306
310
  '(',
307
311
  field('condition', $.expression),
@@ -313,7 +317,7 @@ module.exports = grammar({
313
317
  do_while_statement: ($) =>
314
318
  prec.right(
315
319
  seq(
316
- optional($.label),
320
+ optional($._loop_prefix),
317
321
  'do',
318
322
  optional(choice(field('body', choice($.block, $.statement)), ';')),
319
323
  'while',
@@ -323,6 +327,8 @@ module.exports = grammar({
323
327
  )
324
328
  ),
325
329
 
330
+ _loop_prefix: ($) => prec.dynamic(1, repeat1(choice($.annotation, $.label))),
331
+
326
332
  class_body: ($) => seq('{', repeat(seq($.class_member_declaration, $._class_member_semi)), '}'),
327
333
 
328
334
  class_member_declaration: ($) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-kotlin",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Kotlin grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -958,9 +958,13 @@
958
958
  }
959
959
  },
960
960
  "children": {
961
- "multiple": false,
961
+ "multiple": true,
962
962
  "required": false,
963
963
  "types": [
964
+ {
965
+ "type": "annotation",
966
+ "named": true
967
+ },
964
968
  {
965
969
  "type": "label",
966
970
  "named": true
@@ -2623,9 +2627,13 @@
2623
2627
  }
2624
2628
  },
2625
2629
  "children": {
2626
- "multiple": false,
2630
+ "multiple": true,
2627
2631
  "required": false,
2628
2632
  "types": [
2633
+ {
2634
+ "type": "annotation",
2635
+ "named": true
2636
+ },
2629
2637
  {
2630
2638
  "type": "label",
2631
2639
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "1.2.0",
16
+ "version": "1.3.1",
17
17
  "license": "MIT",
18
18
  "description": "Kotlin grammar for tree-sitter",
19
19
  "authors": [