@willbooster/tree-sitter-kotlin 1.6.4 → 1.6.5
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 +9 -1
- package/package.json +1 -1
- package/src/node-types.json +4 -0
- package/tree-sitter-kotlin.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -121,6 +121,10 @@ module.exports = grammar({
|
|
|
121
121
|
$._top_level_statement_end,
|
|
122
122
|
// empty: it ends a context list of types among modifiers, except directly in a statement list (see `modifiers`)
|
|
123
123
|
$._context_end,
|
|
124
|
+
// a hard keyword other than `this` right after the `$` of a string template (see `_template_name`)
|
|
125
|
+
$._keyword_reference,
|
|
126
|
+
// never scanned: see `_template_name`
|
|
127
|
+
$._keyword_reference_end,
|
|
124
128
|
],
|
|
125
129
|
|
|
126
130
|
inline: ($) => [$._statements, $._identifier, $._control_structure_body],
|
|
@@ -861,7 +865,11 @@ module.exports = grammar({
|
|
|
861
865
|
_template_name: ($) =>
|
|
862
866
|
choice(
|
|
863
867
|
alias(token.immediate(prec(2, /[\p{L}_][\p{L}_\p{Nd}]*/u)), $.identifier),
|
|
864
|
-
alias(token.immediate(prec(2, 'this')), $.this_expression)
|
|
868
|
+
alias(token.immediate(prec(2, 'this')), $.this_expression),
|
|
869
|
+
// As in Kotlin, another hard keyword after `$` is an error: the scanner lexes it, and the grammar then expects
|
|
870
|
+
// `_keyword_reference_end`, which is never scanned. The first alias keeps a name required in `interpolation`; the
|
|
871
|
+
// second makes the end visible when error recovery inserts it as missing, which a hidden token would not be.
|
|
872
|
+
seq(alias($._keyword_reference, $.identifier), alias($._keyword_reference_end, 'keyword_reference_end'))
|
|
865
873
|
),
|
|
866
874
|
|
|
867
875
|
// In a string prefixed with n dollars (Kotlin 2.1), exactly n dollars start an interpolation; the scanner
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
package/tree-sitter-kotlin.wasm
CHANGED
|
Binary file
|