@CheckForNull
public static RuleNode findAncestor(@NonNull ParseTree tree, @NonNull BitSet ruleIndexes) {
for (ParseTree current = tree; current != null; current = current.getParent()) {
if (!(current instanceof RuleNode)) {
continue;
}
RuleNode ruleNode = (RuleNode)current;
int ruleIndex = ruleNode.getRuleContext().getRuleIndex();
if (ruleIndex < 0) {
continue;
}
if (ruleIndexes.get(ruleIndex)) {
return ruleNode;
}
}
return null;
}
ParseTrees.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:antlrworks2
作者:
评论列表
文章目录