Java 类jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize 实例源码

项目:OpenJSharp    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:OpenJSharp    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:openjdk-jdk10    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:openjdk-jdk10    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:openjdk9    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:openjdk9    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:kaziranga    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:kaziranga    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:lookaside_java-1.8.0-openjdk    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:lookaside_java-1.8.0-openjdk    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:jdk8u_nashorn    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:jdk8u_nashorn    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:infobip-open-jdk-8    文件:ArrayCompiler.java   
private static int compileLengthCClassNode(final CClassNode cc) {
    if (cc.isShare()) {
        return OPSize.OPCODE + OPSize.POINTER;
    }

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:infobip-open-jdk-8    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(final QuantifierNode qn, final int targetLen, final int emptyInfo) {
    final int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:OLD-OpenJDK8    文件:ArrayCompiler.java   
private int compileLengthCClassNode(CClassNode cc) {
    if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:OLD-OpenJDK8    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(QuantifierNode qn, int targetLen, int emptyInfo) {
    int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:nashorn-backport    文件:ArrayCompiler.java   
private int compileLengthCClassNode(CClassNode cc) {
    if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:nashorn-backport    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(QuantifierNode qn, int targetLen, int emptyInfo) {
    int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目:nashorn    文件:ArrayCompiler.java   
private int compileLengthCClassNode(CClassNode cc) {
    if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;

    int len;
    if (cc.mbuf == null) {
        len = OPSize.OPCODE + BitSet.BITSET_SIZE;
    } else {
        if (cc.bs.isEmpty()) {
            len = OPSize.OPCODE;
        } else {
            len = OPSize.OPCODE + BitSet.BITSET_SIZE;
        }

        len += OPSize.LENGTH + cc.mbuf.used;
    }
    return len;
}
项目:nashorn    文件:ArrayCompiler.java   
private void compileRangeRepeatNode(QuantifierNode qn, int targetLen, int emptyInfo) {
    int numRepeat = regex.numRepeat;
    addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
    addMemNum(numRepeat); /* OP_REPEAT ID */
    regex.numRepeat++;
    addRelAddr(targetLen + OPSize.REPEAT_INC);

    entryRepeatRange(numRepeat, qn.lower, qn.upper);

    compileTreeEmptyCheck(qn.target, emptyInfo);

    if (qn.isInRepeat()) {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
    } else {
        addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
    }

    addMemNum(numRepeat); /* OP_REPEAT ID */
}
项目: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    文件:ArrayCompiler.java   
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
项目:OpenJSharp    文件:ArrayCompiler.java   
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
项目:OpenJSharp    文件:ArrayCompiler.java   
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
项目:OpenJSharp    文件:ArrayCompiler.java   
private int compileLengthAnchorNode(final AnchorNode node) {
    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case AnchorType.PREC_READ:
        len = OPSize.PUSH_POS + tlen + OPSize.POP_POS;
        break;

    case AnchorType.PREC_READ_NOT:
        len = OPSize.PUSH_POS_NOT + tlen + OPSize.FAIL_POS;
        break;

    case AnchorType.LOOK_BEHIND:
        len = OPSize.LOOK_BEHIND + tlen;
        break;

    case AnchorType.LOOK_BEHIND_NOT:
        len = OPSize.PUSH_LOOK_BEHIND_NOT + tlen + OPSize.FAIL_LOOK_BEHIND_NOT;
        break;

    default:
        len = OPSize.OPCODE;
        break;
    } // switch
    return len;
}
项目: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 + OPSize.JUMP);
        }
        compileTree(aln.car);
        if (aln.cdr != null) {
            len = pos - (codeLength + OPSize.JUMP);
            addOpcodeRelAddr(OPCode.JUMP, len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:openjdk-jdk10    文件:ArrayCompiler.java   
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
项目:openjdk-jdk10    文件:ArrayCompiler.java   
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
项目:openjdk-jdk10    文件:ArrayCompiler.java   
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
项目:openjdk-jdk10    文件:ArrayCompiler.java   
private int compileLengthAnchorNode(final AnchorNode node) {
    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case AnchorType.PREC_READ:
        len = OPSize.PUSH_POS + tlen + OPSize.POP_POS;
        break;

    case AnchorType.PREC_READ_NOT:
        len = OPSize.PUSH_POS_NOT + tlen + OPSize.FAIL_POS;
        break;

    case AnchorType.LOOK_BEHIND:
        len = OPSize.LOOK_BEHIND + tlen;
        break;

    case AnchorType.LOOK_BEHIND_NOT:
        len = OPSize.PUSH_LOOK_BEHIND_NOT + tlen + OPSize.FAIL_LOOK_BEHIND_NOT;
        break;

    default:
        len = OPSize.OPCODE;
        break;
    } // switch
    return len;
}
项目: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 + OPSize.JUMP);
        }
        compileTree(aln.car);
        if (aln.cdr != null) {
            len = pos - (codeLength + OPSize.JUMP);
            addOpcodeRelAddr(OPCode.JUMP, len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:openjdk9    文件:ArrayCompiler.java   
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
项目:openjdk9    文件:ArrayCompiler.java   
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
项目:openjdk9    文件:ArrayCompiler.java   
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
项目:openjdk9    文件:ArrayCompiler.java   
private int compileLengthAnchorNode(final AnchorNode node) {
    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case AnchorType.PREC_READ:
        len = OPSize.PUSH_POS + tlen + OPSize.POP_POS;
        break;

    case AnchorType.PREC_READ_NOT:
        len = OPSize.PUSH_POS_NOT + tlen + OPSize.FAIL_POS;
        break;

    case AnchorType.LOOK_BEHIND:
        len = OPSize.LOOK_BEHIND + tlen;
        break;

    case AnchorType.LOOK_BEHIND_NOT:
        len = OPSize.PUSH_LOOK_BEHIND_NOT + tlen + OPSize.FAIL_LOOK_BEHIND_NOT;
        break;

    default:
        len = OPSize.OPCODE;
        break;
    } // switch
    return len;
}
项目: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 + OPSize.JUMP);
        }
        compileTree(aln.car);
        if (aln.cdr != null) {
            len = pos - (codeLength + OPSize.JUMP);
            addOpcodeRelAddr(OPCode.JUMP, len);
        }
    } while ((aln = aln.cdr) != null);
}
项目:kaziranga    文件:ArrayCompiler.java   
private static int addCompileStringlength(final char[] chars, final int p, final int strLength, final boolean ignoreCase) {
    final int op = selectStrOpcode(strLength, ignoreCase);
    int len = OPSize.OPCODE;

    if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
        // string length, template index, template string pointer
        len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
    } else {
        if (isNeedStrLenOpExact(op)) {
            len += OPSize.LENGTH;
        }
        len += strLength;
    }
    return len;
}
项目:kaziranga    文件:ArrayCompiler.java   
private int compileLengthOptionNode(final EncloseNode node) {
    final int prev = regex.options;
    regex.options = node.option;
    final int tlen = compileLengthTree(node.target);
    regex.options = prev;

    if (isDynamic(prev ^ node.option)) {
        return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
    }
    return tlen;
}
项目:kaziranga    文件:ArrayCompiler.java   
private int compileLengthEncloseNode(final EncloseNode node) {
    if (node.isOption()) {
        return compileLengthOptionNode(node);
    }

    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case EncloseType.MEMORY:
        if (bsAt(regex.btMemStart, node.regNum)) {
            len = OPSize.MEMORY_START_PUSH;
        } else {
            len = OPSize.MEMORY_START;
        }
        len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
        break;

    case EncloseType.STOP_BACKTRACK:
        if (node.isStopBtSimpleRepeat()) {
            final QuantifierNode qn = (QuantifierNode)node.target;
            tlen = compileLengthTree(qn.target);
            len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
        } else {
            len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
        }
        break;

    default:
        newInternalException(ERR_PARSER_BUG);
        return 0; // not reached
    } // switch
    return len;
}
项目:kaziranga    文件:ArrayCompiler.java   
private int compileLengthAnchorNode(final AnchorNode node) {
    int tlen;
    if (node.target != null) {
        tlen = compileLengthTree(node.target);
    } else {
        tlen = 0;
    }

    int len;
    switch (node.type) {
    case AnchorType.PREC_READ:
        len = OPSize.PUSH_POS + tlen + OPSize.POP_POS;
        break;

    case AnchorType.PREC_READ_NOT:
        len = OPSize.PUSH_POS_NOT + tlen + OPSize.FAIL_POS;
        break;

    case AnchorType.LOOK_BEHIND:
        len = OPSize.LOOK_BEHIND + tlen;
        break;

    case AnchorType.LOOK_BEHIND_NOT:
        len = OPSize.PUSH_LOOK_BEHIND_NOT + tlen + OPSize.FAIL_LOOK_BEHIND_NOT;
        break;

    default:
        len = OPSize.OPCODE;
        break;
    } // switch
    return len;
}