mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Found a rare lexer bug
This commit is contained in:
@@ -139,7 +139,7 @@ static Token makeIntegerOrFloat(Lexer* lexer) {
|
||||
|
||||
while(isDigit(lexer)) advance(lexer);
|
||||
|
||||
if (peek(lexer) == '.') {
|
||||
if (peek(lexer) == '.' && (peekNext(lexer) >= '0' && peekNext(lexer) <= '9')) { //BUGFIX: peekNext == digit
|
||||
type = TOKEN_LITERAL_FLOAT;
|
||||
advance(lexer);
|
||||
while(isDigit(lexer)) advance(lexer);
|
||||
|
||||
@@ -791,6 +791,11 @@ static Opcode dot(Parser* parser, Node** nodeHandle) {
|
||||
|
||||
parsePrecedence(parser, &node, PREC_CALL);
|
||||
|
||||
if (node == NULL || node->binary.right == NULL) {
|
||||
error(parser, parser->previous, "Expected function call after dot operator");
|
||||
return OP_EOF;
|
||||
}
|
||||
|
||||
//hijack the function call, and hack in an extra parameter
|
||||
node->binary.right->fnCall.argumentCount++;
|
||||
node->binary.opcode = OP_DOT;
|
||||
|
||||
Reference in New Issue
Block a user