diff options
Diffstat (limited to 'Parser/pegen_errors.c')
-rw-r--r-- | Parser/pegen_errors.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Parser/pegen_errors.c b/Parser/pegen_errors.c index 694184a..93057d1 100644 --- a/Parser/pegen_errors.c +++ b/Parser/pegen_errors.c @@ -399,7 +399,7 @@ _Pypegen_set_syntax_error(Parser* p, Token* last_token) { RAISE_SYNTAX_ERROR("error at start before reading any input"); } // Parser encountered EOF (End of File) unexpectedtly - if (p->tok->done == E_EOF) { + if (last_token->type == ERRORTOKEN && p->tok->done == E_EOF) { if (p->tok->level) { raise_unclosed_parentheses_error(p); } else { @@ -422,4 +422,4 @@ _Pypegen_set_syntax_error(Parser* p, Token* last_token) { // _PyPegen_tokenize_full_source_to_check_for_errors will override the existing // generic SyntaxError we just raised if errors are found. _PyPegen_tokenize_full_source_to_check_for_errors(p); -}
\ No newline at end of file +} |