Skip to content

Commit

Permalink
Merge pull request #60 from ErwannLesech/fix_curr_tok
Browse files Browse the repository at this point in the history
fix<lexer_peek>: fixing curr_tok in lexer_peek
  • Loading branch information
majerugo authored Jan 17, 2024
2 parents 09b2c40 + 5b8e06b commit ad03673
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lexer/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ struct token parse_input_for_tok(struct lexer *lexer)
struct token lexer_peek(struct lexer *lexer)
{
size_t save_index = lexer->index;
struct token save_token = lexer->curr_tok;
if (lexer->curr_tok.type == TOKEN_EOF)
{
struct token token;
Expand All @@ -301,6 +302,7 @@ struct token lexer_peek(struct lexer *lexer)
}
struct token token = parse_input_for_tok(lexer);
lexer->index = save_index;
lexer->curr_tok = save_token;
return token;
}

Expand Down

0 comments on commit ad03673

Please sign in to comment.