jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo Java Examples

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo. 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 TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #2
Source File: ArrayCompiler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #3
Source File: ArrayCompiler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #4
Source File: ArrayCompiler.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #5
Source File: ArrayCompiler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #6
Source File: ArrayCompiler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #7
Source File: ArrayCompiler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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 */
    }
}
 
Example #8
Source File: QuantifierNode.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #9
Source File: QuantifierNode.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(int lower, int upper, boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) setByNumber();
}
 
Example #10
Source File: ArrayCompiler.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void compileTreeEmptyCheck(Node node, int emptyInfo) {
    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;
        } // switch

        addMemNum(savedNumNullCheck); /* NULL CHECK ID */
    }
}
 
Example #11
Source File: QuantifierNode.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #12
Source File: QuantifierNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(int lower, int upper, boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) setByNumber();
}
 
Example #13
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void compileTreeEmptyCheck(Node node, int emptyInfo) {
    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;
        } // switch

        addMemNum(savedNumNullCheck); /* NULL CHECK ID */
    }
}
 
Example #14
Source File: QuantifierNode.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(int lower, int upper, boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) setByNumber();
}
 
Example #15
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void compileTreeEmptyCheck(Node node, int emptyInfo) {
    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;
        } // switch

        addMemNum(savedNumNullCheck); /* NULL CHECK ID */
    }
}
 
Example #16
Source File: QuantifierNode.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #17
Source File: QuantifierNode.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #18
Source File: QuantifierNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #19
Source File: QuantifierNode.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #20
Source File: QuantifierNode.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public QuantifierNode(final int lower, final int upper, final boolean byNumber) {
    this.lower = lower;
    this.upper = upper;
    greedy = true;
    targetEmptyInfo = TargetInfo.ISNOT_EMPTY;

    if (byNumber) {
        setByNumber();
    }
}
 
Example #21
Source File: Analyser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #22
Source File: Analyser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #23
Source File: Analyser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #24
Source File: Analyser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            int v = quantifiersMemoryInfo(can.car);
            if (v > info) info = v;
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #25
Source File: Analyser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #26
Source File: Analyser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            int v = quantifiersMemoryInfo(can.car);
            if (v > info) info = v;
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #27
Source File: Analyser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #28
Source File: Analyser.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #29
Source File: Analyser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(final Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            final int v = quantifiersMemoryInfo(can.car);
            if (v > info) {
                info = v;
            }
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        final QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        final EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}
 
Example #30
Source File: Analyser.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
private int quantifiersMemoryInfo(Node node) {
    int info = 0;

    switch(node.getType()) {
    case NodeType.LIST:
    case NodeType.ALT:
        ConsAltNode can = (ConsAltNode)node;
        do {
            int v = quantifiersMemoryInfo(can.car);
            if (v > info) info = v;
        } while ((can = can.cdr) != null);
        break;

    case NodeType.QTFR:
        QuantifierNode qn = (QuantifierNode)node;
        if (qn.upper != 0) {
            info = quantifiersMemoryInfo(qn.target);
        }
        break;

    case NodeType.ENCLOSE:
        EncloseNode en = (EncloseNode)node;
        switch (en.type) {
        case EncloseType.MEMORY:
            return TargetInfo.IS_EMPTY_MEM;

        case EncloseType.OPTION:
        case EncloseNode.STOP_BACKTRACK:
            info = quantifiersMemoryInfo(en.target);
            break;

        default:
            break;
        } // inner switch
        break;

    case NodeType.BREF:
    case NodeType.STR:
    case NodeType.CTYPE:
    case NodeType.CCLASS:
    case NodeType.CANY:
    case NodeType.ANCHOR:
    default:
        break;
    } // switch

    return info;
}