private int fetchNameErr(int src, int nameEnd, String err) { newValueException(err, src, nameEnd); return 0; // not reached }
private int fetchNameErr(int src, int nameEnd, String err) { newValueException(err, src, nameEnd); return 0; // not reached }
private void fetchTokenInCCFor_u() { if (!left()) return; int last = p; if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4, 4); if (num < -1) newValueException(TOO_SHORT_DIGITS); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.CODE_POINT; token.base = 16; token.setCode(num); } }
private void fetchTokenFor_uHex() { if (!left()) return; int last = p; if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4, 4); if (num < -1) newValueException(TOO_SHORT_DIGITS); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.CODE_POINT; token.base = 16; token.setCode(num); } }
private void fetchTokenFor_uHex() { if (!left()) return; int last = p; if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4, 4); if (num < -1) newValueException(TOO_SHORT_DIGITS); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.CODE_POINT; token.base = 16; token.setCode(num); } }
private void fetchTokenInCCFor_u() { if (!left()) return; int last = p; if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4, 4); if (num < -1) newValueException(TOO_SHORT_DIGITS); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.CODE_POINT; token.base = 16; token.setCode(num); } }
newValueException(EMPTY_GROUP_NAME); } else { fetch(); if (c == endCode) newValueException(EMPTY_GROUP_NAME); restore(); if (backNum < 0) { newValueException(TOO_BIG_NUMBER); } else if (backNum == 0){ newValueException(INVALID_GROUP_NAME, src, nameEnd); return backNum; } else { newValueException(err, src, nameEnd); return 0; // not reached
newValueException(EMPTY_GROUP_NAME); } else { fetch(); if (c == endCode) newValueException(EMPTY_GROUP_NAME); restore(); if (backNum < 0) { newValueException(TOO_BIG_NUMBER); } else if (backNum == 0){ newValueException(INVALID_GROUP_NAME, src, nameEnd); return backNum; } else { newValueException(err, src, nameEnd); return 0; // not reached
private void fetchTokenInCCFor_digit() { if (syntax.opEscOctal3()) { unfetch(); int last = p; int num = scanUnsignedOctalNumber(3); if (num < 0 || num > 0xff) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 8; token.setC(num); } }
private void fetchTokenInCCFor_digit() { if (syntax.opEscOctal3()) { unfetch(); int last = p; int num = scanUnsignedOctalNumber(3); if (num < 0 || num > 0xff) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 8; token.setC(num); } }
private void fetchTokenFor_zero() { if (syntax.opEscOctal3()) { int last = p; int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3); if (num < 0 || num > 0xff) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 8; token.setC(num); } else if (c != '0') { inc(); } }
private void fetchTokenFor_zero() { if (syntax.opEscOctal3()) { int last = p; int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3); if (num < 0 || num > 0xff) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 8; token.setC(num); } else if (c != '0') { inc(); } }
if (backNum < 0) { backNum = backrefRelToAbs(backNum); if (backNum <= 0) newValueException(INVALID_BACKREF); newValueException(INVALID_BACKREF); } else { NameEntry e = regex.nameToGroupNumbers(bytes, last, nameEnd); if (e == null) newValueException(UNDEFINED_NAME_REFERENCE, last, nameEnd); if (e.backRef1 > env.numMem || env.memNodes == null || env.memNodes[e.backRef1] == null) newValueException(INVALID_BACKREF); } else { for (int i=0; i<e.backNum; i++) { if (e.backRefs[i] > env.numMem || env.memNodes == null || env.memNodes[e.backRefs[i]] == null) newValueException(INVALID_BACKREF);
if (backNum < 0) { backNum = backrefRelToAbs(backNum); if (backNum <= 0) newValueException(INVALID_BACKREF); newValueException(INVALID_BACKREF); } else { NameEntry e = regex.nameToGroupNumbers(bytes, last, nameEnd); if (e == null) newValueException(UNDEFINED_NAME_REFERENCE, last, nameEnd); if (e.backRef1 > env.numMem || env.memNodes == null || env.memNodes[e.backRef1] == null) newValueException(INVALID_BACKREF); } else { for (int i=0; i<e.backNum; i++) { if (e.backRefs[i] > env.numMem || env.memNodes == null || env.memNodes[e.backRefs[i]] == null) newValueException(INVALID_BACKREF);
private void fetchTokenFor_xBrace() { if (!left()) return; int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { inc(); int num = scanUnsignedHexadecimalNumber(0, 8); if (num < 0) newValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); if (left()) { if (enc.isXDigit(peek())) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); } if (p > last + enc.length(bytes, last, stop) && left() && peekIs('}')) { inc(); token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* can't read nothing or invalid format */ p = last; } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(0, 2); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 16; token.setC(num); } }
private void fetchTokenFor_xBrace() { if (!left()) return; int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { inc(); int num = scanUnsignedHexadecimalNumber(0, 8); if (num < 0) newValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); if (left()) { if (enc.isXDigit(peek())) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); } if (p > last + enc.length(bytes, last, stop) && left() && peekIs('}')) { inc(); token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* can't read nothing or invalid format */ p = last; } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(0, 2); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.base = 16; token.setC(num); } }
inc(); int num = scanUnsignedHexadecimalNumber(0, 8); if (num < 0) newValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); if (left()) { int c2 = peek(); if (enc.isXDigit(c2)) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */
inc(); int num = scanUnsignedHexadecimalNumber(0, 8); if (num < 0) newValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); if (left()) { int c2 = peek(); if (enc.isXDigit(c2)) newValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */
private void fetchTokenFor_digit() { unfetch(); int last = p; 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) newValueException(INVALID_BACKREF); } token.type = TokenType.BACKREF; token.setBackrefNum(1); token.setBackrefRef1(num); token.setBackrefByName(false); if (Config.USE_BACKREF_WITH_LEVEL) token.setBackrefExistLevel(false); return; } if (c == '8' || c == '9') { /* normal char */ // skip_backref: p = last; inc(); return; } p = last; fetchTokenFor_zero(); /* fall through */ }
private void fetchTokenFor_digit() { unfetch(); int last = p; 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) newValueException(INVALID_BACKREF); } token.type = TokenType.BACKREF; token.setBackrefNum(1); token.setBackrefRef1(num); token.setBackrefByName(false); if (Config.USE_BACKREF_WITH_LEVEL) token.setBackrefExistLevel(false); return; } if (c == '8' || c == '9') { /* normal char */ // skip_backref: p = last; inc(); return; } p = last; fetchTokenFor_zero(); /* fall through */ }