Skip to content

Commit

Permalink
Merge pull request #39 from adamhutchings/l
Browse files Browse the repository at this point in the history
Fix lexer initialization and better printing
NicoBliss authored Jun 26, 2024
2 parents b4b8657 + e252e43 commit 3ed75f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/driver/main.c
Original file line number Diff line number Diff line change
@@ -19,12 +19,13 @@ int lexer_dump(const char* filename) {
}
lexer.fp = fp;
lexer.unlexed_count = 0;
lexer.column = lexer.line = 1;

Token t;
do {
// Return if some non-zero (error) code is returned
if (lex(&lexer, &t)) return 1;
printf("Contents: %20s, type: %20s\n", t.contents, ttype_name(t.type));
printf("Contents: %20s, type: %20s, position: %d/%d\n", t.contents, ttype_name(t.type), t.line, t.column);
} while (t.type != TT_EOF);

return 0;

0 comments on commit 3ed75f9

Please sign in to comment.