Lexer is not failing with runtime exception for bad input. #3251
Unanswered
mehrotraanand
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While upgrading from ANTLR 4.6 to 4.9.2, we have noticed changed in parser behavior and some text which earlier didn't used to be matched gets matched with no change in grammar.
Some Negative input cases are working with lexer
for example
title eq "Emplyee" 1234
I have overridden sytaxError using
lexer.addErrorListener(new BaseErrorListener() {
@OverRide
public void syntaxError(Recognizer recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
throw new RuntimeException(e);
}
});
as suggested in
https://stackoverflow.com/questions/29834489/is-it-possible-to-throw-an-exception-if-the-input-isnt-valid?noredirect=1&lq=1
On debugging found that Lexer is not failing with runtime exception for bad input.
We use Java for this implementation.
Beta Was this translation helpful? Give feedback.
All reactions