1
0
forked from Mirror/wren

Don't double report lexer errors.

This commit is contained in:
Bob Nystrom
2015-01-04 13:10:46 -08:00
parent 09bb28735c
commit 52bd38f3bd

View File

@ -291,6 +291,11 @@ static void error(Compiler* compiler, const char* format, ...)
compiler->parser->hasError = true;
Token* token = &compiler->parser->previous;
// If the parse error was caused by an error token, the lexer has already
// reported it.
if (token->type == TOKEN_ERROR) return;
fprintf(stderr, "[%s line %d] Error on ",
compiler->parser->sourcePath->value, token->line);