List of usage examples for org.antlr.v4.runtime Token EPSILON
int EPSILON
To view the source code for org.antlr.v4.runtime Token EPSILON.
Click Source Link
From source file:com.sample.JavaErrorStrategy.java
License:BSD License
@NotNull protected IntervalSet getErrorRecoverySet(@NotNull Parser recognizer) { ATN atn = recognizer.getInterpreter().atn; RuleContext ctx = recognizer.getContext(); IntervalSet recoverSet = new IntervalSet(); while (ctx != null && ctx.invokingState >= 0) { // compute what follows who invoked us ATNState invokingState = atn.states.get(ctx.invokingState); RuleTransition rt = (RuleTransition) invokingState.transition(0); IntervalSet follow = atn.nextTokens(rt.followState); recoverSet.addAll(follow);/*www . j av a 2 s.co m*/ ctx = ctx.parent; } recoverSet.remove(Token.EPSILON); // System.out.println("recover set "+recoverSet.toString(recognizer.getTokenNames())); return recoverSet; }