ParseTrees.java 文件源码

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

项目:goworks 作者:
/**
 * Gets whether or not {@code a} starts after the start of {@code b}.
 *
 * @param a The first tree.
 * @param b The second tree.
 * @return {@code true} if {@code a} starts after the start of {@code b}, otherwise {@code false}.
 */
public static boolean startsAfterStartOf(@NonNull ParseTree a, @NonNull ParseTree b) {
    //TerminalNode<? extends Token> startNodeA = getStartNode(a);
    //TerminalNode<? extends Token> startNodeB = getStartNode(b);
    //if (startNodeA == null || startNodeB == null) {
    //    throw new NotImplementedException();
    //}

    Interval sourceIntervalA = a.getSourceInterval();
    Interval sourceIntervalB = b.getSourceInterval();

    //if (sourceIntervalA.a == sourceIntervalB.a) {
    //    if (isAncestorOf(a, b)) {
    //        return true;
    //    }
    //
    //    if (isEpsilon(a) || isEpsilon(b)) {
    //        // b could be a child of a later sibling of some ancestor of a
    //        throw new NotImplementedException();
    //    }
    //}

    return sourceIntervalA.a > sourceIntervalB.a;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号