Skip to content

Commit f4aebaf

Browse files
committed
py/lexer: Remove unnecessary check for EOF in lexer's next_char func.
This check always fails (ie chr0 is never EOF) because the callers of this function never call it past the end of the input stream. And even if they did it would be harmless because 1) reader.readbyte must continue to return an EOF char if the stream is exhausted; 2) next_char would just count the subsequent EOF's as characters worth 1 column.
1 parent b9c4783 commit f4aebaf

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

py/lexer.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ STATIC bool is_tail_of_identifier(mp_lexer_t *lex) {
128128
}
129129

130130
STATIC void next_char(mp_lexer_t *lex) {
131-
if (lex->chr0 == MP_LEXER_EOF) {
132-
return;
133-
}
134-
135131
if (lex->chr0 == '\n') {
136132
// a new line
137133
++lex->line;

0 commit comments

Comments
 (0)