This is an automated email from the git hooks/post-receive script. henrich pushed a commit to branch debian/sid in repository jruby-joni.
commit 9a47222f82c2033935eabe786cd497f87cb9c48e Author: Marcin Mielzynski <l...@gazeta.pl> Date: Wed Feb 28 19:03:07 2018 +0100 remove redundant name prefix --- src/org/joni/Analyser.java | 36 ++++----- src/org/joni/ArrayCompiler.java | 26 +++---- src/org/joni/ByteCodeMachine.java | 6 +- src/org/joni/CodeRangeBuffer.java | 4 +- src/org/joni/Compiler.java | 2 +- src/org/joni/Lexer.java | 120 +++++++++++++++--------------- src/org/joni/Parser.java | 84 ++++++++++----------- src/org/joni/Regex.java | 10 +-- src/org/joni/ScanEnvironment.java | 4 +- src/org/joni/UnsetAddrList.java | 2 +- src/org/joni/ast/BackRefNode.java | 2 +- src/org/joni/ast/CClassNode.java | 8 +- src/org/joni/ast/ListNode.java | 2 +- src/org/joni/exception/ErrorMessages.java | 120 +++++++++++++++--------------- test/org/joni/test/TestA.java | 6 +- test/org/joni/test/TestError.java | 58 +++++++-------- 16 files changed, 245 insertions(+), 245 deletions(-) diff --git a/src/org/joni/Analyser.java b/src/org/joni/Analyser.java index dc64921..9e5cdc1 100644 --- a/src/org/joni/Analyser.java +++ b/src/org/joni/Analyser.java @@ -314,7 +314,7 @@ final class Analyser extends Parser { case NodeType.BREF: BackRefNode br = (BackRefNode)node; - if (!br.isNameRef()) newValueException(ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + if (!br.isNameRef()) newValueException(NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); break; case NodeType.ANCHOR: @@ -426,14 +426,14 @@ final class Analyser extends Parser { if (br.isRecursion()) break; if (br.back[0] > env.numMem) { - if (!syntax.op3OptionECMAScript()) newValueException(ERR_INVALID_BACKREF); + if (!syntax.op3OptionECMAScript()) newValueException(INVALID_BACKREF); } else { min = getMinMatchLength(env.memNodes[br.back[0]]); } for (int i=1; i<br.backNum; i++) { if (br.back[i] > env.numMem) { - if (!syntax.op3OptionECMAScript()) newValueException(ERR_INVALID_BACKREF); + if (!syntax.op3OptionECMAScript()) newValueException(INVALID_BACKREF); } else { int tmin = getMinMatchLength(env.memNodes[br.back[i]]); if (min > tmin) min = tmin; @@ -576,7 +576,7 @@ final class Analyser extends Parser { for (int i=0; i<br.backNum; i++) { if (br.back[i] > env.numMem) { - if(!syntax.op3OptionECMAScript()) newValueException(ERR_INVALID_BACKREF); + if(!syntax.op3OptionECMAScript()) newValueException(INVALID_BACKREF); } else { int tmax = getMaxMatchLength(env.memNodes[br.back[i]]); if (max < tmax) max = tmax; @@ -1167,7 +1167,7 @@ final class Analyser extends Parser { if (en.isRecursion()) { en.setMark1(); r = subexpInfRecursiveCheck(en.target, true); - if (r > 0) newValueException(ERR_NEVER_ENDING_RECURSION); + if (r > 0) newValueException(NEVER_ENDING_RECURSION); en.clearMark1(); } r = subexpInfRecursiveCheckTrav(en.target); @@ -1294,7 +1294,7 @@ final class Analyser extends Parser { private void setCallAttr(CallNode cn) { EncloseNode en = env.memNodes[cn.groupNum]; - if (en == null) newValueException(ERR_UNDEFINED_NAME_REFERENCE, cn.nameP, cn.nameEnd); + if (en == null) newValueException(UNDEFINED_NAME_REFERENCE, cn.nameP, cn.nameEnd); en.setCalled(); cn.setTarget(en); env.btMemStart = BitStatus.bsOnAt(env.btMemStart, cn.groupNum); @@ -1333,10 +1333,10 @@ final class Analyser extends Parser { if (Config.USE_NAMED_GROUP) { if (env.numNamed > 0 && syntax.captureOnlyNamedGroup() && !isCaptureGroup(env.option)) { - newValueException(ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + newValueException(NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); } } // USE_NAMED_GROUP - if (gNum > env.numMem) newValueException(ERR_UNDEFINED_GROUP_REFERENCE, cn.nameP, cn.nameEnd); + if (gNum > env.numMem) newValueException(UNDEFINED_GROUP_REFERENCE, cn.nameP, cn.nameEnd); setCallAttr(cn); } else { if (Config.USE_NAMED_GROUP) { @@ -1346,9 +1346,9 @@ final class Analyser extends Parser { NameEntry ne = regex.nameToGroupNumbers(cn.name, cn.nameP, cn.nameEnd); if (ne == null) { - newValueException(ERR_UNDEFINED_NAME_REFERENCE, cn.nameP, cn.nameEnd); + newValueException(UNDEFINED_NAME_REFERENCE, cn.nameP, cn.nameEnd); } else if (ne.backNum > 1) { - newValueException(ERR_MULTIPLEX_DEFINITION_NAME_CALL, cn.nameP, cn.nameEnd); + newValueException(MULTIPLEX_DEFINITION_NAME_CALL, cn.nameP, cn.nameEnd); } else { cn.groupNum = ne.backRef1; // ne.backNum == 1 ? ne.backRef1 : ne.backRefs[0]; // ??? need to check ? setCallAttr(cn); @@ -1416,13 +1416,13 @@ final class Analyser extends Parser { node.charLength = len; break; case GET_CHAR_LEN_VARLEN: - newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + newSyntaxException(INVALID_LOOK_BEHIND_PATTERN); break; case GET_CHAR_LEN_TOP_ALT_VARLEN: if (syntax.differentLengthAltLookBehind()) { return divideLookBehindAlternatives(node); } else { - newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + newSyntaxException(INVALID_LOOK_BEHIND_PATTERN); } } return node; @@ -1872,7 +1872,7 @@ final class Analyser extends Parser { BackRefNode br = (BackRefNode)node; for (int i=0; i<br.backNum; i++) { if (br.back[i] > env.numMem) { - if (!syntax.op3OptionECMAScript()) newValueException(ERR_INVALID_BACKREF); + if (!syntax.op3OptionECMAScript()) newValueException(INVALID_BACKREF); } else { env.backrefedMem = bsOnAt(env.backrefedMem, br.back[i]); env.btMemStart = bsOnAt(env.btMemStart, br.back[i]); @@ -1990,10 +1990,10 @@ final class Analyser extends Parser { case EncloseNode.CONDITION: if (Config.USE_NAMED_GROUP) { if (!en.isNameRef() && env.numNamed > 0 && syntax.captureOnlyNamedGroup() && !isCaptureGroup(env.option)) { - newValueException(ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + newValueException(NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); } } - if (en.regNum > env.numMem) newValueException(ERR_INVALID_BACKREF); + if (en.regNum > env.numMem) newValueException(INVALID_BACKREF); setupTree(en.target, state); break; @@ -2015,7 +2015,7 @@ final class Analyser extends Parser { break; case AnchorType.LOOK_BEHIND: - if (checkTypeTree(an.target, NodeType.ALLOWED_IN_LB, EncloseType.ALLOWED_IN_LB, AnchorType.ALLOWED_IN_LB)) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + if (checkTypeTree(an.target, NodeType.ALLOWED_IN_LB, EncloseType.ALLOWED_IN_LB, AnchorType.ALLOWED_IN_LB)) newSyntaxException(INVALID_LOOK_BEHIND_PATTERN); node = setupLookBehind(an); if (node.getType() != NodeType.ANCHOR) continue restart; setupTree(((AnchorNode)node).target, state); @@ -2023,7 +2023,7 @@ final class Analyser extends Parser { break; case AnchorType.LOOK_BEHIND_NOT: - if (checkTypeTree(an.target, NodeType.ALLOWED_IN_LB, EncloseType.ALLOWED_IN_LB_NOT, AnchorType.ALLOWED_IN_LB_NOT)) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + if (checkTypeTree(an.target, NodeType.ALLOWED_IN_LB, EncloseType.ALLOWED_IN_LB_NOT, AnchorType.ALLOWED_IN_LB_NOT)) newSyntaxException(INVALID_LOOK_BEHIND_PATTERN); node = setupLookBehind(an); if (node.getType() != NodeType.ANCHOR) continue restart; setupTree(((AnchorNode)node).target, (state | IN_NOT)); @@ -2329,7 +2329,7 @@ final class Analyser extends Parser { } default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } // switch } diff --git a/src/org/joni/ArrayCompiler.java b/src/org/joni/ArrayCompiler.java index 00af9b7..be71bb1 100644 --- a/src/org/joni/ArrayCompiler.java +++ b/src/org/joni/ArrayCompiler.java @@ -337,7 +337,7 @@ final class ArrayCompiler extends Compiler { break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); return; // not reached } // inner switch addOpcode(op); @@ -872,20 +872,20 @@ final class ArrayCompiler extends Compiler { ListNode x = (ListNode)node.target; tlen = compileLengthTree(x.value); /* yes-node */ len += tlen + OPSize.JUMP; - if (x.tail == null) newInternalException(ERR_PARSER_BUG); + if (x.tail == null) newInternalException(PARSER_BUG); x = x.tail; tlen = compileLengthTree(x.value); /* no-node */ len += tlen; - if (x.tail != null) newSyntaxException(ERR_INVALID_CONDITION_PATTERN); + if (x.tail != null) newSyntaxException(INVALID_CONDITION_PATTERN); } else { - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } break; case EncloseType.ABSENT: len = OPSize.PUSH_ABSENT_POS + OPSize.ABSENT + tlen + OPSize.ABSENT_END; break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); return 0; // not reached } // switch return len; @@ -972,10 +972,10 @@ final class ArrayCompiler extends Compiler { if (node.target.getType() == NodeType.ALT) { ListNode x = (ListNode)node.target; len = compileLengthTree(x.value); /* yes-node */ - if (x.tail == null) newInternalException(ERR_PARSER_BUG); + if (x.tail == null) newInternalException(PARSER_BUG); x = x.tail; int len2 = compileLengthTree(x.value); /* no-node */ - if (x.tail != null) newSyntaxException(ERR_INVALID_CONDITION_PATTERN); + if (x.tail != null) newSyntaxException(INVALID_CONDITION_PATTERN); x = (ListNode)node.target; addRelAddr(len + OPSize.JUMP); compileTree(x.value); /* yes-node */ @@ -983,7 +983,7 @@ final class ArrayCompiler extends Compiler { x = x.tail; compileTree(x.value); /* no-node */ } else { - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } break; @@ -997,7 +997,7 @@ final class ArrayCompiler extends Compiler { break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); break; } // switch } @@ -1107,7 +1107,7 @@ final class ArrayCompiler extends Compiler { addOpcode(OPCode.LOOK_BEHIND); if (node.charLength < 0) { n = analyser.getCharLengthTree(node.target); - if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + if (analyser.returnCode != 0) newSyntaxException(INVALID_LOOK_BEHIND_PATTERN); } else { n = node.charLength; } @@ -1121,7 +1121,7 @@ final class ArrayCompiler extends Compiler { addOpcodeRelAddr(OPCode.PUSH_LOOK_BEHIND_NOT, len + OPSize.FAIL_LOOK_BEHIND_NOT); if (node.charLength < 0) { n = analyser.getCharLengthTree(node.target); - if (analyser.returnCode != 0) newSyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN); + if (analyser.returnCode != 0) newSyntaxException(INVALID_LOOK_BEHIND_PATTERN); } else { n = node.charLength; } @@ -1131,7 +1131,7 @@ final class ArrayCompiler extends Compiler { break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } // switch } @@ -1214,7 +1214,7 @@ final class ArrayCompiler extends Compiler { break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } //switch return len; diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java index 9e74e0a..218d0e8 100644 --- a/src/org/joni/ByteCodeMachine.java +++ b/src/org/joni/ByteCodeMachine.java @@ -317,7 +317,7 @@ class ByteCodeMachine extends StackMachine { case OPCode.STATE_CHECK: if (USE_CEC) {opStateCheck(); continue;} default: - throw new InternalException(ErrorMessages.ERR_UNDEFINED_BYTECODE); + throw new InternalException(ErrorMessages.UNDEFINED_BYTECODE); } // main switch } // main while @@ -455,7 +455,7 @@ class ByteCodeMachine extends StackMachine { case OPCode.STATE_CHECK: if (USE_CEC) {opStateCheck(); continue;} default: - throw new InternalException(ErrorMessages.ERR_UNDEFINED_BYTECODE); + throw new InternalException(ErrorMessages.UNDEFINED_BYTECODE); } // main switch } // main while @@ -1587,7 +1587,7 @@ class ByteCodeMachine extends StackMachine { ip++; // p += SIZE_MEMNUM; break; default: - throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE); + throw new InternalException(ErrorMessages.UNEXPECTED_BYTECODE); } // switch } diff --git a/src/org/joni/CodeRangeBuffer.java b/src/org/joni/CodeRangeBuffer.java index 6d41679..2eebb6e 100644 --- a/src/org/joni/CodeRangeBuffer.java +++ b/src/org/joni/CodeRangeBuffer.java @@ -134,7 +134,7 @@ public final class CodeRangeBuffer { int incN = low + 1 - high; - if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) throw new ValueException(ErrorMessages.ERR_TOO_MANY_MULTI_BYTE_RANGES); + if (n + incN > Config.MAX_MULTI_BYTE_RANGES_NUM) throw new ValueException(ErrorMessages.TOO_MANY_MULTI_BYTE_RANGES); if (incN != 1) { if (checkDup) { @@ -179,7 +179,7 @@ public final class CodeRangeBuffer { if (env.syntax.allowEmptyRangeInCC()) { return pbuf; } else { - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); + throw new ValueException(ErrorMessages.EMPTY_RANGE_IN_CHAR_CLASS); } } return addCodeRangeToBuff(pbuf, env, from, to, checkDup); diff --git a/src/org/joni/Compiler.java b/src/org/joni/Compiler.java index 4e6777b..635d752 100644 --- a/src/org/joni/Compiler.java +++ b/src/org/joni/Compiler.java @@ -172,7 +172,7 @@ abstract class Compiler implements ErrorMessages { default: // undefined node type - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } // switch } diff --git a/src/org/joni/Lexer.java b/src/org/joni/Lexer.java index 221acca..3f6e65b 100644 --- a/src/org/joni/Lexer.java +++ b/src/org/joni/Lexer.java @@ -56,20 +56,20 @@ class Lexer extends ScannerSupport { if (synAllow) { return 1; /* "....{" : OK! */ } else { - newSyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); + newSyntaxException(END_PATTERN_AT_LEFT_BRACE); } } if (!synAllow) { c = peek(); if (c == ')' || c == '(' || c == '|') { - newSyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); + newSyntaxException(END_PATTERN_AT_LEFT_BRACE); } } int low = scanUnsignedNumber(); - if (low < 0) newSyntaxException(ErrorMessages.ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); - if (low > Config.MAX_REPEAT_NUM) newSyntaxException(ErrorMessages.ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); + if (low < 0) newSyntaxException(ErrorMessages.TOO_BIG_NUMBER_FOR_REPEAT_RANGE); + if (low > Config.MAX_REPEAT_NUM) newSyntaxException(ErrorMessages.TOO_BIG_NUMBER_FOR_REPEAT_RANGE); boolean nonLow = false; if (p == _p) { /* can't read low */ @@ -89,8 +89,8 @@ class Lexer extends ScannerSupport { if (c == ',') { int prev = p; // ??? last up = scanUnsignedNumber(); - if (up < 0) newValueException(ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); - if (up > Config.MAX_REPEAT_NUM) newValueException(ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); + if (up < 0) newValueException(TOO_BIG_NUMBER_FOR_REPEAT_RANGE); + if (up > Config.MAX_REPEAT_NUM) newValueException(TOO_BIG_NUMBER_FOR_REPEAT_RANGE); if (p == prev) { if (nonLow) return invalidRangeQuantifier(synAllow); @@ -114,7 +114,7 @@ class Lexer extends ScannerSupport { if (c != '}') return invalidRangeQuantifier(synAllow); if (!isRepeatInfinite(up) && low > up) { - newValueException(ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); + newValueException(UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); } token.type = TokenType.INTERVAL; @@ -129,24 +129,24 @@ class Lexer extends ScannerSupport { restore(); return 1; } else { - newSyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN); + newSyntaxException(INVALID_REPEAT_RANGE_PATTERN); return 0; // not reached } } /* \M-, \C-, \c, or \... */ private void fetchEscapedValue() { - if (!left()) newSyntaxException(ERR_END_PATTERN_AT_ESCAPE); + if (!left()) newSyntaxException(END_PATTERN_AT_ESCAPE); fetch(); switch(c) { case 'M': if (syntax.op2EscCapitalMBarMeta()) { - if (!left()) newSyntaxException(ERR_END_PATTERN_AT_META); + if (!left()) newSyntaxException(END_PATTERN_AT_META); fetch(); - if (c != '-') newSyntaxException(ERR_META_CODE_SYNTAX); - if (!left()) newSyntaxException(ERR_END_PATTERN_AT_META); + if (c != '-') newSyntaxException(META_CODE_SYNTAX); + if (!left()) newSyntaxException(END_PATTERN_AT_META); fetch(); if (c == syntax.metaCharTable.esc) fetchEscapedValue(); c = ((c & 0xff) | 0x80); @@ -157,9 +157,9 @@ class Lexer extends ScannerSupport { case 'C': if (syntax.op2EscCapitalCBarControl()) { - if (!left()) newSyntaxException(ERR_END_PATTERN_AT_CONTROL); + if (!left()) newSyntaxException(END_PATTERN_AT_CONTROL); fetch(); - if (c != '-') newSyntaxException(ERR_CONTROL_CODE_SYNTAX); + if (c != '-') newSyntaxException(CONTROL_CODE_SYNTAX); fetchEscapedValueControl(); } else { fetchEscapedValueBackSlash(); @@ -186,7 +186,7 @@ class Lexer extends ScannerSupport { if (syntax.op3OptionECMAScript()) { return; } else { - newSyntaxException(ERR_END_PATTERN_AT_CONTROL); + newSyntaxException(END_PATTERN_AT_CONTROL); } } fetch(); @@ -233,10 +233,10 @@ class Lexer extends ScannerSupport { String err = null; if (!left()) { - newValueException(ERR_EMPTY_GROUP_NAME); + newValueException(EMPTY_GROUP_NAME); } else { fetch(); - if (c == endCode) newValueException(ERR_EMPTY_GROUP_NAME); + if (c == endCode) newValueException(EMPTY_GROUP_NAME); if (enc.isDigit(c)) { isNum = 1; } else if (c == '-') { @@ -250,7 +250,7 @@ class Lexer extends ScannerSupport { nameEnd = p; fetch(); if (c == endCode || c == ')' || c == '+' || c == '-') { - if (isNum == 2) err = ERR_INVALID_GROUP_NAME; + if (isNum == 2) err = INVALID_GROUP_NAME; break; } @@ -258,7 +258,7 @@ class Lexer extends ScannerSupport { if (enc.isDigit(c)) { isNum = 1; } else { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; // isNum = 0; } } @@ -270,10 +270,10 @@ class Lexer extends ScannerSupport { int flag = c == '-' ? -1 : 1; fetch(); - if (!enc.isDigit(c)) newValueException(ERR_INVALID_GROUP_NAME, src, stop); + if (!enc.isDigit(c)) newValueException(INVALID_GROUP_NAME, src, stop); unfetch(); int level = scanUnsignedNumber(); - if (level < 0) newValueException(ERR_TOO_BIG_NUMBER); + if (level < 0) newValueException(TOO_BIG_NUMBER); rlevel.p = level * flag; existLevel = true; @@ -282,7 +282,7 @@ class Lexer extends ScannerSupport { } if (!isEndCode) { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; nameEnd = stop; } } @@ -294,16 +294,16 @@ class Lexer extends ScannerSupport { int backNum = scanUnsignedNumber(); restore(); if (backNum < 0) { - newValueException(ERR_TOO_BIG_NUMBER); + newValueException(TOO_BIG_NUMBER); } else if (backNum == 0) { - newValueException(ERR_INVALID_GROUP_NAME, src, stop); + newValueException(INVALID_GROUP_NAME, src, stop); } rbackNum.p = backNum * sign; } value = nameEnd; return existLevel; } else { - newValueException(ERR_INVALID_GROUP_NAME, src, nameEnd); + newValueException(INVALID_GROUP_NAME, src, nameEnd); return false; // not reached } } @@ -324,15 +324,15 @@ class Lexer extends ScannerSupport { String err = null; if (!left()) { - newValueException(ERR_EMPTY_GROUP_NAME); + newValueException(EMPTY_GROUP_NAME); } else { fetch(); - if (c == endCode) newValueException(ERR_EMPTY_GROUP_NAME); + if (c == endCode) newValueException(EMPTY_GROUP_NAME); if (enc.isDigit(c)) { if (ref) { isNum = 1; } else { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; // isNum = 0; } } else if (c == '-') { @@ -341,7 +341,7 @@ class Lexer extends ScannerSupport { sign = -1; pnumHead = p; } else { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; // isNum = 0; } } @@ -353,7 +353,7 @@ class Lexer extends ScannerSupport { fetch(); if (c == endCode || c == ')') { if (isNum == 2) { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; return fetchNameTeardown(src, endCode, nameEnd, err); } break; @@ -364,9 +364,9 @@ class Lexer extends ScannerSupport { isNum = 1; } else { if (!enc.isWord(c)) { - err = ERR_INVALID_CHAR_IN_GROUP_NAME; + err = INVALID_CHAR_IN_GROUP_NAME; } else { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; } return fetchNameTeardown(src, endCode, nameEnd, err); } @@ -374,7 +374,7 @@ class Lexer extends ScannerSupport { } if (c != endCode) { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; nameEnd = stop; return fetchNameErr(src, nameEnd, err); } @@ -386,9 +386,9 @@ class Lexer extends ScannerSupport { backNum = scanUnsignedNumber(); restore(); if (backNum < 0) { - newValueException(ERR_TOO_BIG_NUMBER); + newValueException(TOO_BIG_NUMBER); } else if (backNum == 0) { - newValueException(ERR_INVALID_GROUP_NAME, src, nameEnd); + newValueException(INVALID_GROUP_NAME, src, nameEnd); } backNum *= sign; } @@ -429,10 +429,10 @@ class Lexer extends ScannerSupport { String err = null; if (!left()) { - newValueException(ERR_EMPTY_GROUP_NAME); + newValueException(EMPTY_GROUP_NAME); } else { fetch(); - if (c == endCode) newValueException(ERR_EMPTY_GROUP_NAME); + if (c == endCode) newValueException(EMPTY_GROUP_NAME); if (enc.isDigit(c)) { isNum = 1; @@ -441,7 +441,7 @@ class Lexer extends ScannerSupport { sign = -1; pnumHead = p; } else { - err = ERR_INVALID_CHAR_IN_GROUP_NAME; + err = INVALID_CHAR_IN_GROUP_NAME; } } @@ -450,11 +450,11 @@ class Lexer extends ScannerSupport { fetch(); if (c == endCode || c == ')') break; - if (!enc.isDigit(c)) err = ERR_INVALID_CHAR_IN_GROUP_NAME; + if (!enc.isDigit(c)) err = INVALID_CHAR_IN_GROUP_NAME; } if (err == null && c != endCode) { - err = ERR_INVALID_GROUP_NAME; + err = INVALID_GROUP_NAME; nameEnd = stop; } @@ -464,9 +464,9 @@ class Lexer extends ScannerSupport { int backNum = scanUnsignedNumber(); restore(); if (backNum < 0) { - newValueException(ERR_TOO_BIG_NUMBER); + newValueException(TOO_BIG_NUMBER); } else if (backNum == 0){ - newValueException(ERR_INVALID_GROUP_NAME, src, nameEnd); + newValueException(INVALID_GROUP_NAME, src, nameEnd); } backNum *= sign; @@ -570,7 +570,7 @@ class Lexer extends ScannerSupport { } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(0, 2); - if (num < 0) newValueException(ERR_TOO_BIG_NUMBER); + if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } @@ -586,8 +586,8 @@ class Lexer extends ScannerSupport { if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4, 4); - if (num < -1) newValueException(ERR_TOO_SHORT_DIGITS); - if (num < 0) newValueException(ERR_TOO_BIG_NUMBER); + 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 */ } @@ -602,7 +602,7 @@ class Lexer extends ScannerSupport { unfetch(); int last = p; int num = scanUnsignedOctalNumber(3); - if (num < 0 || num > 0xff) newValueException(ERR_TOO_BIG_NUMBER); + if (num < 0 || num > 0xff) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } @@ -661,7 +661,7 @@ class Lexer extends ScannerSupport { token.type = TokenType.CC_RANGE; } else if (c == syntax.metaCharTable.esc) { if (!syntax.backSlashEscapeInCC()) return token.type; - if (!left()) newSyntaxException(ERR_END_PATTERN_AT_ESCAPE); + if (!left()) newSyntaxException(END_PATTERN_AT_ESCAPE); fetch(); token.escaped = true; token.setC(c); @@ -784,7 +784,7 @@ class Lexer extends ScannerSupport { } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(0, 2); - if (num < 0) newValueException(ERR_TOO_BIG_NUMBER); + if (num < 0) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } @@ -800,8 +800,8 @@ class Lexer extends ScannerSupport { if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4, 4); - if (num < -1) newValueException(ERR_TOO_SHORT_DIGITS); - if (num < 0) newValueException(ERR_TOO_BIG_NUMBER); + 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 */ } @@ -818,7 +818,7 @@ class Lexer extends ScannerSupport { 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(ERR_INVALID_BACKREF); + if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) newValueException(INVALID_BACKREF); } token.type = TokenType.BACKREF; token.setBackrefNum(1); @@ -842,7 +842,7 @@ class Lexer extends ScannerSupport { if (syntax.opEscOctal3()) { int last = p; int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3); - if (num < 0 || num > 0xff) newValueException(ERR_TOO_BIG_NUMBER); + if (num < 0 || num > 0xff) newValueException(TOO_BIG_NUMBER); if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } @@ -933,11 +933,11 @@ class Lexer extends ScannerSupport { if (backNum != 0) { if (backNum < 0) { backNum = backrefRelToAbs(backNum); - if (backNum <= 0) newValueException(ERR_INVALID_BACKREF); + if (backNum <= 0) newValueException(INVALID_BACKREF); } if (syntax.strictCheckBackref() && (backNum > env.numMem || env.memNodes == null)) { - newValueException(ERR_INVALID_BACKREF); + newValueException(INVALID_BACKREF); } token.type = TokenType.BACKREF; token.setBackrefByName(false); @@ -945,18 +945,18 @@ class Lexer extends ScannerSupport { token.setBackrefRef1(backNum); } else { NameEntry e = env.reg.nameToGroupNumbers(bytes, last, nameEnd); - if (e == null) newValueException(ERR_UNDEFINED_NAME_REFERENCE, last, nameEnd); + if (e == null) newValueException(UNDEFINED_NAME_REFERENCE, last, nameEnd); if (syntax.strictCheckBackref()) { if (e.backNum == 1) { if (e.backRef1 > env.numMem || env.memNodes == null || - env.memNodes[e.backRef1] == null) newValueException(ERR_INVALID_BACKREF); + 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(ERR_INVALID_BACKREF); + env.memNodes[e.backRefs[i]] == null) newValueException(INVALID_BACKREF); } } } @@ -1024,7 +1024,7 @@ class Lexer extends ScannerSupport { fetch(); if (c == syntax.metaCharTable.esc && !syntax.op2IneffectiveEscape()) { // IS_MC_ESC_CODE(code, syn) - if (!left()) newSyntaxException(ERR_END_PATTERN_AT_ESCAPE); + if (!left()) newSyntaxException(END_PATTERN_AT_ESCAPE); token.backP = p; fetch(); @@ -1208,7 +1208,7 @@ class Lexer extends ScannerSupport { if (peekIs('#')) { fetch(); while (true) { - if (!left()) newSyntaxException(ERR_END_PATTERN_IN_GROUP); + if (!left()) newSyntaxException(END_PATTERN_IN_GROUP); fetch(); if (c == syntax.metaCharTable.esc) { if (left()) fetch(); @@ -1307,7 +1307,7 @@ class Lexer extends ScannerSupport { throw new CharacterPropertyException(ERR_INVALID_CHAR_PROPERTY_NAME, bytes, _p, last); } } - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); return 0; // not reached } diff --git a/src/org/joni/Parser.java b/src/org/joni/Parser.java index f21ee3b..2c62336 100644 --- a/src/org/joni/Parser.java +++ b/src/org/joni/Parser.java @@ -82,7 +82,7 @@ class Parser extends Lexer { if (enc.strNCmp(bytes, p, stop, name, 0, name.length) == 0) { p = enc.step(bytes, p, stop, name.length); if (enc.strNCmp(bytes, p, stop, BRACKET_END, 0, BRACKET_END.length) != 0) { - newSyntaxException(ERR_INVALID_POSIX_BRACKET_TYPE); + newSyntaxException(INVALID_POSIX_BRACKET_TYPE); } int ctype = PosixBracket.PBSValues[i]; cc.addCType(ctype, not, asciiRange, env, this); @@ -111,7 +111,7 @@ class Parser extends Lexer { inc(); if (left()) { fetch(); - if (c == ']') newSyntaxException(ERR_INVALID_POSIX_BRACKET_TYPE); + if (c == ']') newSyntaxException(INVALID_POSIX_BRACKET_TYPE); } } restore(); @@ -153,7 +153,7 @@ class Parser extends Lexer { } if (token.type == TokenType.CC_CLOSE && !syntax.op3OptionECMAScript()) { - if (!codeExistCheck(']', true)) newSyntaxException(ERR_EMPTY_CHAR_CLASS); + if (!codeExistCheck(']', true)) newSyntaxException(EMPTY_CHAR_CLASS); env.ccEscWarn("]"); token.type = TokenType.CHAR; /* allow []...] */ } @@ -196,11 +196,11 @@ class Parser extends Lexer { } buf[i] = (byte)token.getC(); } - if (i < enc.minLength()) newValueException(ERR_TOO_SHORT_MULTI_BYTE_STRING); + if (i < enc.minLength()) newValueException(TOO_SHORT_MULTI_BYTE_STRING); len = enc.length(buf, 0, i); if (i < len) { - newValueException(ERR_TOO_SHORT_MULTI_BYTE_STRING); + newValueException(TOO_SHORT_MULTI_BYTE_STRING); } else if (i > len) { /* fetch back */ p = psave; for (i=1; i<len; i++) fetchTokenInCC(); @@ -272,7 +272,7 @@ class Parser extends Lexer { parseCharClassRangeEndVal(cc, ascCc, arg); // goto range_end_val break; } - if (arg.type == CCVALTYPE.CLASS) newValueException(ERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS); + if (arg.type == CCVALTYPE.CLASS) newValueException(UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS); arg.state = CCSTATE.RANGE; } else if (arg.state == CCSTATE.START) { arg.to = token.getC(); /* [-xa] is allowed */ @@ -304,7 +304,7 @@ class Parser extends Lexer { parseCharClassRangeEndVal(cc, ascCc, arg); // goto range_end_val break; } - newSyntaxException(ERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS); + newSyntaxException(UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS); } break; @@ -346,10 +346,10 @@ class Parser extends Lexer { break; case EOT: - newSyntaxException(ERR_PREMATURE_END_OF_CHAR_CLASS); + newSyntaxException(PREMATURE_END_OF_CHAR_CLASS); default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } // switch if (!fetched) fetchTokenInCC(); @@ -421,13 +421,13 @@ class Parser extends Lexer { private Node parseEnclose(TokenType term) { Node node = null; - if (!left()) newSyntaxException(ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + if (!left()) newSyntaxException(END_PATTERN_WITH_UNMATCHED_PARENTHESIS); int option = env.option; if (peekIs('?') && syntax.op2QMarkGroupEffect()) { inc(); - if (!left()) newSyntaxException(ERR_END_PATTERN_IN_GROUP); + if (!left()) newSyntaxException(END_PATTERN_IN_GROUP); boolean listCapture = false; @@ -455,7 +455,7 @@ class Parser extends Lexer { node = new EncloseNode(EncloseType.ABSENT); break; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } case '\'': if (Config.USE_NAMED_GROUP) { @@ -464,7 +464,7 @@ class Parser extends Lexer { node = parseEncloseNamedGroup2(listCapture); break; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } } // USE_NAMED_GROUP break; @@ -484,11 +484,11 @@ class Parser extends Lexer { node = parseEncloseNamedGroup2(listCapture); // named_group2: break; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } } else { // USE_NAMED_GROUP - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } // USE_NAMED_GROUP } break; @@ -506,11 +506,11 @@ class Parser extends Lexer { } // USE_NAMED_GROUP EncloseNode en = EncloseNode.newMemory(env.option, false); int num = env.addMemEntry(); - if (num >= BitStatus.BIT_STATUS_BITS_NUM) newValueException(ERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY); + if (num >= BitStatus.BIT_STATUS_BITS_NUM) newValueException(GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY); en.regNum = num; node = en; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } break; @@ -523,7 +523,7 @@ class Parser extends Lexer { unfetch(); num = fetchName('(', true); if (syntax.strictCheckBackref()) { - if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) newValueException(ERR_INVALID_BACKREF); + if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) newValueException(INVALID_BACKREF); } } else { if (Config.USE_NAMED_GROUP) { @@ -534,7 +534,7 @@ class Parser extends Lexer { num = token.getBackrefNum() > 1 ? token.getBackrefRefs()[0] : token.getBackrefRef1(); } } else { // USE_NAMED_GROUP - newSyntaxException(ERR_INVALID_CONDITION_PATTERN); + newSyntaxException(INVALID_CONDITION_PATTERN); } } EncloseNode en = new EncloseNode(EncloseType.CONDITION); @@ -542,7 +542,7 @@ class Parser extends Lexer { if (name != -1) en.setNameRef(); node = en; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } break; @@ -556,7 +556,7 @@ class Parser extends Lexer { option = bsOnOff(option, Option.EXTEND, true); fetch(); } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } // case 'p': #ifdef USE_POSIXLINE_OPTION @@ -588,7 +588,7 @@ class Parser extends Lexer { if (syntax.op2OptionPerl()) { option = bsOnOff(option, Option.MULTILINE, neg); } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } break; case 'm': @@ -597,7 +597,7 @@ class Parser extends Lexer { } else if (syntax.op2OptionRuby()) { option = bsOnOff(option, Option.MULTILINE, neg); } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } break; // case 'p': #ifdef USE_POSIXLINE_OPTION // not defined @@ -611,7 +611,7 @@ class Parser extends Lexer { option = bsOnOff(option, Option.WORD_BOUND_ALL_RANGE, true); break; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } case 'u': if ((syntax.op2OptionPerl() || syntax.op2OptionRuby()) && !neg) { @@ -620,7 +620,7 @@ class Parser extends Lexer { option = bsOnOff(option, Option.WORD_BOUND_ALL_RANGE, true); break; } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } case 'd': @@ -631,7 +631,7 @@ class Parser extends Lexer { option = bsOnOff(option, Option.POSIX_BRACKET_ALL_RANGE, false); option = bsOnOff(option, Option.WORD_BOUND_ALL_RANGE, false); } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } break; @@ -639,11 +639,11 @@ class Parser extends Lexer { if (syntax.op2OptionPerl() && !neg) { option = bsOnOff(option, Option.ASCII_RANGE, true); } else { - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } break; default: - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } // switch if (c == ')') { @@ -663,12 +663,12 @@ class Parser extends Lexer { returnCode = 0; return node; } - if (!left()) newSyntaxException(ERR_END_PATTERN_IN_GROUP); + if (!left()) newSyntaxException(END_PATTERN_IN_GROUP); fetch(); } // while default: - newSyntaxException(ERR_UNDEFINED_GROUP_OPTION); + newSyntaxException(UNDEFINED_GROUP_OPTION); } // switch } else { @@ -717,7 +717,7 @@ class Parser extends Lexer { int num = fetchName(c, false); int nameEnd = value; num = env.addMemEntry(); - if (listCapture && num >= BitStatus.BIT_STATUS_BITS_NUM) newValueException(ERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY); + if (listCapture && num >= BitStatus.BIT_STATUS_BITS_NUM) newValueException(GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY); regex.nameAdd(bytes, nm, nameEnd, num, syntax); EncloseNode en = EncloseNode.newMemory(env.option, true); @@ -780,7 +780,7 @@ class Parser extends Lexer { } break; case SUBEXP_CLOSE: - if (!syntax.allowUnmatchedCloseSubexp()) newSyntaxException(ERR_UNMATCHED_CLOSE_PARENTHESIS); + if (!syntax.allowUnmatchedCloseSubexp()) newSyntaxException(UNMATCHED_CLOSE_PARENTHESIS); if (token.escaped) { return parseExpTkRawByte(group); // goto tk_raw_byte } else { @@ -854,7 +854,7 @@ class Parser extends Lexer { case INTERVAL: if (syntax.contextIndepRepeatOps()) { if (syntax.contextInvalidRepeatOps()) { - newSyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); + newSyntaxException(TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); } else { node = StringNode.EMPTY; // node_new_empty } @@ -864,7 +864,7 @@ class Parser extends Lexer { break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } //switch //targetp = node; @@ -1305,7 +1305,7 @@ class Parser extends Lexer { if (token.type != TokenType.RAW_BYTE) { /* Don't use this, it is wrong for little endian encodings. */ // USE_PAD_TO_SHORT_BYTE_CHAR ... - newValueException(ERR_TOO_SHORT_MULTI_BYTE_STRING); + newValueException(TOO_SHORT_MULTI_BYTE_STRING); } node.catByte((byte)token.getC()); len++; @@ -1314,10 +1314,10 @@ class Parser extends Lexer { private Node parseExpRepeat(Node target, boolean group) { while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: - if (isInvalidQuantifier(target)) newSyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); + if (isInvalidQuantifier(target)) newSyntaxException(TARGET_OF_REPEAT_OPERATOR_INVALID); if (!group && syntax.op3OptionECMAScript() && target.getType() == NodeType.QTFR) { - newSyntaxException(ERR_NESTED_REPEAT_NOT_ALLOWED); + newSyntaxException(NESTED_REPEAT_NOT_ALLOWED); } QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), @@ -1350,7 +1350,7 @@ class Parser extends Lexer { private Node parseExpRepeatForCar(Node top, ListNode target, boolean group) { while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat: - if (isInvalidQuantifier(target.value)) newSyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID); + if (isInvalidQuantifier(target.value)) newSyntaxException(TARGET_OF_REPEAT_OPERATOR_INVALID); QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(), token.getRepeatUpper(), @@ -1436,7 +1436,7 @@ class Parser extends Lexer { break; default: - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } // inner switch return node; } @@ -1511,7 +1511,7 @@ class Parser extends Lexer { if (gNum < 0 || token.getCallRel()) { if (gNum > 0) gNum--; gNum = backrefRelToAbs(gNum); - if (gNum <= 0) newValueException(ERR_INVALID_BACKREF); + if (gNum <= 0) newValueException(INVALID_BACKREF); } Node node = new CallNode(bytes, token.getCallNameP(), token.getCallNameEnd(), gNum); env.numCall++; @@ -1570,9 +1570,9 @@ class Parser extends Lexer { private void parseSubExpError(TokenType term) { if (term == TokenType.SUBEXP_CLOSE) { - newSyntaxException(ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + newSyntaxException(END_PATTERN_WITH_UNMATCHED_PARENTHESIS); } else { - newInternalException(ERR_PARSER_BUG); + newInternalException(PARSER_BUG); } } diff --git a/src/org/joni/Regex.java b/src/org/joni/Regex.java index c32dff8..3efb91a 100644 --- a/src/org/joni/Regex.java +++ b/src/org/joni/Regex.java @@ -135,7 +135,7 @@ public final class Regex { if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) == (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) { - throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS); + throw new ValueException(ErrorMessages.INVALID_COMBINATION_OF_OPTIONS); } if ((option & Option.NEGATE_SINGLELINE) != 0) { @@ -212,7 +212,7 @@ public final class Regex { } void nameAdd(byte[]name, int nameP, int nameEnd, int backRef, Syntax syntax) { - if (nameEnd - nameP <= 0) throw new ValueException(ErrorMessages.ERR_EMPTY_GROUP_NAME); + if (nameEnd - nameP <= 0) throw new ValueException(ErrorMessages.EMPTY_GROUP_NAME); NameEntry e = null; if (nameTable == null) { @@ -226,7 +226,7 @@ public final class Regex { e = new NameEntry(name, nameP, nameEnd); nameTable.putDirect(name, nameP, nameEnd, e); } else if (e.backNum >= 1 && !syntax.allowMultiplexDefinitionName()) { - throw new ValueException(ErrorMessages.ERR_MULTIPLEX_DEFINED_NAME, new String(name, nameP, nameEnd - nameP)); + throw new ValueException(ErrorMessages.MULTIPLEX_DEFINED_NAME, new String(name, nameP, nameEnd - nameP)); } e.addBackref(backRef); @@ -238,12 +238,12 @@ public final class Regex { public int nameToBackrefNumber(byte[]name, int nameP, int nameEnd, Region region) { NameEntry e = nameToGroupNumbers(name, nameP, nameEnd); - if (e == null) throw new ValueException(ErrorMessages.ERR_UNDEFINED_NAME_REFERENCE, + if (e == null) throw new ValueException(ErrorMessages.UNDEFINED_NAME_REFERENCE, new String(name, nameP, nameEnd - nameP)); switch(e.backNum) { case 0: - throw new InternalException(ErrorMessages.ERR_PARSER_BUG); + throw new InternalException(ErrorMessages.PARSER_BUG); case 1: return e.backRef1; default: diff --git a/src/org/joni/ScanEnvironment.java b/src/org/joni/ScanEnvironment.java index 09d6a48..15d0a8e 100644 --- a/src/org/joni/ScanEnvironment.java +++ b/src/org/joni/ScanEnvironment.java @@ -67,7 +67,7 @@ public final class ScanEnvironment { } public int addMemEntry() { - if (numMem >= Config.MAX_CAPTURE_GROUP_NUM) throw new InternalException(ErrorMessages.ERR_TOO_MANY_CAPTURE_GROUPS); + if (numMem >= Config.MAX_CAPTURE_GROUP_NUM) throw new InternalException(ErrorMessages.TOO_MANY_CAPTURE_GROUPS); if (numMem++ == 0) { memNodes = new EncloseNode[Config.SCANENV_MEMNODES_SIZE]; } else if (numMem >= memNodes.length) { @@ -83,7 +83,7 @@ public final class ScanEnvironment { if (numMem >= num) { memNodes[num] = node; } else { - throw new InternalException(ErrorMessages.ERR_PARSER_BUG); + throw new InternalException(ErrorMessages.PARSER_BUG); } } diff --git a/src/org/joni/UnsetAddrList.java b/src/org/joni/UnsetAddrList.java index 84c9acc..ec28994 100644 --- a/src/org/joni/UnsetAddrList.java +++ b/src/org/joni/UnsetAddrList.java @@ -50,7 +50,7 @@ public final class UnsetAddrList { public void fix(Regex regex) { for (int i=0; i<num; i++) { EncloseNode en = targets[i]; - if (!en.isAddrFixed()) new InternalException(ErrorMessages.ERR_PARSER_BUG); + if (!en.isAddrFixed()) new InternalException(ErrorMessages.PARSER_BUG); regex.code[offsets[i]] = en.callAddr; // is this safe ? } } diff --git a/src/org/joni/ast/BackRefNode.java b/src/org/joni/ast/BackRefNode.java index bffba36..6e3baa7 100644 --- a/src/org/joni/ast/BackRefNode.java +++ b/src/org/joni/ast/BackRefNode.java @@ -53,7 +53,7 @@ public final class BackRefNode extends StateNode { } public void renumber(int[]map) { - if (!isNameRef()) throw new ValueException(ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + if (!isNameRef()) throw new ValueException(ErrorMessages.NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); int oldNum = backNum; diff --git a/src/org/joni/ast/CClassNode.java b/src/org/joni/ast/CClassNode.java index 9c72449..681a722 100644 --- a/src/org/joni/ast/CClassNode.java +++ b/src/org/joni/ast/CClassNode.java @@ -378,7 +378,7 @@ public final class CClassNode extends Node { break; default: - throw new InternalException(ErrorMessages.ERR_PARSER_BUG); + throw new InternalException(ErrorMessages.PARSER_BUG); } // switch } @@ -406,7 +406,7 @@ public final class CClassNode extends Node { } public void nextStateClass(CCStateArg arg, CClassNode ascCC, ScanEnvironment env) { - if (arg.state == CCSTATE.RANGE) throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE); + if (arg.state == CCSTATE.RANGE) throw new SyntaxException(ErrorMessages.CHAR_CLASS_VALUE_AT_END_OF_RANGE); if (arg.state == CCSTATE.VALUE && arg.type != CCVALTYPE.CLASS) { if (arg.type == CCVALTYPE.SB) { @@ -444,7 +444,7 @@ public final class CClassNode extends Node { arg.state = CCSTATE.COMPLETE; break; } else { - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); + throw new ValueException(ErrorMessages.EMPTY_RANGE_IN_CHAR_CLASS); } } bs.setRange(env, arg.from, arg.to); @@ -460,7 +460,7 @@ public final class CClassNode extends Node { arg.state = CCSTATE.COMPLETE; break; } else { - throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); + throw new ValueException(ErrorMessages.EMPTY_RANGE_IN_CHAR_CLASS); } } bs.setRange(env, arg.from, arg.to < 0xff ? arg.to : 0xff); diff --git a/src/org/joni/ast/ListNode.java b/src/org/joni/ast/ListNode.java index 5db7ff5..7684f4c 100644 --- a/src/org/joni/ast/ListNode.java +++ b/src/org/joni/ast/ListNode.java @@ -82,7 +82,7 @@ public final class ListNode extends Node { case LIST: return "List"; default: - throw new InternalException(ErrorMessages.ERR_PARSER_BUG); + throw new InternalException(ErrorMessages.PARSER_BUG); } } diff --git a/src/org/joni/exception/ErrorMessages.java b/src/org/joni/exception/ErrorMessages.java index c138574..e4aa515 100644 --- a/src/org/joni/exception/ErrorMessages.java +++ b/src/org/joni/exception/ErrorMessages.java @@ -26,71 +26,71 @@ public interface ErrorMessages extends org.jcodings.exception.ErrorMessages { final String NO_SUPPORT_CONFIG = "no support in this configuration"; /* internal error */ - final String ERR_MEMORY = "fail to memory allocation"; - final String ERR_MATCH_STACK_LIMIT_OVER = "match-stack limit over"; - final String ERR_TYPE_BUG = "undefined type (bug)"; - final String ERR_PARSER_BUG = "internal parser error (bug)"; - final String ERR_STACK_BUG = "stack error (bug)"; - final String ERR_UNDEFINED_BYTECODE = "undefined bytecode (bug)"; - final String ERR_UNEXPECTED_BYTECODE = "unexpected bytecode (bug)"; - final String ERR_DEFAULT_ENCODING_IS_NOT_SETTED = "default multibyte-encoding is not setted"; - final String ERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR = "can't convert to wide-char on specified multibyte-encoding"; - final String ERR_TOO_MANY_CAPTURE_GROUPS = "too many capture groups are specified"; + final String MEMORY = "fail to memory allocation"; + final String MATCH_STACK_LIMIT_OVER = "match-stack limit over"; + final String TYPE_BUG = "undefined type (bug)"; + final String PARSER_BUG = "internal parser error (bug)"; + final String STACK_BUG = "stack error (bug)"; + final String UNDEFINED_BYTECODE = "undefined bytecode (bug)"; + final String UNEXPECTED_BYTECODE = "unexpected bytecode (bug)"; + final String DEFAULT_ENCODING_IS_NOT_SETTED = "default multibyte-encoding is not setted"; + final String SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR = "can't convert to wide-char on specified multibyte-encoding"; + final String TOO_MANY_CAPTURE_GROUPS = "too many capture groups are specified"; /* general error */ - final String ERR_INVALID_ARGUMENT = "invalid argument"; + final String INVALID_ARGUMENT = "invalid argument"; /* syntax error */ - final String ERR_END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace"; - final String ERR_END_PATTERN_AT_LEFT_BRACKET = "end pattern at left bracket"; - final String ERR_EMPTY_CHAR_CLASS = "empty char-class"; - final String ERR_PREMATURE_END_OF_CHAR_CLASS = "premature end of char-class"; - final String ERR_END_PATTERN_AT_ESCAPE = "end pattern at escape"; - final String ERR_END_PATTERN_AT_META = "end pattern at meta"; - final String ERR_END_PATTERN_AT_CONTROL = "end pattern at control"; - final String ERR_META_CODE_SYNTAX = "invalid meta-code syntax"; - final String ERR_CONTROL_CODE_SYNTAX = "invalid control-code syntax"; - final String ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE = "char-class value at end of range"; - final String ERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE = "char-class value at start of range"; - final String ERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS = "unmatched range specifier in char-class"; - final String ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED = "target of repeat operator is not specified"; - final String ERR_TARGET_OF_REPEAT_OPERATOR_INVALID = "target of repeat operator is invalid"; - final String ERR_NESTED_REPEAT_NOT_ALLOWED = "nested repeat is not allowed"; - final String ERR_NESTED_REPEAT_OPERATOR = "nested repeat operator"; - final String ERR_UNMATCHED_CLOSE_PARENTHESIS = "unmatched close parenthesis"; - final String ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS = "end pattern with unmatched parenthesis"; - final String ERR_END_PATTERN_IN_GROUP = "end pattern in group"; - final String ERR_UNDEFINED_GROUP_OPTION = "undefined group option"; - final String ERR_INVALID_POSIX_BRACKET_TYPE = "invalid POSIX bracket type"; - final String ERR_INVALID_LOOK_BEHIND_PATTERN = "invalid pattern in look-behind"; - final String ERR_INVALID_REPEAT_RANGE_PATTERN = "invalid repeat range {lower,upper}"; - final String ERR_INVALID_CONDITION_PATTERN = "invalid conditional pattern"; + final String END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace"; + final String END_PATTERN_AT_LEFT_BRACKET = "end pattern at left bracket"; + final String EMPTY_CHAR_CLASS = "empty char-class"; + final String PREMATURE_END_OF_CHAR_CLASS = "premature end of char-class"; + final String END_PATTERN_AT_ESCAPE = "end pattern at escape"; + final String END_PATTERN_AT_META = "end pattern at meta"; + final String END_PATTERN_AT_CONTROL = "end pattern at control"; + final String META_CODE_SYNTAX = "invalid meta-code syntax"; + final String CONTROL_CODE_SYNTAX = "invalid control-code syntax"; + final String CHAR_CLASS_VALUE_AT_END_OF_RANGE = "char-class value at end of range"; + final String CHAR_CLASS_VALUE_AT_START_OF_RANGE = "char-class value at start of range"; + final String UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS = "unmatched range specifier in char-class"; + final String TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED = "target of repeat operator is not specified"; + final String TARGET_OF_REPEAT_OPERATOR_INVALID = "target of repeat operator is invalid"; + final String NESTED_REPEAT_NOT_ALLOWED = "nested repeat is not allowed"; + final String NESTED_REPEAT_OPERATOR = "nested repeat operator"; + final String UNMATCHED_CLOSE_PARENTHESIS = "unmatched close parenthesis"; + final String END_PATTERN_WITH_UNMATCHED_PARENTHESIS = "end pattern with unmatched parenthesis"; + final String END_PATTERN_IN_GROUP = "end pattern in group"; + final String UNDEFINED_GROUP_OPTION = "undefined group option"; + final String INVALID_POSIX_BRACKET_TYPE = "invalid POSIX bracket type"; + final String INVALID_LOOK_BEHIND_PATTERN = "invalid pattern in look-behind"; + final String INVALID_REPEAT_RANGE_PATTERN = "invalid repeat range {lower,upper}"; + final String INVALID_CONDITION_PATTERN = "invalid conditional pattern"; /* values error (syntax error) */ - final String ERR_TOO_BIG_NUMBER = "too big number"; - final String ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE = "too big number for repeat range"; - final String ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE = "upper is smaller than lower in repeat range"; - final String ERR_EMPTY_RANGE_IN_CHAR_CLASS = "empty range in char class"; - final String ERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE = "mismatch multibyte code length in char-class range"; - final String ERR_TOO_MANY_MULTI_BYTE_RANGES = "too many multibyte code ranges are specified"; - final String ERR_TOO_SHORT_MULTI_BYTE_STRING = "too short multibyte code string"; - final String ERR_TOO_BIG_BACKREF_NUMBER = "too big backref number"; - final String ERR_INVALID_BACKREF = Config.USE_NAMED_GROUP ? "invalid backref number/name" : "invalid backref number"; - final String ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED = "numbered backref/call is not allowed. (use name)"; - final String ERR_TOO_SHORT_DIGITS = "too short digits"; - final String ERR_INVALID_WIDE_CHAR_VALUE = "invalid wide-char value"; - final String ERR_EMPTY_GROUP_NAME = "group name is empty"; - final String ERR_INVALID_GROUP_NAME = "invalid group name <%n>"; - final String ERR_INVALID_CHAR_IN_GROUP_NAME = Config.USE_NAMED_GROUP ? "invalid char in group name <%n>" : "invalid char in group number <%n>"; - final String ERR_UNDEFINED_NAME_REFERENCE = "undefined name <%n> reference"; - final String ERR_UNDEFINED_GROUP_REFERENCE = "undefined group <%n> reference"; - final String ERR_MULTIPLEX_DEFINED_NAME = "multiplex defined name <%n>"; - final String ERR_MULTIPLEX_DEFINITION_NAME_CALL = "multiplex definition name <%n> call"; - final String ERR_NEVER_ENDING_RECURSION = "never ending recursion"; - final String ERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY = "group number is too big for capture history"; - final String ERR_NOT_SUPPORTED_ENCODING_COMBINATION = "not supported encoding combination"; - final String ERR_INVALID_COMBINATION_OF_OPTIONS = "invalid combination of options"; - final String ERR_OVER_THREAD_PASS_LIMIT_COUNT = "over thread pass limit count"; - final String ERR_TOO_BIG_SB_CHAR_VALUE = "too big singlebyte char value"; + final String TOO_BIG_NUMBER = "too big number"; + final String TOO_BIG_NUMBER_FOR_REPEAT_RANGE = "too big number for repeat range"; + final String UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE = "upper is smaller than lower in repeat range"; + final String EMPTY_RANGE_IN_CHAR_CLASS = "empty range in char class"; + final String MISMATCH_CODE_LENGTH_IN_CLASS_RANGE = "mismatch multibyte code length in char-class range"; + final String TOO_MANY_MULTI_BYTE_RANGES = "too many multibyte code ranges are specified"; + final String TOO_SHORT_MULTI_BYTE_STRING = "too short multibyte code string"; + final String TOO_BIG_BACKREF_NUMBER = "too big backref number"; + final String INVALID_BACKREF = Config.USE_NAMED_GROUP ? "invalid backref number/name" : "invalid backref number"; + final String NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED = "numbered backref/call is not allowed. (use name)"; + final String TOO_SHORT_DIGITS = "too short digits"; + final String INVALID_WIDE_CHAR_VALUE = "invalid wide-char value"; + final String EMPTY_GROUP_NAME = "group name is empty"; + final String INVALID_GROUP_NAME = "invalid group name <%n>"; + final String INVALID_CHAR_IN_GROUP_NAME = Config.USE_NAMED_GROUP ? "invalid char in group name <%n>" : "invalid char in group number <%n>"; + final String UNDEFINED_NAME_REFERENCE = "undefined name <%n> reference"; + final String UNDEFINED_GROUP_REFERENCE = "undefined group <%n> reference"; + final String MULTIPLEX_DEFINED_NAME = "multiplex defined name <%n>"; + final String MULTIPLEX_DEFINITION_NAME_CALL = "multiplex definition name <%n> call"; + final String NEVER_ENDING_RECURSION = "never ending recursion"; + final String GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY = "group number is too big for capture history"; + final String NOT_SUPPORTED_ENCODING_COMBINATION = "not supported encoding combination"; + final String INVALID_COMBINATION_OF_OPTIONS = "invalid combination of options"; + final String OVER_THREAD_PASS_LIMIT_COUNT = "over thread pass limit count"; + final String TOO_BIG_SB_CHAR_VALUE = "too big singlebyte char value"; } diff --git a/test/org/joni/test/TestA.java b/test/org/joni/test/TestA.java index a3248cf..aa90856 100644 --- a/test/org/joni/test/TestA.java +++ b/test/org/joni/test/TestA.java @@ -527,9 +527,9 @@ public class TestA extends Test { x2s("((?<x>x)|(?<y>y))(?(<x>)y|x)", "yx", 0, 2); ns("((?<x>x)|(?<y>y))(?(<x>)y|x)", "xx"); ns("((?<x>x)|(?<y>y))(?(<x>)y|x)", "yy"); - xerrs("(a)?(?<n>b)?(?(1)a)(?(<n>)b)", ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); - xerrs("()(?(2))", ErrorMessages.ERR_INVALID_BACKREF); - xerrs("(?(700000))", ErrorMessages.ERR_INVALID_BACKREF); + xerrs("(a)?(?<n>b)?(?(1)a)(?(<n>)b)", ErrorMessages.NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + xerrs("()(?(2))", ErrorMessages.INVALID_BACKREF); + xerrs("(?(700000))", ErrorMessages.INVALID_BACKREF); x2s("\\R", "\n", 0, 1); x2s("\\R", "\r", 0, 1); diff --git a/test/org/joni/test/TestError.java b/test/org/joni/test/TestError.java index 246cd33..fa3a73f 100755 --- a/test/org/joni/test/TestError.java +++ b/test/org/joni/test/TestError.java @@ -48,50 +48,50 @@ public class TestError extends Test { @Override public void test() throws Exception { - xerrs("(", ErrorMessages.ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); - xerrs("[[:WoRd:]]", ErrorMessages.ERR_INVALID_POSIX_BRACKET_TYPE); - xerrs("(0?0|(?(1)||)|(?(1)||))?", ErrorMessages.ERR_INVALID_CONDITION_PATTERN); - xerrs("[\\40000000000", ErrorMessages.ERR_TOO_BIG_NUMBER); - xerrs("[\\40000000000\n", ErrorMessages.ERR_TOO_BIG_NUMBER); - xerrs("[]", ErrorMessages.ERR_EMPTY_CHAR_CLASS); - xerrs("[c-a]", ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS); + xerrs("(", ErrorMessages.END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + xerrs("[[:WoRd:]]", ErrorMessages.INVALID_POSIX_BRACKET_TYPE); + xerrs("(0?0|(?(1)||)|(?(1)||))?", ErrorMessages.INVALID_CONDITION_PATTERN); + xerrs("[\\40000000000", ErrorMessages.TOO_BIG_NUMBER); + xerrs("[\\40000000000\n", ErrorMessages.TOO_BIG_NUMBER); + xerrs("[]", ErrorMessages.EMPTY_CHAR_CLASS); + xerrs("[c-a]", ErrorMessages.EMPTY_RANGE_IN_CHAR_CLASS); xerrs("\\x{FFFFFFFF}", ErrorMessages.ERR_TOO_BIG_WIDE_CHAR_VALUE); xerrs("\\x{100000000}", ErrorMessages.ERR_TOO_LONG_WIDE_CHAR_VALUE); - xerrs("\\u026x", ErrorMessages.ERR_TOO_SHORT_DIGITS); - xerrs("()(?\\!(?'a')\\1)", ErrorMessages.ERR_UNDEFINED_GROUP_OPTION); - xerrs("\\((", ErrorMessages.ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); - xerrs("(|", ErrorMessages.ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); - xerrs("'/g\\\u00ff\u00ff\u00ff\u00ff&))", ErrorMessages.ERR_UNMATCHED_CLOSE_PARENTHESIS); - xerrs("[0-0-\u00ff ", ErrorMessages.ERR_PREMATURE_END_OF_CHAR_CLASS); // \xe2 + xerrs("\\u026x", ErrorMessages.TOO_SHORT_DIGITS); + xerrs("()(?\\!(?'a')\\1)", ErrorMessages.UNDEFINED_GROUP_OPTION); + xerrs("\\((", ErrorMessages.END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + xerrs("(|", ErrorMessages.END_PATTERN_WITH_UNMATCHED_PARENTHESIS); + xerrs("'/g\\\u00ff\u00ff\u00ff\u00ff&))", ErrorMessages.UNMATCHED_CLOSE_PARENTHESIS); + xerrs("[0-0-\u00ff ", ErrorMessages.PREMATURE_END_OF_CHAR_CLASS); // \xe2 xerrs("\\p{foobarbaz}", ErrorMessages.ERR_INVALID_CHAR_PROPERTY_NAME.replace("%n", "foobarbaz")); //xerrs("\\p{あ}", ErrorMessages.ERR_INVALID_CHAR_PROPERTY_NAME.replace("%n", "あ")); - xerrs("a{100001}", ErrorMessages.ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); - xerrs("a{0,100001}", ErrorMessages.ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); - xerrs("a{5,1}", ErrorMessages.ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); - xerrs("[\\6000", ErrorMessages.ERR_TOO_BIG_NUMBER); // CVE-2017-9226 - xerrs("[\\H- ]", ErrorMessages.ERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS); // CVE-2017-9228 + xerrs("a{100001}", ErrorMessages.TOO_BIG_NUMBER_FOR_REPEAT_RANGE); + xerrs("a{0,100001}", ErrorMessages.TOO_BIG_NUMBER_FOR_REPEAT_RANGE); + xerrs("a{5,1}", ErrorMessages.UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); + xerrs("[\\6000", ErrorMessages.TOO_BIG_NUMBER); // CVE-2017-9226 + xerrs("[\\H- ]", ErrorMessages.UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS); // CVE-2017-9228 - xerrs("(?:ab|cd)*\\1", ErrorMessages.ERR_INVALID_BACKREF); - xerrs("(ab|cd)*\\1", ErrorMessages.ERR_INVALID_BACKREF, Option.DONT_CAPTURE_GROUP); + xerrs("(?:ab|cd)*\\1", ErrorMessages.INVALID_BACKREF); + xerrs("(ab|cd)*\\1", ErrorMessages.INVALID_BACKREF, Option.DONT_CAPTURE_GROUP); - xerrs("(.(?=\\g<1>))", ErrorMessages.ERR_NEVER_ENDING_RECURSION); - xerrs("(a)(?<n>b)\\g<1>\\g<n>", ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + xerrs("(.(?=\\g<1>))", ErrorMessages.NEVER_ENDING_RECURSION); + xerrs("(a)(?<n>b)\\g<1>\\g<n>", ErrorMessages.NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); // xerrs("(?<", ErrorMessages.ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS); - xerrs("(?<>)", ErrorMessages.ERR_EMPTY_GROUP_NAME); + xerrs("(?<>)", ErrorMessages.EMPTY_GROUP_NAME); //xerrs("(?<.>)", ErrorMessages.ERR_INVALID_CHAR_IN_GROUP_NAME); - xerrs("\\g<1->", ErrorMessages.ERR_INVALID_CHAR_IN_GROUP_NAME.replace("%n", "1->")); - xerrs("\\k<1/>", ErrorMessages.ERR_INVALID_GROUP_NAME.replace("%n", "1/")); + xerrs("\\g<1->", ErrorMessages.INVALID_CHAR_IN_GROUP_NAME.replace("%n", "1->")); + xerrs("\\k<1/>", ErrorMessages.INVALID_GROUP_NAME.replace("%n", "1/")); // xerrs("\\k<1-1/>", ErrorMessages.ERR_INVALID_GROUP_NAME.replace("%n", "1-1/>")); // xerrs("\\k<a/>", ErrorMessages.ERR_INVALID_CHAR_IN_GROUP_NAME.replace("%n", "a/")); - xerrs("*", ErrorMessages.ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); - xerrs("{1}", ErrorMessages.ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); + xerrs("*", ErrorMessages.TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); + xerrs("{1}", ErrorMessages.TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED); - xerrs("(?<a>a)(?<a>b)\\g<a>", ErrorMessages.ERR_MULTIPLEX_DEFINITION_NAME_CALL.replace("%n", "a")); + xerrs("(?<a>a)(?<a>b)\\g<a>", ErrorMessages.MULTIPLEX_DEFINITION_NAME_CALL.replace("%n", "a")); - xerrs("(a)?(?<n>b)?(?(1)a)(?(<n>)b)", ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); + xerrs("(a)?(?<n>b)?(?(1)a)(?(<n>)b)", ErrorMessages.NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED); } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git _______________________________________________ pkg-java-commits mailing list pkg-java-comm...@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits