Beispiel #1
0
        public override string ToString()
        {
            string      ret     = "";
            List <Node> toPrint = TopSort.sort(this);
            IEnumerable iter    = toPrint;

            foreach (Node node in iter)
            {
                if (node is BinExprNode)
                {
                    BinExprNode b = (BinExprNode)node;
                    if (b.left != null && b.right != null)
                    {
                        ret += b.left.Name + " " + b.Name + " " + b.right.Name;
                    }
                    else
                    {
                        ret += b.Name;
                    }
                }
                else
                {
                    ret += " " + node.ToString();
                }
            }
            return(ret);
        }
Beispiel #2
0
        public string ToScript()
        {
            string      ret     = "";
            List <Node> toPrint = TopSort.sort(this);
            IEnumerable iter    = toPrint;

            foreach (Node node in iter)
            {
                if (node != null)
                {
                    ret += "\n" + node.ToScript() + ";";
                }
            }
            return(ret);
        }