@Override public PredictionContext appendContext(int returnContext, PredictionContextCache contextCache) { return contextCache.getChild(this, returnContext); }
@Override public PredictionContext appendContext(PredictionContext suffix, PredictionContextCache contextCache) { return contextCache.getChild(parent.appendContext(suffix, contextCache), returnState); }
@NotNull protected ATNConfig ruleTransition(@NotNull ATNConfig config, @NotNull RuleTransition t, @Nullable PredictionContextCache contextCache) { if ( debug ) { System.out.println("CALL rule "+getRuleName(t.target.ruleIndex)+ ", ctx="+config.getContext()); } ATNState returnState = t.followState; PredictionContext newContext; if (optimize_tail_calls && t.optimizedTailCall && (!tail_call_preserves_sll || !PredictionContext.isEmptyLocal(config.getContext()))) { newContext = config.getContext(); } else if (contextCache != null) { newContext = contextCache.getChild(config.getContext(), returnState.stateNumber); } else { newContext = config.getContext().getChild(returnState.stateNumber); } return config.transform(t.target, newContext, false); }