Fix CRLF handling in line continuation escapes (#1564)

This commit is contained in:
Kushal Pisavadia authored and GitHub committed 2026-04-29 13:53:55 -07:00
1 parent 39c01c24ba
commit d3a3a14aaa
2 files changed
+58 -2

No files matched your search

@@ -461,11 +461,17 @@ public final class Lexer {
}
case 'u' -> lexUnicodeEscape();
case '\n' -> Token.STRING_ESCAPE_CONTINUATION;
case '\r' -> {
if (lookahead == '\n') {
nextChar();
}
yield Token.STRING_ESCAPE_CONTINUATION;
}
case ' ', '\t' -> {
var c = cursor;
var next = nextChar();
while (next == ' ' || next == '\t') next = nextChar();
if (next == '\n')
if (next == '\n' || next == '\r')
throw lexError(
ErrorMessages.create("invalidLineContinuationEscapeSequenceWhitespace"),
c - 2,