text: 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;}}