text: public virtual void Sync(Parser recognizer){ATNState s = recognizer.Interpreter.atn.states[recognizer.State];if (InErrorRecoveryMode(recognizer)){return;}ITokenStream tokens = ((ITokenStream)recognizer.InputStream);int la = tokens.LA(1);var nextTokens = recognizer.Atn.NextTokens(s);if (nextTokens.Contains(TokenConstants.EPSILON) || nextTokens.Contains(la)){return;}switch (s.StateType){case StateType.BlockStart:case StateType.StarBlockStart:case StateType.PlusBlockStart:case StateType.StarLoopEntry:{if (SingleTokenDeletion(recognizer) != null){return;}throw new InputMismatchException(recognizer);}case StateType.PlusLoopBack:case StateType.StarLoopBack:{ReportUnwantedToken(recognizer);IntervalSet expecting = recognizer.GetExpectedTokens();IntervalSet whatFollowsLoopIterationOrRule = expecting.Or(GetErrorRecoverySet(recognizer));ConsumeUntil(recognizer, whatFollowsLoopIterationOrRule);break;}default:{break;}}}