mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Backslash in normal lexer mode must be a line continuation
Macro args were already handled by `peek`, and character escapes do not exist outside of string literals. This only affects the error message printed when a non-whitespace character comes after the backslash. Instead of "Illegal character escape '%s'", it will print "Begun line continuation, but encountered character '%s'".
This commit is contained in:
@@ -2059,29 +2059,15 @@ static int yylex_NORMAL(void)
|
|||||||
case EOF:
|
case EOF:
|
||||||
return T_EOF;
|
return T_EOF;
|
||||||
|
|
||||||
/* Handle escapes */
|
/* Handle line continuations */
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
c = peek(0);
|
// Macro args were handled by `peek`, and character escapes do not exist
|
||||||
|
// outside of string literals, so this must be a line continuation.
|
||||||
switch (c) {
|
|
||||||
case ' ':
|
|
||||||
case '\r':
|
|
||||||
case '\n':
|
|
||||||
readLineContinuation();
|
readLineContinuation();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOF:
|
/* Handle identifiers... or report garbage characters */
|
||||||
error("Illegal character escape at end of input\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
shiftChars(1);
|
|
||||||
error("Illegal character escape '%s'\n", print(c));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Handle identifiers and escapes... or error out */
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (startsIdentifier(c)) {
|
if (startsIdentifier(c)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user