From: Christopher L. Conway Date: Wed, 26 May 2010 17:53:33 +0000 (+0000) Subject: Prevent lexer errors being raised if a parser error is pending. X-Git-Tag: cvc5-1.0.0~9051 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb5cc82b18503783f4433170bbd61b4db752a6dc;p=cvc5.git Prevent lexer errors being raised if a parser error is pending. This fixes a bug Dejan has often whined about but never filed. --- 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)