Пример #1
0
 public void PostWalk(SortedTreeVisitor visitor)
 {
     foreach (var child in Children)
     {
         child.PostWalk(visitor);
     }
     visitor.Nodes.Add(this);
 }
Пример #2
0
        public PythonNode GetLeftMostDescendant()
        {
            var walker = new SortedTreeVisitor();

            PostWalk(walker);
            if (walker.Nodes.Count == 0)
            {
                throw new Exception("list should not be empty");
            }
            return(walker.Nodes.First());
        }
Пример #3
0
        protected override void GenerateNodes(PythonNode t1, PythonNode t2)
        {
            var visitor = new SortedTreeVisitor();

            t1.PostWalk(visitor);
            A       = visitor.Nodes;
            T1      = Enumerable.Range(1, A.Count).ToArray();
            visitor = new SortedTreeVisitor();
            t2.PostWalk(visitor);
            B  = visitor.Nodes;
            T2 = Enumerable.Range(1, B.Count).ToArray();
        }