Java Code Examples for jdk.nashorn.internal.runtime.regexp.joni.ast.Node#isInvalidQuantifier()
The following examples show how to use
jdk.nashorn.internal.runtime.regexp.joni.ast.Node#isInvalidQuantifier() .
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: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 2
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 3
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 4
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 5
Source File: Parser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 6
Source File: Parser.java From hottub with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 7
Source File: Parser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(Node target, boolean group) { while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 8
Source File: Parser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(Node target, boolean group) { while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 9
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(final Node targetp, final boolean group) { Node target = targetp; while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }
Example 10
Source File: Parser.java From nashorn with GNU General Public License v2.0 | 5 votes |
private Node parseExpRepeat(Node target, boolean group) { while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: if (target.isInvalidQuantifier()) { throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); } QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), token.type == TokenType.INTERVAL); qtfr.greedy = token.getRepeatGreedy(); int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd()); Node qn = qtfr; if (token.getRepeatPossessive()) { EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose en.setTarget(qn); qn = en; } if (ret == 0) { target = qn; } else if (ret == 2) { /* split case: /abc+/ */ target = ConsAltNode.newListNode(target, null); ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null)); fetchToken(); return parseExpRepeatForCar(target, tmp, group); } fetchToken(); // goto re_entry } return target; }