Skip to content

Commit

Permalink
Merge pull request #40 from adamhutchings/token
Browse files Browse the repository at this point in the history
Replace all getc/ungetc with new wrapper
  • Loading branch information
adamhutchings authored Jun 27, 2024
2 parents ee74ecb + 8910d5a commit 78017c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lexer/lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ int real_lex(Lexer *l, Token *t) {
// return./
if (starts_operator(init)) {
while (valid_operator_sequence(t->contents)) {
t->contents[pos++] = (c = getc(l->fp));
t->contents[pos++] = (c = lexer_getchar(l->fp));
}
// We've ended!
// Can we reduce this code duplication from above in a smart way?
ungetc(c, l->fp);
lexer_ungetchar(l);
t->contents[pos - 1] = '\0';
t->type = ttype_from_string(t->contents);
t->length = pos;
Expand Down

0 comments on commit 78017c1

Please sign in to comment.