mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 10:42:07 +00:00
Handle \\r better
Translate it to \\n regardless of the lexer mode
This commit is contained in:
@@ -1611,9 +1611,7 @@ static int yylex_NORMAL(void)
|
|||||||
/* Handle newlines and EOF */
|
/* Handle newlines and EOF */
|
||||||
|
|
||||||
case '\r':
|
case '\r':
|
||||||
if (peek(0) == '\n')
|
return '\r';
|
||||||
shiftChars(1); /* Shift that EOL */
|
|
||||||
/* fallthrough */
|
|
||||||
case '\n':
|
case '\n':
|
||||||
return '\n';
|
return '\n';
|
||||||
|
|
||||||
@@ -1905,6 +1903,10 @@ restart:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (token == '\r') { /* Handle CR and CRLF line endings */
|
||||||
|
token = '\n'; /* We universally use '\n' as the value for line ending tokens */
|
||||||
|
if (peek(0) == '\n')
|
||||||
|
shiftChars(1); /* Shift the CRLF's LF */
|
||||||
}
|
}
|
||||||
lexerState->lastToken = token;
|
lexerState->lastToken = token;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user