use of org.eclipse.xtext.serializer.analysis.SerializerPDA.SerializerPDACloneFactory in project xtext-core by eclipse.
the class ContextPDAProvider method filterUnneededUnassignedRuleCalls.
protected Pda<ISerState, RuleCall> filterUnneededUnassignedRuleCalls(Pda<ISerState, RuleCall> pda, Map<ParserRule, Integer> indexedRules) {
Set<ParserRule> exclude = findRuleCallsToExclude(pda, indexedRules);
if (exclude.isEmpty())
return pda;
SerializerPDA filtered = pdaUtil.filter(pda, new Predicate<ISerState>() {
@Override
public boolean apply(ISerState input) {
SerStateType type = input.getType();
if (type == SerStateType.PUSH || type == SerStateType.POP) {
AbstractRule rule = ((RuleCall) input.getGrammarElement()).getRule();
return !exclude.contains(rule);
}
return true;
}
}, new SerializerPDACloneFactory());
return filtered;
}
Aggregations