-
Enclosing class:
-
GrammarParserInterpreter
public static class GrammarParserInterpreter.BailButConsumeErrorStrategy
extends DefaultErrorStrategy
We want to stop and track the first error but we cannot bail out like
BailErrorStrategy as consume() constructs trees. We make sure to create an error node during recovery with this strategy. We consume() 1 token during the "bail out of rule" mechanism in recover() and let it fall out of the rule to finish constructing trees. For recovery in line, we throw InputMismatchException to engage recover().