@willbooster/tree-sitter-kotlin 1.4.1 → 1.4.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/README.md CHANGED
@@ -60,12 +60,15 @@ parser.setLanguage(await Language.load(kotlin));
60
60
 
61
61
  The package also ships the node types in `src/node-types.json`.
62
62
 
63
- In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-kotlin):
63
+ In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-kotlin) and on
64
+ [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
65
+ fuzzed with (the grammar also loads in the upstream `tree-sitter` crate 0.27, whose error recovery never ends on some
66
+ malformed input):
64
67
 
65
68
  ```toml
66
69
  [dependencies]
67
- tree-sitter = "0.27"
68
- tree-sitter-kotlin = { package = "willbooster-tree-sitter-kotlin", version = "1.2" }
70
+ tree-sitter = { package = "willbooster-tree-sitter", version = "1" }
71
+ tree-sitter-kotlin = { package = "willbooster-tree-sitter-kotlin", version = "1" }
69
72
  ```
70
73
 
71
74
  ```rust
package/grammar.js CHANGED
@@ -94,6 +94,8 @@ module.exports = grammar({
94
94
  '$',
95
95
  // used to check if a modifier alone on its line belongs to a declaration on the next line
96
96
  'val',
97
+ // never scanned: it tells the scanner where a primary constructor may start
98
+ $._primary_constructor_position,
97
99
  ],
98
100
 
99
101
  inline: ($) => [$._statements, $._identifier, $._control_structure_body],
@@ -143,7 +145,7 @@ module.exports = grammar({
143
145
  choice('class', seq(optional('fun'), 'interface')),
144
146
  field('name', $.identifier),
145
147
  optional($.type_parameters),
146
- optional($.primary_constructor),
148
+ optional(seq(optional($._primary_constructor_position), $.primary_constructor)),
147
149
  optional(seq(':', $.delegation_specifiers)),
148
150
  optional($.type_constraints),
149
151
  optional(choice($.class_body, $.enum_class_body))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-kotlin",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Kotlin grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "1.4.1",
16
+ "version": "1.4.2",
17
17
  "license": "MIT",
18
18
  "description": "Kotlin grammar for tree-sitter",
19
19
  "authors": [