mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 06:44:07 +10:00
Fixed obscure EOF bug in lexer
This commit is contained in:
@@ -1,26 +1,8 @@
|
||||
|
||||
|
||||
//increment & decrement (prefix)
|
||||
{
|
||||
var a = 42;
|
||||
assert a == 42;
|
||||
assert ++a == 43;
|
||||
assert a == 43;
|
||||
assert --a == 42;
|
||||
assert a == 42;
|
||||
|
||||
print a;
|
||||
}
|
||||
var answer = 42;
|
||||
|
||||
var question: string = "How many roads must a man walk down?";
|
||||
|
||||
//increment & decrement (postfix)
|
||||
{
|
||||
var a = 42;
|
||||
assert a == 42;
|
||||
assert a++ == 42;
|
||||
assert a == 43;
|
||||
assert a-- == 43;
|
||||
assert a == 42;
|
||||
|
||||
print a;
|
||||
}
|
||||
print question;
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user