Exemple #1
0
        static void inner_print(StringBuilder builder, ParsingTreeNode node, string indent, bool last)
        {
            builder.Append(indent);
            if (last)
            {
                builder.Append("+-");
                indent += "  ";
            }
            else
            {
                builder.Append("|-");
                indent += "| ";
            }

            if (node.Childs.Count == 0)
            {
                builder.Append(node.Production + " " + node.Contents + "\r\n");
            }
            else
            {
                builder.Append(node.Production + "\r\n");
            }
            for (int i = 0; i < node.Childs.Count; i++)
            {
                inner_print(builder, node.Childs[i], indent, i == node.Childs.Count - 1);
            }
        }
Exemple #2
0
 public ParsingTree(ParsingTreeNode root)
 {
     this.root = root;
 }