StringCreatingVisitor.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:Cetus 作者:
public String visitChildren(RuleNode node) {
int n = node.getChildCount();
if (n > 1) {
    StringBuilder result = new StringBuilder();
    ParseTree child;
    String childResult;
    for (int i = 0; i < n; i++) {
    child = node.getChild(i);
    childResult = child.accept(this);
    if (childResult != null) {
        if (i > 0) {
        result.append(' ');
        }
        result.append(childResult);
    }
    }
    return result.toString();
} else {
    if (n == 1) {
    return node.getChild(0).accept(this);
    } else {
    return node.getText();
    }
}
   }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号