jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode Java Examples
The following examples show how to use
jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode.
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: Analyser.java From nashorn with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(Node node) { AnchorNode an = (AnchorNode)node; int len = getCharLengthTree(an.target); switch(returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } else { throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); } } return node; }
Example #2
Source File: Analyser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #3
Source File: Analyser.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #4
Source File: Analyser.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #5
Source File: Analyser.java From hottub with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #6
Source File: Analyser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #7
Source File: Analyser.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(Node node) { AnchorNode an = (AnchorNode)node; int len = getCharLengthTree(an.target); switch(returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } else { throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); } } return node; }
Example #8
Source File: Analyser.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(Node node) { AnchorNode an = (AnchorNode)node; int len = getCharLengthTree(an.target); switch(returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } else { throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); } } return node; }
Example #9
Source File: Analyser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #10
Source File: Analyser.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
private Node setupLookBehind(final Node node) { final AnchorNode an = (AnchorNode)node; final int len = getCharLengthTree(an.target); switch (returnCode) { case 0: an.charLength = len; break; case GET_CHAR_LEN_VARLEN: throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); default: break; } return node; }
Example #11
Source File: ArrayCompiler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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: ArrayCompiler.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
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-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 #14
Source File: Analyser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 #15
Source File: Analyser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 hottub with GNU General Public License v2.0 | 5 votes |
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 openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 nashorn with GNU General Public License v2.0 | 5 votes |
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 #19
Source File: Analyser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #20
Source File: Analyser.java From nashorn with GNU General Public License v2.0 | 5 votes |
private boolean checkTypeTree(Node node, int typeMask, int encloseMask, int anchorMask) { if ((node.getType2Bit() & typeMask) == 0) return true; boolean invalid = false; switch(node.getType()) { case NodeType.LIST: case NodeType.ALT: ConsAltNode can = (ConsAltNode)node; do { invalid = checkTypeTree(can.car, typeMask, encloseMask, anchorMask); } while (!invalid && (can = can.cdr) != null); break; case NodeType.QTFR: invalid = checkTypeTree(((QuantifierNode)node).target, typeMask, encloseMask, anchorMask); break; case NodeType.ENCLOSE: EncloseNode en = (EncloseNode)node; if ((en.type & encloseMask) == 0) return true; invalid = checkTypeTree(en.target, typeMask, encloseMask, anchorMask); break; case NodeType.ANCHOR: AnchorNode an = (AnchorNode)node; if ((an.type & anchorMask) == 0) return true; if (an.target != null) invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask); break; default: break; } // switch return invalid; }
Example #21
Source File: ArrayCompiler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #22
Source File: Analyser.java From hottub with GNU General Public License v2.0 | 5 votes |
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 #23
Source File: ArrayCompiler.java From nashorn with GNU General Public License v2.0 | 5 votes |
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: ArrayCompiler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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 #25
Source File: Analyser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private boolean checkTypeTree(Node node, int typeMask, int encloseMask, int anchorMask) { if ((node.getType2Bit() & typeMask) == 0) return true; boolean invalid = false; switch(node.getType()) { case NodeType.LIST: case NodeType.ALT: ConsAltNode can = (ConsAltNode)node; do { invalid = checkTypeTree(can.car, typeMask, encloseMask, anchorMask); } while (!invalid && (can = can.cdr) != null); break; case NodeType.QTFR: invalid = checkTypeTree(((QuantifierNode)node).target, typeMask, encloseMask, anchorMask); break; case NodeType.ENCLOSE: EncloseNode en = (EncloseNode)node; if ((en.type & encloseMask) == 0) return true; invalid = checkTypeTree(en.target, typeMask, encloseMask, anchorMask); break; case NodeType.ANCHOR: AnchorNode an = (AnchorNode)node; if ((an.type & anchorMask) == 0) return true; if (an.target != null) invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask); break; default: break; } // switch return invalid; }
Example #26
Source File: Analyser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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 #27
Source File: Analyser.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
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: ArrayCompiler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 #29
Source File: Analyser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private boolean checkTypeTree(Node node, int typeMask, int encloseMask, int anchorMask) { if ((node.getType2Bit() & typeMask) == 0) return true; boolean invalid = false; switch(node.getType()) { case NodeType.LIST: case NodeType.ALT: ConsAltNode can = (ConsAltNode)node; do { invalid = checkTypeTree(can.car, typeMask, encloseMask, anchorMask); } while (!invalid && (can = can.cdr) != null); break; case NodeType.QTFR: invalid = checkTypeTree(((QuantifierNode)node).target, typeMask, encloseMask, anchorMask); break; case NodeType.ENCLOSE: EncloseNode en = (EncloseNode)node; if ((en.type & encloseMask) == 0) return true; invalid = checkTypeTree(en.target, typeMask, encloseMask, anchorMask); break; case NodeType.ANCHOR: AnchorNode an = (AnchorNode)node; if ((an.type & anchorMask) == 0) return true; if (an.target != null) invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask); break; default: break; } // switch return invalid; }
Example #30
Source File: Analyser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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; }