Fixed obscure EOF bug in lexer

This commit is contained in:
2025-01-14 12:45:11 +11:00
parent 13daf95933
commit 513d8f130c
2 changed files with 5 additions and 22 deletions

View File

@@ -242,7 +242,6 @@ static Toy_Token makeString(Toy_Lexer* lexer, char terminator) {
while (!isAtEnd(lexer)) {
//stop if you've hit the terminator
if (peek(lexer) == terminator) {
advance(lexer); //eat the terminator
break;
}
@@ -261,6 +260,8 @@ static Toy_Token makeString(Toy_Lexer* lexer, char terminator) {
return makeErrorToken(lexer, "Unterminated string");
}
advance(lexer); //eat the terminator
//make the token
Toy_Token token;