summaryrefslogtreecommitdiff
path: root/src/parser/antlr_input.cpp
diff options
context:
space:
mode:
authorChristopher L. Conway <christopherleeconway@gmail.com>2010-05-26 17:53:33 +0000
committerChristopher L. Conway <christopherleeconway@gmail.com>2010-05-26 17:53:33 +0000
commitcb5cc82b18503783f4433170bbd61b4db752a6dc (patch)
tree7d279c575b9ed31cb0ddc1a36a520dfe3eef9bf3 /src/parser/antlr_input.cpp
parent2635899db4a7622a206e2ec562d01e3337a92199 (diff)
Prevent lexer errors being raised if a parser error is pending.
This fixes a bug Dejan has often whined about but never filed.
Diffstat (limited to 'src/parser/antlr_input.cpp')
-rw-r--r--src/parser/antlr_input.cpp8
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)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback