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

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType. 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: OptAnchorInfo.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #2
Source File: OptAnchorInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #3
Source File: Analyser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #4
Source File: OptAnchorInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #5
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 #6
Source File: OptAnchorInfo.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #7
Source File: Analyser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #8
Source File: ArrayCompiler.java    From openjdk-jdk8u 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 #9
Source File: OptAnchorInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #10
Source File: Analyser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #11
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 #12
Source File: Analyser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #13
Source File: OptAnchorInfo.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #14
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 #15
Source File: Analyser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #16
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 #17
Source File: ArrayCompiler.java    From hottub 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 #18
Source File: Analyser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #19
Source File: OptAnchorInfo.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(int anchor) {
    StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf ");
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line ");
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos ");
    if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf ");
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf ");
    if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line ");
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star ");
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl ");
    s.append("]");

    return s.toString();
}
 
Example #20
Source File: ArrayCompiler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthAnchorNode(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 #21
Source File: Analyser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(Node node) {
    AnchorNode an = (AnchorNode)node;
    int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #22
Source File: OptAnchorInfo.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(int anchor) {
    StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf ");
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line ");
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos ");
    if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf ");
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf ");
    if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line ");
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star ");
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl ");
    s.append("]");

    return s.toString();
}
 
Example #23
Source File: ArrayCompiler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthAnchorNode(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 #24
Source File: Analyser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(Node node) {
    AnchorNode an = (AnchorNode)node;
    int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #25
Source File: OptAnchorInfo.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(final int anchor) {
    final StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) {
        s.append("begin-buf ");
    }
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) {
        s.append("begin-line ");
    }
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) {
        s.append("begin-pos ");
    }
    if ((anchor & AnchorType.END_BUF) !=0 ) {
        s.append("end-buf ");
    }
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) {
        s.append("semi-end-buf ");
    }
    if ((anchor & AnchorType.END_LINE) !=0 ) {
        s.append("end-line ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) {
        s.append("anychar-star ");
    }
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) {
        s.append("anychar-star-pl ");
    }
    s.append("]");

    return s.toString();
}
 
Example #26
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 #27
Source File: Analyser.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(final Node nodep) {
    Node node = nodep;
    final AnchorNode an = (AnchorNode)node;
    final int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}
 
Example #28
Source File: OptAnchorInfo.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
static String anchorToString(int anchor) {
    StringBuffer s = new StringBuffer("[");

    if ((anchor & AnchorType.BEGIN_BUF) !=0 ) s.append("begin-buf ");
    if ((anchor & AnchorType.BEGIN_LINE) !=0 ) s.append("begin-line ");
    if ((anchor & AnchorType.BEGIN_POSITION) !=0 ) s.append("begin-pos ");
    if ((anchor & AnchorType.END_BUF) !=0 ) s.append("end-buf ");
    if ((anchor & AnchorType.SEMI_END_BUF) !=0 ) s.append("semi-end-buf ");
    if ((anchor & AnchorType.END_LINE) !=0 ) s.append("end-line ");
    if ((anchor & AnchorType.ANYCHAR_STAR) !=0 ) s.append("anychar-star ");
    if ((anchor & AnchorType.ANYCHAR_STAR_ML) !=0 ) s.append("anychar-star-pl ");
    s.append("]");

    return s.toString();
}
 
Example #29
Source File: ArrayCompiler.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private int compileLengthAnchorNode(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 #30
Source File: Analyser.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private Node divideLookBehindAlternatives(Node node) {
    AnchorNode an = (AnchorNode)node;
    int anchorType = an.type;
    Node head = an.target;
    Node np = ((ConsAltNode)head).car;

    swap(node, head);

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

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

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

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

    return node;
}