fix(lexer): now raising error on unmatched quote, rather than crashing

This commit is contained in:
Matteo Flebus 2026-01-19 18:52:23 +01:00
parent 454bd76abc
commit e6bd92af38

View file

@ -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++;
}