diff options
| author | Mustafa Quraish <[email protected]> | 2022-01-29 12:29:39 -0500 |
|---|---|---|
| committer | Mustafa Quraish <[email protected]> | 2022-01-29 12:29:39 -0500 |
| commit | e44a59e1c8428a4fbd704f405b21f3e73c89deab (patch) | |
| tree | e980b1835361afc3ee6b6f55f25582ae108cd4a4 | |
| parent | Add separator in `die_location()` (diff) | |
| download | cup-e44a59e1c8428a4fbd704f405b21f3e73c89deab.tar.xz cup-e44a59e1c8428a4fbd704f405b21f3e73c89deab.zip | |
Restore line/col count in Lexer_peek to get correct locations
| -rw-r--r-- | cup/lexer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cup/lexer.c b/cup/lexer.c index 3398599..fcfe005 100644 --- a/cup/lexer.c +++ b/cup/lexer.c @@ -218,7 +218,11 @@ Token Lexer_next(Lexer *lexer) Token Lexer_peek(Lexer *lexer) { i64 pos = lexer->pos; + i64 col = lexer->col; + i64 line = lexer->line; Token token = Lexer_next(lexer); lexer->pos = pos; + lexer->col = col; + lexer->line = line; return token; }
\ No newline at end of file |