public IEnumerable <GrammarRule> AncestorRules(GrammarRule rule) { var parents = ParentRules(rule).ToList(); return(parents.Concat(parents.SelectMany(AncestorRules)).Distinct()); }
public bool IsLeaf(GrammarRule rule) { return(!Rules.Any(r => r.Parents.Contains(rule.Nonterminal))); }
public IEnumerable <GrammarRule> ParentRules(GrammarRule rule) { return(Rules.Where(r => rule.Parents.Contains(r.Nonterminal))); }