public void sync(Parser recognizer) throws RecognitionException {ATNState s = recognizer.getInterpreter().atn.states.get(recognizer.getState());if (inErrorRecoveryMode(recognizer)) {return;}TokenStream tokens = recognizer.getInputStream();int la = tokens.LA(1);IntervalSet nextTokens = recognizer.getATN().nextTokens(s);if (nextTokens.contains(la)) {nextTokensContext = null;nextTokensState = ATNState.INVALID_STATE_NUMBER;return;}if (nextTokens.contains(Token.EPSILON)) {if (nextTokensContext == null) {nextTokensContext = recognizer.getContext();nextTokensState = recognizer.getState();}return;}switch (s.getStateType()) {case ATNState.BLOCK_START:case ATNState.STAR_BLOCK_START:case ATNState.PLUS_BLOCK_START:case ATNState.STAR_LOOP_ENTRY:if ( singleTokenDeletion(recognizer)!=null ) {return;}throw new InputMismatchException(recognizer);case ATNState.PLUS_LOOP_BACK:case ATNState.STAR_LOOP_BACK:reportUnwantedToken(recognizer);IntervalSet expecting = recognizer.getExpectedTokens();IntervalSet whatFollowsLoopIterationOrRule =expecting.or(getErrorRecoverySet(recognizer));consumeUntil(recognizer, whatFollowsLoopIterationOrRule);break;default:break;}}
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;}}}