Allowing a line continuation character of "\" with a newline immediately

after the "\" character.
This commit is contained in:
Rob Greene 2018-07-16 22:16:03 -05:00
parent 070b9371ec
commit b84896c8cf
1 changed files with 7 additions and 0 deletions

View File

@ -145,6 +145,13 @@ public class TokenReader {
ApplesoftKeyword.find(String.format("%c", tokenizer.ttype))
.map(kw -> Token.keyword(line, kw))
.orElse(Token.syntax(line, tokenizer.ttype)));
case '\\':
// Special case: introducing a backslash to ignore the IMMEDIATELY following EOL
// If this does not occur, we simply fall through and fail. That is intentional!
if (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
// Consume the EOL and continue on our merry way
break;
}
default:
throw new IOException(String.format(
"Unknown! ttype=%d, nval=%f, sval=%s\n", tokenizer.ttype, tokenizer.nval, tokenizer.sval));