Java Code Examples for jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize#OPCODE

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.constants.OPSize#OPCODE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: ArrayCompiler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 5
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private int addCompileStringlength(char[] chars, int p, int strLength, boolean ignoreCase) {
    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;
}
 
Example 6
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 9
Source File: ArrayCompiler.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: ArrayCompiler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: ArrayCompiler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 12
Source File: ArrayCompiler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 13
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 14
Source File: ArrayCompiler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private int compileLengthTree(final Node node) {
    int len = 0;

    switch (node.getType()) {
    case NodeType.LIST:
        ConsAltNode lin = (ConsAltNode)node;
        do {
            len += compileLengthTree(lin.car);
        } while ((lin = lin.cdr) != null);
        break;

    case NodeType.ALT:
        ConsAltNode aln = (ConsAltNode)node;
        int n = 0;
        do {
            len += compileLengthTree(aln.car);
            n++;
        } while ((aln = aln.cdr) != null);
        len += (OPSize.PUSH + OPSize.JUMP) * (n - 1);
        break;

    case NodeType.STR:
        final StringNode sn = (StringNode)node;
        if (sn.isRaw()) {
            len = compileLengthStringRawNode(sn);
        } else {
            len = compileLengthStringNode(sn);
        }
        break;

    case NodeType.CCLASS:
        len = compileLengthCClassNode((CClassNode)node);
        break;

    case NodeType.CTYPE:
    case NodeType.CANY:
        len = OPSize.OPCODE;
        break;

    case NodeType.BREF:
        final BackRefNode br = (BackRefNode)node;

        len = ((!isIgnoreCase(regex.options) && br.backRef <= 2)
                ? OPSize.OPCODE : (OPSize.OPCODE + OPSize.MEMNUM));
        break;

    case NodeType.QTFR:
        len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
        break;

    case NodeType.ENCLOSE:
        len = compileLengthEncloseNode((EncloseNode)node);
        break;

    case NodeType.ANCHOR:
        len = compileLengthAnchorNode((AnchorNode)node);
        break;

    default:
        newInternalException(ERR_PARSER_BUG);

    } //switch
    return len;
}
 
