Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.0.8
-
None
-
None
Description
Problem descriptions:
When an unexpected error is caught by the Groovy parser then the error strategy reports the error message into standard error output.
System.err.println("unknown recognition error type: " + e.getClass().getName());
But we want to handle this error in our way (not into terminal) but we can do nothing now.
public class DefaultErrorStrategy implements ANTLRErrorStrategy { public void reportError(Parser recognizer, RecognitionException e) { if (!this.inErrorRecoveryMode(recognizer)) { this.beginErrorCondition(recognizer); if (e instanceof NoViableAltException) { this.reportNoViableAlternative(recognizer, (NoViableAltException)e); } else if (e instanceof InputMismatchException) { this.reportInputMismatch(recognizer, (InputMismatchException)e); } else if (e instanceof FailedPredicateException) { this.reportFailedPredicate(recognizer, (FailedPredicateException)e); } else { System.err.println("unknown recognition error type: " + e.getClass().getName()); this.notifyErrorListeners(recognizer, e.getMessage(), e); } } } }
Expected result:
Remove writing into standard error output by deletion of this line:
System.err.println("unknown recognition error type: " + e.getClass().getName());
Or we would like to be able to change strategy or turn it off