Correctly handle EOF after unmatched backtick (#1187)

This commit is contained in:
Jen Basch authored and GitHub committed 2025-08-25 14:31:26 -07:00
1 parent b32039a4f1
commit a8806416b9
5 files changed
+31 -2

No files matched your search

@@ -489,7 +489,7 @@ public class Lexer {
}
private void lexQuotedIdentifier() {
while (lookahead != '`' && lookahead != '\n' && lookahead != '\r') {
while (lookahead != '`' && lookahead != '\n' && lookahead != '\r' && lookahead != EOF) {
nextChar();
}
if (lookahead == '`') {
@@ -705,6 +705,13 @@ public class Lexer {
}
private ParserError unexpectedChar(char got, String didYouMean) {
if (got == EOF) {
return unexpectedChar("EOF", didYouMean);
}
return lexError("unexpectedCharacter", got, didYouMean);
}
private ParserError unexpectedChar(String got, String didYouMean) {
return lexError("unexpectedCharacter", got, didYouMean);
}