Ejemplo n.º 1
0
        public override IEnumerable <ResultTree> Run()
        {
            if (this.Value.Any())
            {
                var head = this.Value.First().Run();
                var tail = new GroupExpression(this.Value.Skip(1)).Run();

                return(head.SelectMany(child => concat(child, tail)));
            }
            else
            {
                return(EnumerableExt.Yield <ResultTree>(null));
            }
Ejemplo n.º 2
0
 static IEnumerable <ResultTree> concat(ResultTree head, IEnumerable <ResultTree> tail)
 {
     if (head is null)
     {
         return(tail);
     }
     else if (head is StructureResultTree c)
     {
         return(EnumerableExt.Yield(new StructureResultTree(c.Name,
                                                            c.FirstChild,
                                                            c.NextSibling.SelectMany(x => concat(x, tail)))));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Ejemplo n.º 3
0
 public override IEnumerable <ResultTree> Run()
 {
     yield return(new StructureResultTree(this.Name, this.Value.Run(), EnumerableExt.Yield <ResultTree>(null)));
 }