public static String toStringTree(final Tree t, final List<String> ruleNames) {String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);if ( t.getChildCount()==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.getChildCount(); i++) {if ( i>0 ) buf.append(' ');buf.append(toStringTree(t.getChild(i), ruleNames));}buf.append(")");return buf.toString();}

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();}
