mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Bugfix when strings are unterminated
This commit is contained in:
@@ -36,7 +36,6 @@ static void advance(Parser* parser) {
|
|||||||
|
|
||||||
if (parser->current.type == TOKEN_ERROR) {
|
if (parser->current.type == TOKEN_ERROR) {
|
||||||
error(parser, parser->current, "Lexer error");
|
error(parser, parser->current, "Lexer error");
|
||||||
printf(parser->lexer->source);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,10 +145,19 @@ static Opcode compound(Parser* parser, Node** nodeHandle, bool canBeAssigned) {
|
|||||||
//store the left
|
//store the left
|
||||||
parsePrecedence(parser, &left, PREC_PRIMARY);
|
parsePrecedence(parser, &left, PREC_PRIMARY);
|
||||||
|
|
||||||
|
if (!left) { //error
|
||||||
|
return OP_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
//detect a dictionary
|
//detect a dictionary
|
||||||
if (match(parser, TOKEN_COLON)) {
|
if (match(parser, TOKEN_COLON)) {
|
||||||
parsePrecedence(parser, &right, PREC_PRIMARY);
|
parsePrecedence(parser, &right, PREC_PRIMARY);
|
||||||
|
|
||||||
|
if (!right) { //error
|
||||||
|
freeNode(left);
|
||||||
|
return OP_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
//check we ARE defining a dictionary
|
//check we ARE defining a dictionary
|
||||||
if (array) {
|
if (array) {
|
||||||
error(parser, parser->previous, "Incorrect detection between array and dictionary");
|
error(parser, parser->previous, "Incorrect detection between array and dictionary");
|
||||||
|
|||||||
Reference in New Issue
Block a user