From cb5cc82b18503783f4433170bbd61b4db752a6dc Mon Sep 17 00:00:00 2001 From: "Christopher L. Conway" Date: Wed, 26 May 2010 17:53:33 +0000 Subject: [PATCH] Prevent lexer errors being raised if a parser error is pending. This fixes a bug Dejan has often whined about but never filed. --- src/parser/antlr_input.cpp | 8 ++++++-- 1 file 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) -- 2.30.2