Skip to content

Commit

Permalink
Add a custom lexer error
Browse files Browse the repository at this point in the history
  • Loading branch information
QuickWrite committed Nov 24, 2024
1 parent 4662edf commit d8970f7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lexer.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "lexer.h"
#include "error.h"

#include <assert.h>
#include <ctype.h>
Expand Down Expand Up @@ -133,10 +134,8 @@ void next_token(struct Lexer* const lexer) {
break;
}

assert(0 && "A token that does not exist was being parsed.");

// Something went wrong
break;
print_parser_error(lexer->fptr, lexer->file_name, "Lexer Error", "Cannot decypher this token.");
exit(5);
}

lexer->curr_token = lexer->next_token;
Expand Down

0 comments on commit d8970f7

Please sign in to comment.