@willbooster/tree-sitter-kotlin 22.0.1 → 22.0.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/README.md +1 -1
- package/grammar.js +38 -25
- package/package.json +7 -7
- package/tree-sitter-kotlin.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-kotlin/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-kotlin/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-kotlin)
|
|
10
10
|
|
|
11
11
|
Kotlin grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
package/grammar.js
CHANGED
|
@@ -155,6 +155,9 @@ module.exports = grammar({
|
|
|
155
155
|
sym('_return_value_position'),
|
|
156
156
|
// valid nowhere, so that an unterminated block comment, which runs to the end of the input, is an error
|
|
157
157
|
sym('_unterminated_block_comment'),
|
|
158
|
+
sym('_getter_separator'),
|
|
159
|
+
sym('_setter_separator'),
|
|
160
|
+
sym('_accessor_parameters_position'),
|
|
158
161
|
],
|
|
159
162
|
|
|
160
163
|
inline: ($) => [$._statements, $._identifier, $._control_structure_body, $._non_function_type],
|
|
@@ -281,7 +284,14 @@ module.exports = grammar({
|
|
|
281
284
|
optional($.type_constraints),
|
|
282
285
|
optional(choice(seq('=', $.expression), $.property_delegate)),
|
|
283
286
|
optional(';'),
|
|
284
|
-
optional(
|
|
287
|
+
optional(
|
|
288
|
+
choice(
|
|
289
|
+
seq($.getter, optional($.setter)),
|
|
290
|
+
seq($.setter, optional($.getter)),
|
|
291
|
+
seq(alias($._expression_getter, $.getter), sym('_setter_separator'), $.setter),
|
|
292
|
+
seq(alias($._expression_setter, $.setter), sym('_getter_separator'), $.getter)
|
|
293
|
+
)
|
|
294
|
+
)
|
|
285
295
|
)
|
|
286
296
|
),
|
|
287
297
|
|
|
@@ -428,33 +438,36 @@ module.exports = grammar({
|
|
|
428
438
|
// last operand of an operator (`B by a ?: b { … }`): the scanner ends the expression before it.
|
|
429
439
|
explicit_delegation: ($) => seq($.type, 'by', $.expression, optional(sym('_delegation_end'))),
|
|
430
440
|
|
|
431
|
-
getter: ($) =>
|
|
432
|
-
prec.right(
|
|
433
|
-
seq(optional($.modifiers), 'get', optional(seq('(', ')', optional(seq(':', $.type)), $.function_body)))
|
|
434
|
-
),
|
|
441
|
+
getter: ($) => prec.right(seq(optional($.modifiers), 'get', optional(seq($._getter_parameters, $.function_body)))),
|
|
435
442
|
|
|
436
|
-
setter: ($) =>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
)
|
|
453
|
-
)
|
|
454
|
-
)
|
|
443
|
+
setter: ($) => prec.right(seq(optional($.modifiers), 'set', optional(seq($._setter_parameters, $.function_body)))),
|
|
444
|
+
|
|
445
|
+
_getter_parameters: ($) =>
|
|
446
|
+
seq(optional(sym('_accessor_parameters_position')), '(', ')', optional(seq(':', $.type))),
|
|
447
|
+
|
|
448
|
+
_setter_parameters: ($) =>
|
|
449
|
+
seq(
|
|
450
|
+
optional(sym('_accessor_parameters_position')),
|
|
451
|
+
'(',
|
|
452
|
+
optional($.parameter_modifiers),
|
|
453
|
+
$.identifier,
|
|
454
|
+
optional(seq(':', $.type)),
|
|
455
|
+
optional(seq('=', $.expression)),
|
|
456
|
+
optional(','),
|
|
457
|
+
')',
|
|
458
|
+
optional(seq(':', $.type))
|
|
455
459
|
),
|
|
456
460
|
|
|
457
|
-
|
|
461
|
+
// Kotlin's parseFunctionBody consumes a semicolon after an expression body, but leaves it after a block body.
|
|
462
|
+
_expression_getter: ($) =>
|
|
463
|
+
seq(optional($.modifiers), 'get', $._getter_parameters, alias($._expression_body, $.function_body)),
|
|
464
|
+
|
|
465
|
+
_expression_setter: ($) =>
|
|
466
|
+
seq(optional($.modifiers), 'set', $._setter_parameters, alias($._expression_body, $.function_body)),
|
|
467
|
+
|
|
468
|
+
function_body: ($) => choice($.block, $._expression_body),
|
|
469
|
+
|
|
470
|
+
_expression_body: ($) => seq('=', $.expression),
|
|
458
471
|
|
|
459
472
|
block: ($) => seq('{', sym('_open_statements'), optional($._statements), '}', sym('_close_braces')),
|
|
460
473
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-kotlin",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.3",
|
|
4
4
|
"description": "Kotlin grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kotlin",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"verify-full": "bun wb verify --full"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@tsconfig/bun": "1.0.
|
|
46
|
+
"@tsconfig/bun": "1.0.12",
|
|
47
47
|
"@types/bun": "1.4.4",
|
|
48
48
|
"@vitest/browser-playwright": "5.1.0",
|
|
49
49
|
"@willbooster/oxlint-config": "1.4.9",
|
|
50
|
-
"@willbooster/wb": "23.
|
|
50
|
+
"@willbooster/wb": "23.4.1",
|
|
51
51
|
"@willbooster/web-tree-sitter": "23.0.0",
|
|
52
52
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
53
53
|
"lefthook": "2.2.2",
|
|
54
|
-
"oxlint": "1.
|
|
55
|
-
"oxlint-tsgolint": "7.0.
|
|
56
|
-
"playwright": "1.65.
|
|
54
|
+
"oxlint": "1.93.0",
|
|
55
|
+
"oxlint-tsgolint": "7.0.2007",
|
|
56
|
+
"playwright": "1.65.1",
|
|
57
57
|
"semantic-release": "25.0.9",
|
|
58
|
-
"vite": "8.3.
|
|
58
|
+
"vite": "8.3.8",
|
|
59
59
|
"vitest": "5.1.0",
|
|
60
60
|
"wrangler": "4.156.0"
|
|
61
61
|
},
|
package/tree-sitter-kotlin.wasm
CHANGED
|
Binary file
|