fix(lexer): now raising error on unmatched quote, rather than crashing
This commit is contained in:
parent
454bd76abc
commit
e6bd92af38
1 changed files with 14 additions and 0 deletions
|
|
@ -291,6 +291,13 @@ struct token *peek_token(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (stream[i] == EOF)
|
||||
{
|
||||
fprintf(stderr, "Lexing error: unmatched quote\n");
|
||||
|
||||
// error handling
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
@ -332,6 +339,13 @@ struct token *pop_token(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (stream[i] == EOF)
|
||||
{
|
||||
fprintf(stderr, "Lexing error: unmatched quote\n");
|
||||
|
||||
// error handling
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue