public final ATNConfig transform(@NotNull ATNState state, boolean checkNonGreedy) { return transform(state, this.context, this.getSemanticContext(), checkNonGreedy, this.getLexerActionExecutor()); }
public final ATNConfig transform(@NotNull ATNState state, @NotNull SemanticContext semanticContext, boolean checkNonGreedy) { return transform(state, this.context, semanticContext, checkNonGreedy, this.getLexerActionExecutor()); }
public final ATNConfig transform(@NotNull ATNState state, @Nullable PredictionContext context, boolean checkNonGreedy) { return transform(state, context, this.getSemanticContext(), checkNonGreedy, this.getLexerActionExecutor()); }
public boolean equals(ATNConfig other) { if (this == other) { return true; } else if (other == null) { return false; } return this.getState().stateNumber==other.getState().stateNumber && this.getAlt()==other.getAlt() && this.getReachesIntoOuterContext() == other.getReachesIntoOuterContext() && this.getContext().equals(other.getContext()) && this.getSemanticContext().equals(other.getSemanticContext()) && this.isPrecedenceFilterSuppressed() == other.isPrecedenceFilterSuppressed() && this.hasPassedThroughNonGreedyDecision() == other.hasPassedThroughNonGreedyDecision() && ObjectEqualityComparator.INSTANCE.equals(this.getLexerActionExecutor(), other.getLexerActionExecutor()); }
/** 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); }
@Override public int hashCode() { int hashCode = MurmurHash.initialize(7); hashCode = MurmurHash.update(hashCode, getState().stateNumber); hashCode = MurmurHash.update(hashCode, getAlt()); hashCode = MurmurHash.update(hashCode, getReachesIntoOuterContext() ? 1 : 0); hashCode = MurmurHash.update(hashCode, getContext()); hashCode = MurmurHash.update(hashCode, getSemanticContext()); hashCode = MurmurHash.update(hashCode, hasPassedThroughNonGreedyDecision() ? 1 : 0); hashCode = MurmurHash.update(hashCode, getLexerActionExecutor()); hashCode = MurmurHash.finish(hashCode, 7); return hashCode; }
ATNState target = getReachableTarget(trans, t); if ( target!=null ) { LexerActionExecutor lexerActionExecutor = c.getLexerActionExecutor(); if (lexerActionExecutor != null) { lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index() - startIndex);
LexerActionExecutor lexerActionExecutor = LexerActionExecutor.append(config.getLexerActionExecutor(), atn.lexerActions[((ActionTransition)t).actionIndex]); c = config.transform(t.target, lexerActionExecutor, true); break;