Example 15
Source File: ArrayCompiler.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private int compileNonCECLengthQuantifierNode(final QuantifierNode qn) {
    final boolean infinite = isRepeatInfinite(qn.upper);
    final int emptyInfo = qn.targetEmptyInfo;

    final int tlen = compileLengthTree(qn.target);

    /* anychar repeat */
    if (qn.target.getType() == NodeType.CANY) {
        if (qn.greedy && infinite) {
            if (qn.nextHeadExact != null) {
                return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower;
            }
            return OPSize.ANYCHAR_STAR + tlen * qn.lower;
        }
    }

    int modTLen = 0;
    if (emptyInfo != 0) {
        modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
    } else {
        modTLen = tlen;
    }

    int len;
    if (infinite && (qn.lower <= 1 || tlen * qn.lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
        if (qn.lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) {
            len = OPSize.JUMP;
        } else {
            len = tlen * qn.lower;
        }

        if (qn.greedy) {
            if (qn.headExact != null) {
                len += OPSize.PUSH_OR_JUMP_EXACT1 + modTLen + OPSize.JUMP;
            } else if (qn.nextHeadExact != null) {
                len += OPSize.PUSH_IF_PEEK_NEXT + modTLen + OPSize.JUMP;
            } else {
                len += OPSize.PUSH + modTLen + OPSize.JUMP;
            }
        } else {
            len += OPSize.JUMP + modTLen + OPSize.PUSH;
        }

    } else if (qn.upper == 0 && qn.isRefered) { /* /(?<n>..){0}/ */
        len = OPSize.JUMP + tlen;
    } else if (!infinite && qn.greedy &&
              (qn.upper == 1 || (tlen + OPSize.PUSH) * qn.upper <= QUANTIFIER_EXPAND_LIMIT_SIZE )) {
        len = tlen * qn.lower;
        len += (OPSize.PUSH + tlen) * (qn.upper - qn.lower);
    } else if (!qn.greedy && qn.upper == 1 && qn.lower == 0) { /* '??' */
        len = OPSize.PUSH + OPSize.JUMP + tlen;
    } else {
        len = OPSize.REPEAT_INC + modTLen + OPSize.OPCODE + OPSize.RELADDR + OPSize.MEMNUM;
    }
    return len;
}
 
Example 16
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private int compileLengthTree(final Node node) {
    int len = 0;

    switch (node.getType()) {
    case NodeType.LIST:
        ConsAltNode lin = (ConsAltNode)node;
        do {
            len += compileLengthTree(lin.car);
        } while ((lin = lin.cdr) != null);
        break;

    case NodeType.ALT:
        ConsAltNode aln = (ConsAltNode)node;
        int n = 0;
        do {
            len += compileLengthTree(aln.car);
            n++;
        } while ((aln = aln.cdr) != null);
        len += (OPSize.PUSH + OPSize.JUMP) * (n - 1);
        break;

    case NodeType.STR:
        final StringNode sn = (StringNode)node;
        if (sn.isRaw()) {
            len = compileLengthStringRawNode(sn);
        } else {
            len = compileLengthStringNode(sn);
        }
        break;

    case NodeType.CCLASS:
        len = compileLengthCClassNode((CClassNode)node);
        break;

    case NodeType.CTYPE:
    case NodeType.CANY:
        len = OPSize.OPCODE;
        break;

    case NodeType.BREF:
        final BackRefNode br = (BackRefNode)node;

        len = ((!isIgnoreCase(regex.options) && br.backRef <= 2)
                ? OPSize.OPCODE : (OPSize.OPCODE + OPSize.MEMNUM));
        break;

    case NodeType.QTFR:
        len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
        break;

    case NodeType.ENCLOSE:
        len = compileLengthEncloseNode((EncloseNode)node);
        break;

    case NodeType.ANCHOR:
        len = compileLengthAnchorNode((AnchorNode)node);
        break;

    default:
        newInternalException(ERR_PARSER_BUG);

    } //switch
    return len;
}
 
Example 17
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private int compileNonCECLengthQuantifierNode(QuantifierNode qn) {
    boolean infinite = isRepeatInfinite(qn.upper);
    int emptyInfo = qn.targetEmptyInfo;

    int tlen = compileLengthTree(qn.target);

    /* anychar repeat */
    if (qn.target.getType() == NodeType.CANY) {
        if (qn.greedy && infinite) {
            if (qn.nextHeadExact != null) {
                return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower;
            } else {
                return OPSize.ANYCHAR_STAR + tlen * qn.lower;
            }
        }
    }

    int modTLen = 0;
    if (emptyInfo != 0) {
        modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
    } else {
        modTLen = tlen;
    }

    int len;
    if (infinite && (qn.lower <= 1 || tlen * qn.lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
        if (qn.lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) {
            len = OPSize.JUMP;
        } else {
            len = tlen * qn.lower;
        }

        if (qn.greedy) {
            if (qn.headExact != null) {
                len += OPSize.PUSH_OR_JUMP_EXACT1 + modTLen + OPSize.JUMP;
            } else if (qn.nextHeadExact != null) {
                len += OPSize.PUSH_IF_PEEK_NEXT + modTLen + OPSize.JUMP;
            } else {
                len += OPSize.PUSH + modTLen + OPSize.JUMP;
            }
        } else {
            len += OPSize.JUMP + modTLen + OPSize.PUSH;
        }

    } else if (qn.upper == 0 && qn.isRefered) { /* /(?<n>..){0}/ */
        len = OPSize.JUMP + tlen;
    } else if (!infinite && qn.greedy &&
              (qn.upper == 1 || (tlen + OPSize.PUSH) * qn.upper <= QUANTIFIER_EXPAND_LIMIT_SIZE )) {
        len = tlen * qn.lower;
        len += (OPSize.PUSH + tlen) * (qn.upper - qn.lower);
    } else if (!qn.greedy && qn.upper == 1 && qn.lower == 0) { /* '??' */
        len = OPSize.PUSH + OPSize.JUMP + tlen;
    } else {
        len = OPSize.REPEAT_INC + modTLen + OPSize.OPCODE + OPSize.RELADDR + OPSize.MEMNUM;
    }
    return len;
}
 
Example 18
Source File: ArrayCompiler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private int compileLengthTree(final Node node) {
    int len = 0;

    switch (node.getType()) {
    case NodeType.LIST:
        ConsAltNode lin = (ConsAltNode)node;
        do {
            len += compileLengthTree(lin.car);
        } while ((lin = lin.cdr) != null);
        break;

    case NodeType.ALT:
        ConsAltNode aln = (ConsAltNode)node;
        int n = 0;
        do {
            len += compileLengthTree(aln.car);
            n++;
        } while ((aln = aln.cdr) != null);
        len += (OPSize.PUSH + OPSize.JUMP) * (n - 1);
        break;

    case NodeType.STR:
        final StringNode sn = (StringNode)node;
        if (sn.isRaw()) {
            len = compileLengthStringRawNode(sn);
        } else {
            len = compileLengthStringNode(sn);
        }
        break;

    case NodeType.CCLASS:
        len = compileLengthCClassNode((CClassNode)node);
        break;

    case NodeType.CTYPE:
    case NodeType.CANY:
        len = OPSize.OPCODE;
        break;

    case NodeType.BREF:
        final BackRefNode br = (BackRefNode)node;

        len = ((!isIgnoreCase(regex.options) && br.backRef <= 2)
                ? OPSize.OPCODE : (OPSize.OPCODE + OPSize.MEMNUM));
        break;

    case NodeType.QTFR:
        len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
        break;

    case NodeType.ENCLOSE:
        len = compileLengthEncloseNode((EncloseNode)node);
        break;

    case NodeType.ANCHOR:
        len = compileLengthAnchorNode((AnchorNode)node);
        break;

    default:
        newInternalException(ERR_PARSER_BUG);

    } //switch
    return len;
}
 
Example 19
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private int compileNonCECLengthQuantifierNode(final QuantifierNode qn) {
    final boolean infinite = isRepeatInfinite(qn.upper);
    final int emptyInfo = qn.targetEmptyInfo;

    final int tlen = compileLengthTree(qn.target);

    /* anychar repeat */
    if (qn.target.getType() == NodeType.CANY) {
        if (qn.greedy && infinite) {
            if (qn.nextHeadExact != null) {
                return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower;
            }
            return OPSize.ANYCHAR_STAR + tlen * qn.lower;
        }
    }

    int modTLen = 0;
    if (emptyInfo != 0) {
        modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
    } else {
        modTLen = tlen;
    }

    int len;
    if (infinite && (qn.lower <= 1 || tlen * qn.lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
        if (qn.lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) {
            len = OPSize.JUMP;
        } else {
            len = tlen * qn.lower;
        }

        if (qn.greedy) {
            if (qn.headExact != null) {
                len += OPSize.PUSH_OR_JUMP_EXACT1 + modTLen + OPSize.JUMP;
            } else if (qn.nextHeadExact != null) {
                len += OPSize.PUSH_IF_PEEK_NEXT + modTLen + OPSize.JUMP;
            } else {
                len += OPSize.PUSH + modTLen + OPSize.JUMP;
            }
        } else {
            len += OPSize.JUMP + modTLen + OPSize.PUSH;
        }

    } else if (qn.upper == 0 && qn.isRefered) { /* /(?<n>..){0}/ */
        len = OPSize.JUMP + tlen;
    } else if (!infinite && qn.greedy &&
              (qn.upper == 1 || (tlen + OPSize.PUSH) * qn.upper <= QUANTIFIER_EXPAND_LIMIT_SIZE )) {
        len = tlen * qn.lower;
        len += (OPSize.PUSH + tlen) * (qn.upper - qn.lower);
    } else if (!qn.greedy && qn.upper == 1 && qn.lower == 0) { /* '??' */
        len = OPSize.PUSH + OPSize.JUMP + tlen;
    } else {
        len = OPSize.REPEAT_INC + modTLen + OPSize.OPCODE + OPSize.RELADDR + OPSize.MEMNUM;
    }
    return len;
}
 
Example 20
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private int compileLengthTree(Node node) {
    int len = 0;

    switch (node.getType()) {
    case NodeType.LIST:
        ConsAltNode lin = (ConsAltNode)node;
        do {
            len += compileLengthTree(lin.car);
        } while ((lin = lin.cdr) != null);
        break;

    case NodeType.ALT:
        ConsAltNode aln = (ConsAltNode)node;
        int n = 0;
        do {
            len += compileLengthTree(aln.car);
            n++;
        } while ((aln = aln.cdr) != null);
        len += (OPSize.PUSH + OPSize.JUMP) * (n - 1);
        break;

    case NodeType.STR:
        StringNode sn = (StringNode)node;
        if (sn.isRaw()) {
            len = compileLengthStringRawNode(sn);
        } else {
            len = compileLengthStringNode(sn);
        }
        break;

    case NodeType.CCLASS:
        len = compileLengthCClassNode((CClassNode)node);
        break;

    case NodeType.CTYPE:
    case NodeType.CANY:
        len = OPSize.OPCODE;
        break;

    case NodeType.BREF:
        BackRefNode br = (BackRefNode)node;

        len = ((!isIgnoreCase(regex.options) && br.backRef <= 2)
                ? OPSize.OPCODE : (OPSize.OPCODE + OPSize.MEMNUM));
        break;

    case NodeType.QTFR:
        len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
        break;

    case NodeType.ENCLOSE:
        len = compileLengthEncloseNode((EncloseNode)node);
        break;

    case NodeType.ANCHOR:
        len = compileLengthAnchorNode((AnchorNode)node);
        break;

    default:
        newInternalException(ERR_PARSER_BUG);

    } //switch
    return len;
}