getErrorRecoverySet method

IntervalSet getErrorRecoverySet(
  1. Parser recognizer
)

Implementation

IntervalSet getErrorRecoverySet(Parser recognizer) {
  final atn = recognizer.interpreter!.atn;
  RuleContext? ctx = recognizer.context;
  final recoverSet = IntervalSet();
  while (ctx != null && ctx.invokingState >= 0) {
    // compute what follows who invoked us
    final invokingState = atn.states[ctx.invokingState]!;
    final rt = invokingState.transition(0) as RuleTransition;
    final follow = atn.nextTokens(rt.followState);
    recoverSet.addAll(follow);
    ctx = ctx.parent;
  }
  recoverSet.remove(Token.EPSILON);
  return recoverSet;
}