mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 06:08:41 +01:00
Fixup Handling of \ in REPL to Prevent Crash
When parsing the string token if a `\` was used it would unconditionally consume the next character. This would led to a token with an invalid lenght causing a crash when it was printed. This fixes that by only consuming the token after the `\` if there is one to consume. Fixes #603
This commit is contained in:
@ -828,7 +828,7 @@ class Lexer {
|
||||
|
||||
if (c == Chars.backslash) {
|
||||
// TODO: Process specific escapes and validate them.
|
||||
advance()
|
||||
if (!isAtEnd) advance()
|
||||
} else if (c == Chars.percent) {
|
||||
// Consume the '('.
|
||||
if (!isAtEnd) advance()
|
||||
|
||||
@ -830,7 +830,7 @@ static const char* replModuleSource =
|
||||
"\n"
|
||||
" if (c == Chars.backslash) {\n"
|
||||
" // TODO: Process specific escapes and validate them.\n"
|
||||
" advance()\n"
|
||||
" if (!isAtEnd) advance()\n"
|
||||
" } else if (c == Chars.percent) {\n"
|
||||
" // Consume the '('.\n"
|
||||
" if (!isAtEnd) advance()\n"
|
||||
|
||||
Reference in New Issue
Block a user