protected ATNConfigSet RemoveAllConfigsNotInRuleStopState(ATNConfigSet configSet, bool lookToEndOfRule)
{
if (PredictionMode.AllConfigsInRuleStopStates(configSet.configs))
{
return configSet;
}
ATNConfigSet result = new ATNConfigSet(configSet.fullCtx);
foreach (ATNConfig config in configSet.configs)
{
if (config.state is RuleStopState)
{
result.Add(config, mergeCache);
continue;
}
if (lookToEndOfRule && config.state.OnlyHasEpsilonTransitions)
{
IntervalSet nextTokens = atn.NextTokens(config.state);
if (nextTokens.Contains(TokenConstants.EPSILON))
{
ATNState endOfRuleState = atn.ruleToStopState[config.state.ruleIndex];
result.Add(new ATNConfig(config, endOfRuleState), mergeCache);
}
}
}
return result;
}