Antlr4.Runtime.Tree.Trees.ToStringTree C# (CSharp) Метод

ToStringTree() публичный статический Метод

Print out a whole tree in LISP form.
Print out a whole tree in LISP form. GetNodeText(ITree, Antlr4.Runtime.Parser) is used on the node payloads to get the text for the nodes. Detect parse trees and extract data appropriately.
public static ToStringTree ( ITree t, IList ruleNames ) : string
t ITree
ruleNames IList
Результат string
        public static string ToStringTree(ITree t, IList<string> ruleNames)
        {
            string s = Utils.EscapeWhitespace(GetNodeText(t, ruleNames), false);
            if (t.ChildCount == 0)
            {
                return s;
            }
            StringBuilder buf = new StringBuilder();
            buf.Append("(");
            s = Utils.EscapeWhitespace(GetNodeText(t, ruleNames), false);
            buf.Append(s);
            buf.Append(' ');
            for (int i = 0; i < t.ChildCount; i++)
            {
                if (i > 0)
                {
                    buf.Append(' ');
                }
                buf.Append(ToStringTree(t.GetChild(i), ruleNames));
            }
            buf.Append(")");
            return buf.ToString();
        }

Same methods

Trees::ToStringTree ( ITree t ) : string
Trees::ToStringTree ( ITree t, Parser recog ) : string