summaryrefslogtreecommitdiff
path: root/src/lexer.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-01-08 10:00:08 -0800
committerPreston Pan <preston@nullring.xyz>2023-01-08 10:00:08 -0800
commitaa1dd020edb82f26dd5bc29378177cfcaa4c53ed (patch)
tree4785b6311ac14be5939d33ebb5b0d8988c8f56bd /src/lexer.c
parent8edafecb633fec2b6327d996c1e7c282f4f1792f (diff)
print functions completed
Diffstat (limited to 'src/lexer.c')
-rw-r--r--src/lexer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lexer.c b/src/lexer.c
index 29c6542..e58197a 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -26,7 +26,7 @@ lexer_t *init_lexer(char *source) {
}
void lexer_move(lexer_t *lexer) {
- if (lexer->c != '\0') {
+ if (lexer->c != '\0' && lexer->c != EOF) {
lexer->i++;
lexer->c = lexer->source[lexer->i];
if (lexer->c == '\n') {
@@ -39,7 +39,7 @@ void lexer_move(lexer_t *lexer) {
void lexer_ignore_whitespace(lexer_t *lexer) {
while (isspace(lexer->c)) {
- if (lexer->c == '\0')
+ if (lexer->c == '\0' || lexer->c == EOF)
return;
lexer_move(lexer);
}