Fixed issue: Invalid escape sequences in string literals not raising errors (e.g. \q)

This commit is contained in:
UnlegitDqrk
2026-03-01 19:11:18 +01:00
parent 86e4d78761
commit 364dbecb17
2 changed files with 19 additions and 5 deletions

View File

@@ -552,9 +552,12 @@ public class LexState extends Constants {
continue;
}
default: {
if (!isdigit(current))
save_and_next(); /* handles \\, \", \', and \? */
else { /* \xxx */
if (!isdigit(current)) {
if (current == '\\' || current == '"' || current == '\'')
save_and_next();
else
lexerror("invalid escape sequence", TK_STRING);
} else { /* \xxx */
int i = 0;
c = 0;
do {
@@ -2150,4 +2153,4 @@ public class LexState extends Constants {
/* }====================================================================== */
}
}