/**
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, List<String>)
*/
public static String toStringTree(final Tree t, @Nullable final List<String> ruleNames, final int depth) {
String s = Utils.escapeWhitespace(Trees.getNodeText(t, ruleNames), false);
if (t.getChildCount() == 0) {
return s;
}
final StringBuilder buf = new StringBuilder();
if (depth > 0) {
buf.append(NEWLINE);
}
buf.append(indent(depth));
buf.append("(");
s = Utils.escapeWhitespace(Trees.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, depth + 1));
}
buf.append(")");
return buf.toString();
}
TreeUtils.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:vb6parser
作者:
评论列表
文章目录