微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode的实例源码

项目:Openjsharp    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null);
    ConsAltNode t = top;

    while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) {
        node = parseExp(term);
        if (node.getType() == NodeType.LIST) {
            t.setCdr((ConsAltNode)node);
            while (((ConsAltNode)node).cdr != null ) {
                node = ((ConsAltNode)node).cdr;
            }

            t = ((ConsAltNode)node);
        } else {
            t.setCdr(ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:Openjsharp    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null);
        ConsAltNode t = top;
        while (token.type == TokenType.ALT) {
            fetchToken();
            node = parseBranch(term);

            t.setCdr(ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:openjdk-jdk10    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:openjdk-jdk10    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:openjdk9    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:openjdk9    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:kaziranga    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:kaziranga    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:lookaside_java-1.8.0-openjdk    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:lookaside_java-1.8.0-openjdk    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:jdk8u_nashorn    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:jdk8u_nashorn    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:infobip-open-jdk-8    文件Parser.java   
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node,null));
            t = t.cdr;
        }
    }
    return top;
}
项目:infobip-open-jdk-8    文件Parser.java   
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:OLD-OpenJDK8    文件Parser.java   
private Node parseBranch(TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    } else {
        ConsAltNode top = ConsAltNode.newListNode(node,null);
        ConsAltNode t = top;

        while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) {
            node = parseExp(term);
            if (node.getType() == NodeType.LIST) {
                t.setCdr((ConsAltNode)node);
                while (((ConsAltNode)node).cdr != null ) node = ((ConsAltNode)node).cdr;

                t = ((ConsAltNode)node);
            } else {
                t.setCdr(ConsAltNode.newListNode(node,null));
                t = t.cdr;
            }
        }
        return top;
    }
}
项目:OLD-OpenJDK8    文件Parser.java   
private Node parseSubExp(TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) parseSubExpError(term);
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:nashorn-backport    文件Parser.java   
private Node parseBranch(TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    } else {
        ConsAltNode top = ConsAltNode.newListNode(node,null));
                t = t.cdr;
            }
        }
        return top;
    }
}
项目:nashorn-backport    文件Parser.java   
private Node parseSubExp(TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) parseSubExpError(term);
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:nashorn    文件Parser.java   
private Node parseBranch(TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    } else {
        ConsAltNode top = ConsAltNode.newListNode(node,null));
                t = t.cdr;
            }
        }
        return top;
    }
}
项目:nashorn    文件Parser.java   
private Node parseSubExp(TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        ConsAltNode top = ConsAltNode.newAltNode(node,null));
            t = t.cdr;
        }

        if (token.type != term) parseSubExpError(term);
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
项目:Openjsharp    文件ArrayCompiler.java   
@Override
protected void compileAltNode(final ConsAltNode node) {
    ConsAltNode aln = node;
    int len = 0;

    do {
        len += compileLengthTree(aln.car);
        if (aln.cdr != null) {
            len += OPSize.PUSH + OPSize.JUMP;
        }
    } while ((aln = aln.cdr) != null);

    final int pos = codeLength + len;  /* goal position */

    aln = node;
    do {
        len = compileLengthTree(aln.car);
        if (aln.cdr != null) {
            addOpcodeRelAddr(OPCode.PUSH,len + OPSize.JUMP);
        }
        compileTree(aln.car);
        if (aln.cdr != null) {
            len = pos - (codeLength + OPSize.JUMP);
            addOpcodeRelAddr(OPCode.JUMP,len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:Openjsharp    文件Parser.java   
private Node parseExpRepeat(final Node targetp,final boolean group) {
    Node target = targetp;
    while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat:
        if (target.isInvalidQuantifier()) {
            throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID);
        }

        final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(),token.getRepeatUpper(),token.type == TokenType.INTERVAL);

        qtfr.greedy = token.getRepeatGreedy();
        final int ret = qtfr.setQuantifier(target,group,env,chars,getBegin(),getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target = qn;
        } else if (ret == 2) { /* split case: /abc+/ */
            target = ConsAltNode.newListNode(target,null);
            final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn,null));

            fetchToken();
            return parseExpRepeatForCar(target,tmp,group);
        }
        fetchToken(); // goto re_entry
    }
    return target;
}
项目:Openjsharp    文件Parser.java   
private Node parseExpRepeatForCar(final Node top,final ConsAltNode target,final boolean group) {
    while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat:
        if (target.car.isInvalidQuantifier()) {
            throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID);
        }

        final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(),token.type == TokenType.INTERVAL);

        qtfr.greedy = token.getRepeatGreedy();
        final int ret = qtfr.setQuantifier(target.car,getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target.setCar(qn);
        } else if (ret == 2) { /* split case: /abc+/ */
            assert false;
        }
        fetchToken(); // goto re_entry
    }
    return top;
}
项目:Openjsharp    文件Analyser.java   
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node,head);

    final Node tmp = node;
    node = head;
    head = tmp;

    ((ConsAltNode)node).setCar(head);
    ((AnchorNode)head).setTarget(np);
    np = node;

    while ((np = ((ConsAltNode)np).cdr) != null) {
        final AnchorNode insert = new AnchorNode(anchorType);
        insert.setTarget(((ConsAltNode)np).car);
        ((ConsAltNode)np).setCar(insert);
    }

    if (anchorType == AnchorType.LOOK_BEHIND_NOT) {
        np = node;
        do {
            ((ConsAltNode)np).toListNode(); /* alt -> list */
        } while ((np = ((ConsAltNode)np).cdr) != null);
    }

    return node;
}
项目:openjdk-jdk10    文件ArrayCompiler.java   
@Override
protected void compileAltNode(final ConsAltNode node) {
    ConsAltNode aln = node;
    int len = 0;

    do {
        len += compileLengthTree(aln.car);
        if (aln.cdr != null) {
            len += OPSize.PUSH + OPSize.JUMP;
        }
    } while ((aln = aln.cdr) != null);

    final int pos = codeLength + len;  /* goal position */

    aln = node;
    do {
        len = compileLengthTree(aln.car);
        if (aln.cdr != null) {
            addOpcodeRelAddr(OPCode.PUSH,len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:openjdk-jdk10    文件Parser.java   
private Node parseExpRepeat(final Node targetp,group);
        }
        fetchToken(); // goto re_entry
    }
    return target;
}
项目:openjdk-jdk10    文件Parser.java   
private Node parseExpRepeatForCar(final Node top,getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target.setCar(qn);
        } else if (ret == 2) { /* split case: /abc+/ */
            assert false;
        }
        fetchToken(); // goto re_entry
    }
    return top;
}
项目:openjdk-jdk10    文件Analyser.java   
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node,head);

    final Node tmp = node;
    node = head;
    head = tmp;

    ((ConsAltNode)node).setCar(head);
    ((AnchorNode)head).setTarget(np);
    np = node;

    while ((np = ((ConsAltNode)np).cdr) != null) {
        final AnchorNode insert = new AnchorNode(anchorType);
        insert.setTarget(((ConsAltNode)np).car);
        ((ConsAltNode)np).setCar(insert);
    }

    if (anchorType == AnchorType.LOOK_BEHIND_NOT) {
        np = node;
        do {
            ((ConsAltNode)np).toListNode(); /* alt -> list */
        } while ((np = ((ConsAltNode)np).cdr) != null);
    }

    return node;
}
项目:openjdk9    文件ArrayCompiler.java   
@Override
protected void compileAltNode(final ConsAltNode node) {
    ConsAltNode aln = node;
    int len = 0;

    do {
        len += compileLengthTree(aln.car);
        if (aln.cdr != null) {
            len += OPSize.PUSH + OPSize.JUMP;
        }
    } while ((aln = aln.cdr) != null);

    final int pos = codeLength + len;  /* goal position */

    aln = node;
    do {
        len = compileLengthTree(aln.car);
        if (aln.cdr != null) {
            addOpcodeRelAddr(OPCode.PUSH,len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:openjdk9    文件Parser.java   
private Node parseExpRepeat(final Node targetp,group);
        }
        fetchToken(); // goto re_entry
    }
    return target;
}
项目:openjdk9    文件Parser.java   
private Node parseExpRepeatForCar(final Node top,getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target.setCar(qn);
        } else if (ret == 2) { /* split case: /abc+/ */
            assert false;
        }
        fetchToken(); // goto re_entry
    }
    return top;
}
项目:openjdk9    文件Analyser.java   
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node,head);

    final Node tmp = node;
    node = head;
    head = tmp;

    ((ConsAltNode)node).setCar(head);
    ((AnchorNode)head).setTarget(np);
    np = node;

    while ((np = ((ConsAltNode)np).cdr) != null) {
        final AnchorNode insert = new AnchorNode(anchorType);
        insert.setTarget(((ConsAltNode)np).car);
        ((ConsAltNode)np).setCar(insert);
    }

    if (anchorType == AnchorType.LOOK_BEHIND_NOT) {
        np = node;
        do {
            ((ConsAltNode)np).toListNode(); /* alt -> list */
        } while ((np = ((ConsAltNode)np).cdr) != null);
    }

    return node;
}
项目:kaziranga    文件ArrayCompiler.java   
@Override
protected void compileAltNode(final ConsAltNode node) {
    ConsAltNode aln = node;
    int len = 0;

    do {
        len += compileLengthTree(aln.car);
        if (aln.cdr != null) {
            len += OPSize.PUSH + OPSize.JUMP;
        }
    } while ((aln = aln.cdr) != null);

    final int pos = codeLength + len;  /* goal position */

    aln = node;
    do {
        len = compileLengthTree(aln.car);
        if (aln.cdr != null) {
            addOpcodeRelAddr(OPCode.PUSH,len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:kaziranga    文件Parser.java   
private Node parseExpRepeat(final Node targetp,group);
        }
        fetchToken(); // goto re_entry
    }
    return target;
}
项目:kaziranga    文件Parser.java   
private Node parseExpRepeatForCar(final Node top,getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target.setCar(qn);
        } else if (ret == 2) { /* split case: /abc+/ */
            assert false;
        }
        fetchToken(); // goto re_entry
    }
    return top;
}
项目:kaziranga    文件Analyser.java   
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node,head);

    final Node tmp = node;
    node = head;
    head = tmp;

    ((ConsAltNode)node).setCar(head);
    ((AnchorNode)head).setTarget(np);
    np = node;

    while ((np = ((ConsAltNode)np).cdr) != null) {
        final AnchorNode insert = new AnchorNode(anchorType);
        insert.setTarget(((ConsAltNode)np).car);
        ((ConsAltNode)np).setCar(insert);
    }

    if (anchorType == AnchorType.LOOK_BEHIND_NOT) {
        np = node;
        do {
            ((ConsAltNode)np).toListNode(); /* alt -> list */
        } while ((np = ((ConsAltNode)np).cdr) != null);
    }

    return node;
}
项目:lookaside_java-1.8.0-openjdk    文件ArrayCompiler.java   
@Override
protected void compileAltNode(final ConsAltNode node) {
    ConsAltNode aln = node;
    int len = 0;

    do {
        len += compileLengthTree(aln.car);
        if (aln.cdr != null) {
            len += OPSize.PUSH + OPSize.JUMP;
        }
    } while ((aln = aln.cdr) != null);

    final int pos = codeLength + len;  /* goal position */

    aln = node;
    do {
        len = compileLengthTree(aln.car);
        if (aln.cdr != null) {
            addOpcodeRelAddr(OPCode.PUSH,len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:lookaside_java-1.8.0-openjdk    文件Parser.java   
private Node parseExpRepeat(final Node targetp,group);
        }
        fetchToken(); // goto re_entry
    }
    return target;
}
项目:lookaside_java-1.8.0-openjdk    文件Parser.java   
private Node parseExpRepeatForCar(final Node top,getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target.setCar(qn);
        } else if (ret == 2) { /* split case: /abc+/ */
            assert false;
        }
        fetchToken(); // goto re_entry
    }
    return top;
}
项目:lookaside_java-1.8.0-openjdk    文件Analyser.java   
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node,head);

    final Node tmp = node;
    node = head;
    head = tmp;

    ((ConsAltNode)node).setCar(head);
    ((AnchorNode)head).setTarget(np);
    np = node;

    while ((np = ((ConsAltNode)np).cdr) != null) {
        final AnchorNode insert = new AnchorNode(anchorType);
        insert.setTarget(((ConsAltNode)np).car);
        ((ConsAltNode)np).setCar(insert);
    }

    if (anchorType == AnchorType.LOOK_BEHIND_NOT) {
        np = node;
        do {
            ((ConsAltNode)np).toListNode(); /* alt -> list */
        } while ((np = ((ConsAltNode)np).cdr) != null);
    }

    return node;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。