public final LexerActionExecutor getLexerActionExecutor() { if (acceptStateInfo == null) { return null; } return acceptStateInfo.getLexerActionExecutor(); }
public final int getPrediction() { if (acceptStateInfo == null) { return ATN.INVALID_ALT_NUMBER; } return acceptStateInfo.getPrediction(); }
/** Add a new DFA state if there isn't one with this set of configurations already. This method also detects the first configuration containing an ATN rule stop state. Later, when traversing the DFA, we will know which rule to accept. */ @NotNull protected DFAState addDFAState(@NotNull ATNConfigSet configs) { /* the lexer evaluates predicates on-the-fly; by this point configs * should not contain any configurations with unevaluated predicates. */ assert !configs.hasSemanticContext(); DFAState proposed = new DFAState(atn.modeToDFA[mode], configs); DFAState existing = atn.modeToDFA[mode].states.get(proposed); if ( existing!=null ) return existing; configs.optimizeConfigs(this); DFAState newState = new DFAState(atn.modeToDFA[mode], configs.clone(true)); ATNConfig firstConfigWithRuleStopState = null; for (ATNConfig c : configs) { if ( c.getState() instanceof RuleStopState ) { firstConfigWithRuleStopState = c; break; } } if ( firstConfigWithRuleStopState!=null ) { int prediction = atn.ruleToTokenType[firstConfigWithRuleStopState.getState().ruleIndex]; LexerActionExecutor lexerActionExecutor = firstConfigWithRuleStopState.getLexerActionExecutor(); newState.setAcceptState(new AcceptStateInfo(prediction, lexerActionExecutor)); } return atn.modeToDFA[mode].addState(newState); }
int predictedAlt = getUniqueAlt(configs); if ( predictedAlt!=ATN.INVALID_ALT_NUMBER ) { newState.setAcceptState(new AcceptStateInfo(predictedAlt)); } else if (configs.getConflictingAlts() != null) { newState.setAcceptState(new AcceptStateInfo(newState.configs.getConflictingAlts().nextSetBit(0)));