diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-26 17:53:33 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-26 17:53:33 +0000 |
commit | cb5cc82b18503783f4433170bbd61b4db752a6dc (patch) | |
tree | 7d279c575b9ed31cb0ddc1a36a520dfe3eef9bf3 | |
parent | 2635899db4a7622a206e2ec562d01e3337a92199 (diff) |
Prevent lexer errors being raised if a parser error is pending.
This fixes a bug Dejan has often whined about but never filed.
-rw-r--r-- | src/parser/antlr_input.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parser/antlr_input.cpp b/src/parser/antlr_input.cpp index fc03a2903..300b181a6 100644 --- a/src/parser/antlr_input.cpp +++ b/src/parser/antlr_input.cpp @@ -159,8 +159,12 @@ void AntlrInput::lexerError(pANTLR3_BASE_RECOGNIZER recognizer) { AntlrInput *input = (AntlrInput*) parser->getInput(); AlwaysAssert(input!=NULL); - // Call the error display routine - input->parseError("Error finding next token."); + /* Call the error display routine *if* there's not already a + * parse error pending. If a parser error is pending, this + * error is probably less important, so we just drop it. */ + if( input->d_parser->rec->state->error == ANTLR3_FALSE ) { + input->parseError("Error finding next token."); + } } void AntlrInput::parseError(const std::string& message) |