@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-kotlin",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "Kotlin grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -3129,6 +3129,10 @@
3129
3129
  "type": "is",
3130
3130
  "named": false
3131
3131
  },
3132
+ {
3133
+ "type": "keyword_reference_end",
3134
+ "named": false
3135
+ },
3132
3136
  {
3133
3137
  "type": "label",
3134
3138
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "1.6.4",
16
+ "version": "1.6.5",
17
17
  "license": "MIT",
18
18
  "description": "Kotlin grammar for tree-sitter",
19
19
  "authors": [