private Node parseExpTkByte(final boolean group) {
final StringNode node = new StringNode(chars,token.backP,p); // tk_byte:
while (true) {
fetchToken();
if (token.type != TokenType.STRING) {
break;
}
if (token.backP == node.end) {
node.end = p; // non escaped character,remain shared,just increase shared range
} else {
node.cat(chars,p); // non continuous string stream,need to COW
}
}
// targetp = node;
return parseExpRepeat(node,group); // string_end:,goto repeat
}
private Node parseBranch(final TokenType term) {
Node node = parseExp(term);
if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
return node;
}
final ConsAltNode top = ConsAltNode.newListNode(node,null);
ConsAltNode t = top;
while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) {
node = parseExp(term);
if (node.getType() == NodeType.LIST) {
t.setCdr((ConsAltNode)node);
while (((ConsAltNode)node).cdr != null ) {
node = ((ConsAltNode)node).cdr;
}
t = ((ConsAltNode)node);
} else {
t.setCdr(ConsAltNode.newListNode(node,null));
t = t.cdr;
}
}
return top;
}
private Node parseSubExp(final TokenType term) {
Node node = parseBranch(term);
if (token.type == term) {
return node;
} else if (token.type == TokenType.ALT) {
final ConsAltNode top = ConsAltNode.newAltNode(node,null);
ConsAltNode t = top;
while (token.type == TokenType.ALT) {
fetchToken();
node = parseBranch(term);
t.setCdr(ConsAltNode.newAltNode(node,null));
t = t.cdr;
}
if (token.type != term) {
parseSubExpError(term);
}
return top;
} else {
parseSubExpError(term);
return null; //not reached
}
}
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
private void fetchTokenFor_digit() {
unfetch();
final int last = p;
final int num = scanUnsignednumber();
if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
} else if (Syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
if (Syntax.strictCheckBackref()) {
if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
throw new ValueException(ERR_INVALID_BACKREF);
}
}
token.type = TokenType.BACKREF;
token.setBackrefRef(num);
return;
}
if (c == '8' || c == '9') { /* normal char */ // skip_backref:
p = last;
inc();
return;
}
p = last;
fetchTokenFor_zero(); /* fall through */
}
private void fetchTokenFor_zero() {
if (Syntax.opEscOctal3()) {
final int last = p;
int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.RAW_BYTE;
token.setC(num);
} else if (c != '0') {
inc();
}
}
项目:openjdk-jdk10
文件:Parser.java
private Node parseExpTkByte(final boolean group) {
final StringNode node = new StringNode(chars,goto repeat
}
项目:openjdk-jdk10
文件:Parser.java
private Node parseBranch(final TokenType term) {
Node node = parseExp(term);
if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
return node;
}
final ConsAltNode top = ConsAltNode.newListNode(node,null));
t = t.cdr;
}
}
return top;
}
项目:openjdk-jdk10
文件:Parser.java
private Node parseSubExp(final TokenType term) {
Node node = parseBranch(term);
if (token.type == term) {
return node;
} else if (token.type == TokenType.ALT) {
final ConsAltNode top = ConsAltNode.newAltNode(node,null));
t = t.cdr;
}
if (token.type != term) {
parseSubExpError(term);
}
return top;
} else {
parseSubExpError(term);
return null; //not reached
}
}
项目:openjdk-jdk10
文件:Lexer.java
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:openjdk-jdk10
文件:Lexer.java
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:openjdk-jdk10
文件:Lexer.java
private void fetchTokenFor_digit() {
unfetch();
final int last = p;
final int num = scanUnsignednumber();
if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
} else if (Syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
if (Syntax.strictCheckBackref()) {
if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
throw new ValueException(ERR_INVALID_BACKREF);
}
}
token.type = TokenType.BACKREF;
token.setBackrefRef(num);
return;
}
if (c == '8' || c == '9') { /* normal char */ // skip_backref:
p = last;
inc();
return;
}
p = last;
fetchTokenFor_zero(); /* fall through */
}
项目:openjdk-jdk10
文件:Lexer.java
private void fetchTokenFor_zero() {
if (Syntax.opEscOctal3()) {
final int last = p;
int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.RAW_BYTE;
token.setC(num);
} else if (c != '0') {
inc();
}
}
项目:openjdk9
文件:Parser.java
private Node parseExpTkByte(final boolean group) {
final StringNode node = new StringNode(chars,goto repeat
}
项目:openjdk9
文件:Parser.java
private Node parseBranch(final TokenType term) {
Node node = parseExp(term);
if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
return node;
}
final ConsAltNode top = ConsAltNode.newListNode(node,null));
t = t.cdr;
}
}
return top;
}
项目:openjdk9
文件:Parser.java
private Node parseSubExp(final TokenType term) {
Node node = parseBranch(term);
if (token.type == term) {
return node;
} else if (token.type == TokenType.ALT) {
final ConsAltNode top = ConsAltNode.newAltNode(node,null));
t = t.cdr;
}
if (token.type != term) {
parseSubExpError(term);
}
return top;
} else {
parseSubExpError(term);
return null; //not reached
}
}
项目:openjdk9
文件:Lexer.java
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:openjdk9
文件:Lexer.java
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:openjdk9
文件:Lexer.java
private void fetchTokenFor_digit() {
unfetch();
final int last = p;
final int num = scanUnsignednumber();
if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
} else if (Syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
if (Syntax.strictCheckBackref()) {
if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
throw new ValueException(ERR_INVALID_BACKREF);
}
}
token.type = TokenType.BACKREF;
token.setBackrefRef(num);
return;
}
if (c == '8' || c == '9') { /* normal char */ // skip_backref:
p = last;
inc();
return;
}
p = last;
fetchTokenFor_zero(); /* fall through */
}
项目:openjdk9
文件:Lexer.java
private void fetchTokenFor_zero() {
if (Syntax.opEscOctal3()) {
final int last = p;
int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.RAW_BYTE;
token.setC(num);
} else if (c != '0') {
inc();
}
}
项目:kaziranga
文件:Parser.java
private Node parseExpTkByte(final boolean group) {
final StringNode node = new StringNode(chars,goto repeat
}
项目:kaziranga
文件:Parser.java
private Node parseBranch(final TokenType term) {
Node node = parseExp(term);
if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
return node;
}
final ConsAltNode top = ConsAltNode.newListNode(node,null));
t = t.cdr;
}
}
return top;
}
项目:kaziranga
文件:Parser.java
private Node parseSubExp(final TokenType term) {
Node node = parseBranch(term);
if (token.type == term) {
return node;
} else if (token.type == TokenType.ALT) {
final ConsAltNode top = ConsAltNode.newAltNode(node,null));
t = t.cdr;
}
if (token.type != term) {
parseSubExpError(term);
}
return top;
} else {
parseSubExpError(term);
return null; //not reached
}
}
项目:kaziranga
文件:Lexer.java
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:kaziranga
文件:Lexer.java
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:kaziranga
文件:Lexer.java
private void fetchTokenFor_digit() {
unfetch();
final int last = p;
final int num = scanUnsignednumber();
if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
} else if (Syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
if (Syntax.strictCheckBackref()) {
if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
throw new ValueException(ERR_INVALID_BACKREF);
}
}
token.type = TokenType.BACKREF;
token.setBackrefRef(num);
return;
}
if (c == '8' || c == '9') { /* normal char */ // skip_backref:
p = last;
inc();
return;
}
p = last;
fetchTokenFor_zero(); /* fall through */
}
项目:kaziranga
文件:Lexer.java
private void fetchTokenFor_zero() {
if (Syntax.opEscOctal3()) {
final int last = p;
int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.RAW_BYTE;
token.setC(num);
} else if (c != '0') {
inc();
}
}
项目:lookaside_java-1.8.0-openjdk
文件:Parser.java
private Node parseExpTkByte(final boolean group) {
final StringNode node = new StringNode(chars,goto repeat
}
项目:lookaside_java-1.8.0-openjdk
文件:Parser.java
private Node parseBranch(final TokenType term) {
Node node = parseExp(term);
if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
return node;
}
final ConsAltNode top = ConsAltNode.newListNode(node,null));
t = t.cdr;
}
}
return top;
}
项目:lookaside_java-1.8.0-openjdk
文件:Parser.java
private Node parseSubExp(final TokenType term) {
Node node = parseBranch(term);
if (token.type == term) {
return node;
} else if (token.type == TokenType.ALT) {
final ConsAltNode top = ConsAltNode.newAltNode(node,null));
t = t.cdr;
}
if (token.type != term) {
parseSubExpError(term);
}
return top;
} else {
parseSubExpError(term);
return null; //not reached
}
}
项目:lookaside_java-1.8.0-openjdk
文件:Lexer.java
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:lookaside_java-1.8.0-openjdk
文件:Lexer.java
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:lookaside_java-1.8.0-openjdk
文件:Lexer.java
private void fetchTokenFor_digit() {
unfetch();
final int last = p;
final int num = scanUnsignednumber();
if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
} else if (Syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
if (Syntax.strictCheckBackref()) {
if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
throw new ValueException(ERR_INVALID_BACKREF);
}
}
token.type = TokenType.BACKREF;
token.setBackrefRef(num);
return;
}
if (c == '8' || c == '9') { /* normal char */ // skip_backref:
p = last;
inc();
return;
}
p = last;
fetchTokenFor_zero(); /* fall through */
}
项目:lookaside_java-1.8.0-openjdk
文件:Lexer.java
private void fetchTokenFor_zero() {
if (Syntax.opEscOctal3()) {
final int last = p;
int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.RAW_BYTE;
token.setC(num);
} else if (c != '0') {
inc();
}
}
项目:jdk8u_nashorn
文件:Parser.java
private Node parseExpTkByte(final boolean group) {
final StringNode node = new StringNode(chars,goto repeat
}
项目:jdk8u_nashorn
文件:Parser.java
private Node parseBranch(final TokenType term) {
Node node = parseExp(term);
if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
return node;
}
final ConsAltNode top = ConsAltNode.newListNode(node,null));
t = t.cdr;
}
}
return top;
}
项目:jdk8u_nashorn
文件:Parser.java
private Node parseSubExp(final TokenType term) {
Node node = parseBranch(term);
if (token.type == term) {
return node;
} else if (token.type == TokenType.ALT) {
final ConsAltNode top = ConsAltNode.newAltNode(node,null));
t = t.cdr;
}
if (token.type != term) {
parseSubExpError(term);
}
return top;
} else {
parseSubExpError(term);
return null; //not reached
}
}
项目:jdk8u_nashorn
文件:Lexer.java
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
项目:jdk8u_nashorn
文件:Lexer.java
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (Syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but,it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}