예제 #1
0
        public IEnumerable <GrammarRule> AncestorRules(GrammarRule rule)
        {
            var parents = ParentRules(rule).ToList();

            return(parents.Concat(parents.SelectMany(AncestorRules)).Distinct());
        }
예제 #2
0
 public bool IsLeaf(GrammarRule rule)
 {
     return(!Rules.Any(r => r.Parents.Contains(rule.Nonterminal)));
 }
예제 #3
0
 public IEnumerable <GrammarRule> ParentRules(GrammarRule rule)
 {
     return(Rules.Where(r => rule.Parents.Contains(r.Nonterminal)));
 }