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

项目:Openjsharp    文件ArrayCompiler.java   
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p,prev;
    p = prev = sn.p;
    final int end = sn.end;
    final char[] chars = sn.chars;
    p++;

    int slen = 1;
    int rlen = 0;

    while (p < end) {
        slen++;
        p++;
    }
    final int r = addCompileStringlength(chars,prev,slen,ambig);
    rlen += r;
    return rlen;
}
项目:Openjsharp    文件Parser.java   
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars,token.backP,p); // tk_byte:
    while (true) {
        fetchToken();
        if (token.type != TokenType.STRING) {
            break;
        }

        if (token.backP == node.end) {
            node.end = p; // non escaped character,remain shared,just increase shared range
        } else {
            node.cat(chars,p); // non continuous string stream,need to COW
        }
    }
    // targetp = node;
    return parseExpRepeat(node,group); // string_end:,goto repeat
}
项目: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
    }
}
项目:Openjsharp    文件Analyser.java   
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (Syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
项目:openjdk-jdk10    文件ArrayCompiler.java   
private void compileTreeEmptyCheck(final Node node,final int emptyInfo) {
    final int savednumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        default:
            break;
        } // switch

        addMemNum(savednumNullCheck); /* NULL CHECK ID */
    }
}
项目:openjdk-jdk10    文件ArrayCompiler.java   
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p,ambig);
    rlen += r;
    return rlen;
}
项目:openjdk-jdk10    文件Parser.java   
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars,goto repeat
}
项目: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
    }
}
项目:openjdk-jdk10    文件Analyser.java   
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (Syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
项目:openjdk9    文件ArrayCompiler.java   
private void compileTreeEmptyCheck(final Node node,final int emptyInfo) {
    final int savednumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        default:
            break;
        } // switch

        addMemNum(savednumNullCheck); /* NULL CHECK ID */
    }
}
项目:openjdk9    文件ArrayCompiler.java   
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p,ambig);
    rlen += r;
    return rlen;
}
项目:openjdk9    文件Parser.java   
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars,goto repeat
}
项目: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
    }
}
项目:openjdk9    文件Analyser.java   
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (Syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
项目:kaziranga    文件ArrayCompiler.java   
private void compileTreeEmptyCheck(final Node node,final int emptyInfo) {
    final int savednumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        default:
            break;
        } // switch

        addMemNum(savednumNullCheck); /* NULL CHECK ID */
    }
}
项目:kaziranga    文件ArrayCompiler.java   
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p,ambig);
    rlen += r;
    return rlen;
}
项目:kaziranga    文件Parser.java   
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars,goto repeat
}
项目: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
    }
}
项目:kaziranga    文件Analyser.java   
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (Syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
项目:lookaside_java-1.8.0-openjdk    文件ArrayCompiler.java   
private void compileTreeEmptyCheck(final Node node,final int emptyInfo) {
    final int savednumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        default:
            break;
        } // switch

        addMemNum(savednumNullCheck); /* NULL CHECK ID */
    }
}
项目:lookaside_java-1.8.0-openjdk    文件ArrayCompiler.java   
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p,ambig);
    rlen += r;
    return rlen;
}
项目:lookaside_java-1.8.0-openjdk    文件Parser.java   
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars,goto repeat
}
项目: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
    }
}
项目:lookaside_java-1.8.0-openjdk    文件Analyser.java   
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (Syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
项目:jdk8u_nashorn    文件ArrayCompiler.java   
private void compileTreeEmptyCheck(final Node node,final int emptyInfo) {
    final int savednumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        default:
            break;
        } // switch

        addMemNum(savednumNullCheck); /* NULL CHECK ID */
    }
}
项目:jdk8u_nashorn    文件ArrayCompiler.java   
private static int compileLengthStringNode(final Node node) {
    final StringNode sn = (StringNode)node;
    if (sn.length() <= 0) {
        return 0;
    }
    final boolean ambig = sn.isAmbig();

    int p,ambig);
    rlen += r;
    return rlen;
}
项目:jdk8u_nashorn    文件Parser.java   
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars,goto repeat
}
项目: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
    }
}
项目:jdk8u_nashorn    文件Analyser.java   
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (Syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
项目:Openjsharp    文件ScanEnvironment.java   
public int addMemEntry() {
    if (numMem++ == 0) {
        memNodes = new Node[SCANENV_MEMNODES_SIZE];
    } else if (numMem >= memNodes.length) {
        final Node[]tmp = new Node[memNodes.length << 1];
        System.arraycopy(memNodes,tmp,memNodes.length);
        memNodes = tmp;
    }

    return numMem;
}
项目:Openjsharp    文件ScanEnvironment.java   
public void setMemNode(final int num,final Node node) {
    if (numMem >= num) {
        memNodes[num] = node;
    } else {
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
项目:Openjsharp    文件ArrayCompiler.java   
private void compileTreeEmptyCheck(final Node node,final int emptyInfo) {
    final int savednumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        case TargetInfo.IS_EMPTY_REC:
            addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH);
            break;
        default:
            break;
        } // switch

        addMemNum(savednumNullCheck); /* NULL CHECK ID */
    }
}
项目:Openjsharp    文件Parser.java   
private Node parseExpTkRawByte(final boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    final StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node,group);
}
项目: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,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;
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...