From f4aebafe7ae033d6bcde87d71108f488ed4a3251 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 22 Dec 2016 10:39:06 +1100 Subject: [PATCH] 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. --- py/lexer.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/py/lexer.c b/py/lexer.c index 0611a727b..6c8ac9aee 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -128,10 +128,6 @@ STATIC bool is_tail_of_identifier(mp_lexer_t *lex) { } STATIC void next_char(mp_lexer_t *lex) { - if (lex->chr0 == MP_LEXER_EOF) { - return; - } - if (lex->chr0 == '\n') { // a new line ++lex->line;