diff options
Diffstat (limited to 'src/lexer.c')
-rw-r--r-- | src/lexer.c | 4 |
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); } |