private void updatePropertiesForMergedConfig(ATNConfig config) { // merged configs can't change the alt or semantic context dipsIntoOuterContext |= config.getReachesIntoOuterContext(); assert !outermostConfigSet || !dipsIntoOuterContext; }
private void updatePropertiesForAddedConfig(ATNConfig config) { if (configs.size() == 1) { uniqueAlt = config.getAlt(); } else if (uniqueAlt != config.getAlt()) { uniqueAlt = ATN.INVALID_ALT_NUMBER; } hasSemanticContext |= !SemanticContext.NONE.equals(config.getSemanticContext()); dipsIntoOuterContext |= config.getReachesIntoOuterContext(); assert !outermostConfigSet || !dipsIntoOuterContext; }
String getStateString(DFAState s) { if (s == ATNSimulator.ERROR) { return "ERROR"; } int n = s.stateNumber; String stateStr = "s"+n; if ( s.isAcceptState() ) { if ( s.predicates!=null ) { stateStr = ":s"+n+"=>"+Arrays.toString(s.predicates); } else { stateStr = ":s"+n+"=>"+s.getPrediction(); } } if ( s.isContextSensitive() ) { stateStr += "*"; for (ATNConfig config : s.configs) { if (config.getReachesIntoOuterContext()) { stateStr += "*"; break; } } } return stateStr; } }
buf.append(getSemanticContext()); if ( getReachesIntoOuterContext() ) { buf.append(",up=").append(getOuterContextDepth());
int maxAlt = 0; for (ATNConfig config : previous.s0.configs) { if (config.getReachesIntoOuterContext() || config.getState() instanceof RuleStopState) { alts.set(config.getAlt()); maxAlt = Math.max(maxAlt, config.getAlt()); if (config.getReachesIntoOuterContext() || config.getState() instanceof RuleStopState) { filteredConfigs.add(config);
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()); }
public boolean add(ATNConfig e, @Nullable PredictionContextCache contextCache) { ensureWritable(); assert !outermostConfigSet || !e.getReachesIntoOuterContext();
@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; }
if (useContext && !c.getReachesIntoOuterContext() || t == IntStream.EOF) { if (skippedStopStates == null) { skippedStopStates = new ArrayList<ATNConfig>();
else if (!config.getReachesIntoOuterContext() && PredictionContext.isEmptyLocal(config.getContext())) {