Files
codegraph/docs/grammars/tree-sitter-kotlin.patch
Colby Mchenry 0b74e94ee7 fix(kotlin): no automatic semicolon before a same-line infix e-word (#2173)
tree-sitter-kotlin 0.3.8's external scanner inserted an automatic
semicolon on the same line before any word starting with `e` other than
`else`, so Exposed's `Users.id eq id1` ended its statement early and
error recovery could swallow the class around it (r2dbc UpsertTests
became one loose function nesting every test).

Patch scanner.c (same line: never a semicolon before an e-word) in both
the vendored kernel C and the wasm build; provenance, shas and rebuild
recipe in docs/grammars/tree-sitter-kotlin.md. Exposed files with a parse
error 229 -> 71 of 1,004; koin, nowinandroid, moshi, okio, okhttp and
kotlinx.coroutines unchanged (one okhttp file fixed, none broken);
kernel-parity 0 diffs.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 15:36:22 +00:00

17 lines
592 B
Diff

--- a/src/scanner.c 2026-09-30 10:25:12
+++ b/src/scanner.c 2026-09-30 10:25:12
@@ -285,9 +285,11 @@
if (sameline) {
switch (lexer->lookahead) {
- // Don't insert a semicolon before an else
+ // Don't insert a semicolon before an else — nor before any other word
+ // starting with `e` on the same line: that is an infix call
+ // (`Users.id eq id1`), which continues the expression. (codegraph patch)
case 'e':
- return !scan_for_word(lexer, "lse", 3);
+ return false;
case 'i':
return scan_for_word(lexer, "mport", 5);