[jruby-joni] 78/223: Remove blank lines, doh
Hideki Yamane
henrich at moszumanska.debian.org
Mon Nov 16 11:21:51 UTC 2015
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 2c08ee4b7395321e0bf763477312c40211865935
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Mon Feb 13 19:39:03 2012 +0100
Remove blank lines, doh
---
src/org/joni/ApplyCaseFold.java | 32 +-
src/org/joni/ApplyCaseFoldArg.java | 24 +-
src/org/joni/ArrayCompiler.java | 274 +++++++-------
src/org/joni/AsmCompiler.java | 26 +-
src/org/joni/AsmCompilerSupport.java | 44 +--
src/org/joni/BitSet.java | 40 +-
src/org/joni/BitStatus.java | 30 +-
src/org/joni/ByteCodeMachine.java | 506 +++++++++++++-------------
src/org/joni/ByteCodePrinter.java | 110 +++---
src/org/joni/CaptureTreeNode.java | 36 +-
src/org/joni/CodeRangeBuffer.java | 146 ++++----
src/org/joni/Compiler.java | 66 ++--
src/org/joni/MatcherFactory.java | 22 +-
src/org/joni/MinMaxLen.java | 82 ++---
src/org/joni/NameEntry.java | 40 +-
src/org/joni/NativeMachine.java | 22 +-
src/org/joni/NodeOptInfo.java | 54 +--
src/org/joni/OptAnchorInfo.java | 42 +--
src/org/joni/OptEnvironment.java | 24 +-
src/org/joni/OptExactInfo.java | 82 ++---
src/org/joni/OptMapInfo.java | 56 +--
src/org/joni/Option.java | 80 ++--
src/org/joni/Region.java | 36 +-
src/org/joni/ScanEnvironment.java | 46 +--
src/org/joni/ScannerSupport.java | 82 ++---
src/org/joni/SearchAlgorithm.java | 19 +
src/org/joni/StackEntry.java | 44 +--
src/org/joni/StackMachine.java | 146 ++++----
src/org/joni/Syntax.java | 382 +++++++++----------
src/org/joni/Token.java | 24 +-
src/org/joni/UnsetAddrList.java | 34 +-
src/org/joni/WarnCallback.java | 35 +-
src/org/joni/ast/AnchorNode.java | 44 +--
src/org/joni/ast/AnyCharNode.java | 32 +-
src/org/joni/ast/BackRefNode.java | 54 +--
src/org/joni/ast/CTypeNode.java | 36 +-
src/org/joni/ast/CallNode.java | 46 +--
src/org/joni/ast/ConsAltNode.java | 62 ++--
src/org/joni/ast/EncloseNode.java | 76 ++--
src/org/joni/ast/Node.java | 72 ++--
src/org/joni/ast/StateNode.java | 154 ++++----
src/org/joni/ast/StringNode.java | 76 ++--
src/org/joni/bench/AbstractBench.java | 4 +-
src/org/joni/constants/AnchorType.java | 32 +-
src/org/joni/constants/Arguments.java | 26 +-
src/org/joni/constants/AsmConstants.java | 22 +-
src/org/joni/constants/CCSTATE.java | 22 +-
src/org/joni/constants/CCVALTYPE.java | 22 +-
src/org/joni/constants/EncloseType.java | 24 +-
src/org/joni/constants/MetaChar.java | 26 +-
src/org/joni/constants/NodeStatus.java | 22 +-
src/org/joni/constants/NodeType.java | 32 +-
src/org/joni/constants/OPCode.java | 50 +--
src/org/joni/constants/OPSize.java | 28 +-
src/org/joni/constants/Reduce.java | 37 +-
src/org/joni/constants/RegexState.java | 22 +-
src/org/joni/constants/StackPopLevel.java | 22 +-
src/org/joni/constants/StackType.java | 22 +-
src/org/joni/constants/StringType.java | 22 +-
src/org/joni/constants/SyntaxProperties.java | 28 +-
src/org/joni/constants/TargetInfo.java | 22 +-
src/org/joni/constants/TokenType.java | 22 +-
src/org/joni/constants/Traverse.java | 22 +-
src/org/joni/exception/ErrorMessages.java | 30 +-
src/org/joni/exception/InternalException.java | 24 +-
src/org/joni/exception/JOniException.java | 22 +-
src/org/joni/exception/SyntaxException.java | 22 +-
src/org/joni/exception/ValueException.java | 28 +-
test/org/joni/test/TestA.java | 36 +-
test/org/joni/test/TestCornerCases.java | 28 +-
test/org/joni/test/TestCrnl.java | 30 +-
test/org/joni/test/TestJoni.java | 19 +
test/org/joni/test/TestLookBehind.java | 19 +
test/org/joni/test/TestNSU8.java | 32 +-
74 files changed, 2108 insertions(+), 2049 deletions(-)
diff --git a/src/org/joni/ApplyCaseFold.java b/src/org/joni/ApplyCaseFold.java
index 54a1aa0..7d49f89 100644
--- a/src/org/joni/ApplyCaseFold.java
+++ b/src/org/joni/ApplyCaseFold.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -35,7 +35,7 @@ final class ApplyCaseFold implements ApplyAllCaseFoldFunction {
Encoding enc = env.enc;
CClassNode cc = arg.cc;
BitSet bs = cc.bs;
-
+
if (length == 1) {
boolean inCC = cc.isCodeInCC(enc, from);
@@ -62,7 +62,7 @@ final class ApplyCaseFold implements ApplyAllCaseFoldFunction {
}
}
} // CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS
-
+
} else {
if (cc.isCodeInCC(enc, from) && (!Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS || !cc.isNot())) {
StringNode node = null;
@@ -71,7 +71,7 @@ final class ApplyCaseFold implements ApplyAllCaseFoldFunction {
node = new StringNode();
node.ensure(Config.ENC_CODE_TO_MBC_MAXLEN);
node.end += enc.codeToMbc(to[i], node.bytes, node.end);
-
+
/* char-class expanded multi-char only
compare with string folded at match time. */
node.setAmbig();
@@ -94,6 +94,6 @@ final class ApplyCaseFold implements ApplyAllCaseFoldFunction {
}
}
-
- static final ApplyCaseFold INSTANCE = new ApplyCaseFold();
+
+ static final ApplyCaseFold INSTANCE = new ApplyCaseFold();
}
diff --git a/src/org/joni/ApplyCaseFoldArg.java b/src/org/joni/ApplyCaseFoldArg.java
index 92dd2fb..10b297f 100644
--- a/src/org/joni/ApplyCaseFoldArg.java
+++ b/src/org/joni/ApplyCaseFoldArg.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -27,7 +27,7 @@ public final class ApplyCaseFoldArg {
final CClassNode cc;
ConsAltNode altRoot;
ConsAltNode tail;
-
+
public ApplyCaseFoldArg(ScanEnvironment env, CClassNode cc) {
this.env = env;
this.cc = cc;
diff --git a/src/org/joni/ArrayCompiler.java b/src/org/joni/ArrayCompiler.java
index f23ce58..6193e5d 100644
--- a/src/org/joni/ArrayCompiler.java
+++ b/src/org/joni/ArrayCompiler.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -51,7 +51,7 @@ final class ArrayCompiler extends Compiler {
@Override
protected final void prepare() {
- regex.code = new int[(analyser.stop - analyser.p) * 2 + 1]; // (+1: empty regex)
+ regex.code = new int[(analyser.stop - analyser.p) * 2 + 1]; // (+1: empty regex)
regex.codeLength = 0;
}
@@ -59,7 +59,7 @@ final class ArrayCompiler extends Compiler {
protected final void finish() {
addOpcode(OPCode.END);
addOpcode(OPCode.FINISH); // for stack bottom
-
+
if (Config.USE_SUBEXP_CALL && analyser.env.unsetAddrList != null) {
analyser.env.unsetAddrList.fix(regex);
analyser.env.unsetAddrList = null;
@@ -107,7 +107,7 @@ final class ArrayCompiler extends Compiler {
private int selectStrOpcode(int mbLength, int strLength, boolean ignoreCase) {
int op;
-
+
if (ignoreCase) {
switch(strLength) {
case 1: op = enc.toLowerCaseTable() != null ? OPCode.EXACT1_IC_SB : OPCode.EXACT1_IC; break;
@@ -144,15 +144,15 @@ final class ArrayCompiler extends Compiler {
private void compileTreeEmptyCheck(Node node, int emptyInfo) {
int savedNumNullCheck = regex.numNullCheck;
-
+
if (emptyInfo != 0) {
addOpcode(OPCode.NULL_CHECK_START);
addMemNum(regex.numNullCheck); /* NULL CHECK ID */
regex.numNullCheck++;
}
-
+
compileTree(node);
-
+
if (emptyInfo != 0) {
switch(emptyInfo) {
case TargetInfo.IS_EMPTY:
@@ -165,19 +165,19 @@ final class ArrayCompiler extends Compiler {
addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH);
break;
} // switch
-
+
addMemNum(savedNumNullCheck); /* NULL CHECK ID */
}
}
private int addCompileStringlength(byte[]bytes, int p, int mbLength, int strLength, boolean ignoreCase) {
int op = selectStrOpcode(mbLength, strLength, ignoreCase);
-
+
int len = OPSize.OPCODE;
if (op == OPCode.EXACTMBN) len += OPSize.LENGTH;
if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH;
-
+
len += mbLength * strLength;
return len;
}
@@ -186,14 +186,14 @@ final class ArrayCompiler extends Compiler {
protected final void addCompileString(byte[]bytes, int p, int mbLength, int strLength, boolean ignoreCase) {
int op = selectStrOpcode(mbLength, strLength, ignoreCase);
addOpcode(op);
-
+
if (op == OPCode.EXACTMBN) addLength(mbLength);
-
+
if (isNeedStrLenOpExact(op)) {
if (op == OPCode.EXACTN_IC || op == OPCode.EXACTN_IC_SB) {
addLength(mbLength * strLength);
} else {
- addLength(strLength);
+ addLength(strLength);
}
}
addBytes(bytes, p, mbLength * strLength);
@@ -203,17 +203,17 @@ final class ArrayCompiler extends Compiler {
StringNode sn = (StringNode)node;
if (sn.length() <= 0) return 0;
boolean ambig = sn.isAmbig();
-
+
int p, prev;
p = prev = sn.p;
int end = sn.end;
byte[]bytes = sn.bytes;
int prevLen = enc.length(bytes, p, end);
p += prevLen;
-
+
int slen = 1;
int rlen = 0;
-
+
while (p < end) {
int len = enc.length(bytes, p, end);
if (len == prevLen) {
@@ -231,9 +231,9 @@ final class ArrayCompiler extends Compiler {
rlen += r;
return rlen;
}
-
+
private int compileLengthStringRawNode(StringNode sn) {
- if (sn.length() <= 0) return 0;
+ if (sn.length() <= 0) return 0;
return addCompileStringlength(sn.bytes, sn.p, 1 /*sb*/, sn.length(), false);
}
@@ -241,7 +241,7 @@ final class ArrayCompiler extends Compiler {
addLength(mbuf.used);
addInts(mbuf.p, mbuf.used);
}
-
+
private int compileLengthCClassNode(CClassNode cc) {
if (cc.isShare()) return OPSize.OPCODE + OPSize.POINTER;
@@ -254,7 +254,7 @@ final class ArrayCompiler extends Compiler {
} else {
len = OPSize.OPCODE + BitSet.BITSET_SIZE;
}
-
+
len += OPSize.LENGTH + cc.mbuf.used;
}
return len;
@@ -267,7 +267,7 @@ final class ArrayCompiler extends Compiler {
addPointer(cc);
return;
}
-
+
if (cc.mbuf == null) {
if (cc.isNot()) {
addOpcode(enc.isSingleByte() ? OPCode.CCLASS_NOT_SB : OPCode.CCLASS_NOT);
@@ -282,7 +282,7 @@ final class ArrayCompiler extends Compiler {
} else {
addOpcode(OPCode.CCLASS_MB);
}
- addMultiByteCClass(cc.mbuf);
+ addMultiByteCClass(cc.mbuf);
} else {
if (cc.isNot()) {
addOpcode(OPCode.CCLASS_MIX_NOT);
@@ -308,17 +308,17 @@ final class ArrayCompiler extends Compiler {
op = enc.isSingleByte() ? OPCode.WORD_SB : OPCode.WORD;
}
break;
-
+
default:
newInternalException(ERR_PARSER_BUG);
- return; // not reached
+ return; // not reached
} // inner switch
addOpcode(op);
}
@Override
protected void compileAnyCharNode() {
- if (isMultiline(regex.options)) {
+ if (isMultiline(regex.options)) {
addOpcode(enc.isSingleByte() ? OPCode.ANYCHAR_ML_SB : OPCode.ANYCHAR_ML);
} else {
addOpcode(enc.isSingleByte() ? OPCode.ANYCHAR_SB : OPCode.ANYCHAR);
@@ -341,7 +341,7 @@ final class ArrayCompiler extends Compiler {
addLength(br.nestLevel);
// !goto add_bacref_mems;!
addLength(br.backNum);
- for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
+ for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
return;
} else { // USE_BACKREF_AT_LEVEL
if (br.backNum == 1) {
@@ -370,7 +370,7 @@ final class ArrayCompiler extends Compiler {
}
// !add_bacref_mems:!
addLength(br.backNum);
- for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
+ for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
}
}
}
@@ -388,45 +388,45 @@ final class ArrayCompiler extends Compiler {
System.arraycopy(regex.repeatRangeHi, 0, tmp, 0, regex.repeatRangeHi.length);
regex.repeatRangeHi = tmp;
}
-
+
regex.repeatRangeLo[id] = lower;
regex.repeatRangeHi[id] = isRepeatInfinite(upper) ? 0x7fffffff : upper;
}
-
+
private void compileRangeRepeatNode(QuantifierNode qn, int targetLen, int emptyInfo) {
int numRepeat = regex.numRepeat;
addOpcode(qn.greedy ? OPCode.REPEAT : OPCode.REPEAT_NG);
addMemNum(numRepeat); /* OP_REPEAT ID */
regex.numRepeat++;
addRelAddr(targetLen + OPSize.REPEAT_INC);
-
+
entryRepeatRange(numRepeat, qn.lower, qn.upper);
-
+
compileTreeEmptyCheck(qn.target, emptyInfo);
-
+
if ((Config.USE_SUBEXP_CALL && regex.numCall > 0) || qn.isInRepeat()) {
addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
} else {
- addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
+ addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
}
-
+
addMemNum(numRepeat); /* OP_REPEAT ID */
}
-
+
private static final int QUANTIFIER_EXPAND_LIMIT_SIZE = 50; // was 50
- private static boolean cknOn(int ckn) {
+ private static boolean cknOn(int ckn) {
return ckn > 0;
}
-
+
private int compileCECLengthQuantifierNode(QuantifierNode qn) {
boolean infinite = isRepeatInfinite(qn.upper);
int emptyInfo = qn.targetEmptyInfo;
-
+
int tlen = compileLengthTree(qn.target);
int ckn = regex.numCombExpCheck > 0 ? qn.combExpCheckNum : 0;
int cklen = cknOn(ckn) ? OPSize.STATE_CHECK_NUM : 0;
-
+
/* anychar repeat */
if (qn.target.getType() == NodeType.CANY) {
if (qn.greedy && infinite) {
@@ -437,14 +437,14 @@ final class ArrayCompiler extends Compiler {
}
}
}
-
+
int modTLen;
if (emptyInfo != 0) {
modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
} else {
modTLen = tlen;
}
-
+
int len;
if (infinite && qn.lower <= 1) {
if (qn.greedy) {
@@ -482,7 +482,7 @@ final class ArrayCompiler extends Compiler {
len = OPSize.PUSH + cklen + OPSize.JUMP + tlen;
} else {
len = OPSize.REPEAT_INC + modTLen + OPSize.OPCODE + OPSize.RELADDR + OPSize.MEMNUM;
-
+
if (cknOn(ckn)) {
len += OPSize.STATE_CHECK;
}
@@ -494,11 +494,11 @@ final class ArrayCompiler extends Compiler {
protected void compileCECQuantifierNode(QuantifierNode qn) {
boolean infinite = isRepeatInfinite(qn.upper);
int emptyInfo = qn.targetEmptyInfo;
-
+
int tlen = compileLengthTree(qn.target);
-
+
int ckn = regex.numCombExpCheck > 0 ? qn.combExpCheckNum : 0;
-
+
if (qn.isAnyCharStar()) {
compileTreeNTimes(qn.target, qn.lower);
if (qn.nextHeadExact != null && !cknOn(ckn)) {
@@ -533,7 +533,7 @@ final class ArrayCompiler extends Compiler {
return;
}
}
-
+
int modTLen;
if (emptyInfo != 0) {
modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
@@ -594,7 +594,7 @@ final class ArrayCompiler extends Compiler {
} else {
addOpcodeRelAddr(OPCode.PUSH, OPSize.JUMP);
}
-
+
addOpcodeRelAddr(OPCode.JUMP, tlen);
compileTree(qn.target);
} else {
@@ -609,7 +609,7 @@ final class ArrayCompiler extends Compiler {
private int compileNonCECLengthQuantifierNode(QuantifierNode qn) {
boolean infinite = isRepeatInfinite(qn.upper);
int emptyInfo = qn.targetEmptyInfo;
-
+
int tlen = compileLengthTree(qn.target);
/* anychar repeat */
@@ -622,14 +622,14 @@ final class ArrayCompiler extends Compiler {
}
}
}
-
+
int modTLen = 0;
if (emptyInfo != 0) {
modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
} else {
modTLen = tlen;
}
-
+
int len;
if (infinite && (qn.lower <= 1 || tlen * qn.lower <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
if (qn.lower == 1 && tlen > QUANTIFIER_EXPAND_LIMIT_SIZE) {
@@ -637,7 +637,7 @@ final class ArrayCompiler extends Compiler {
} else {
len = tlen * qn.lower;
}
-
+
if (qn.greedy) {
if (qn.headExact != null) {
len += OPSize.PUSH_OR_JUMP_EXACT1 + modTLen + OPSize.JUMP;
@@ -647,13 +647,13 @@ final class ArrayCompiler extends Compiler {
len += OPSize.PUSH + modTLen + OPSize.JUMP;
}
} else {
- len += OPSize.JUMP + modTLen + OPSize.PUSH;
+ len += OPSize.JUMP + modTLen + OPSize.PUSH;
}
-
+
} else if (qn.upper == 0 && qn.isRefered) { /* /(?<n>..){0}/ */
len = OPSize.JUMP + tlen;
} else if (!infinite && qn.greedy &&
- (qn.upper == 1 || (tlen + OPSize.PUSH) * qn.upper <= QUANTIFIER_EXPAND_LIMIT_SIZE )) {
+ (qn.upper == 1 || (tlen + OPSize.PUSH) * qn.upper <= QUANTIFIER_EXPAND_LIMIT_SIZE )) {
len = tlen * qn.lower;
len += (OPSize.PUSH + tlen) * (qn.upper - qn.lower);
} else if (!qn.greedy && qn.upper == 1 && qn.lower == 0) { /* '??' */
@@ -663,14 +663,14 @@ final class ArrayCompiler extends Compiler {
}
return len;
}
-
+
@Override
protected void compileNonCECQuantifierNode(QuantifierNode qn) {
boolean infinite = isRepeatInfinite(qn.upper);
int emptyInfo = qn.targetEmptyInfo;
-
- int tlen = compileLengthTree(qn.target);
-
+
+ int tlen = compileLengthTree(qn.target);
+
if (qn.isAnyCharStar()) {
compileTreeNTimes(qn.target, qn.lower);
if (qn.nextHeadExact != null) {
@@ -691,7 +691,7 @@ final class ArrayCompiler extends Compiler {
return;
}
}
-
+
int modTLen;
if (emptyInfo != 0) {
modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
@@ -714,7 +714,7 @@ final class ArrayCompiler extends Compiler {
} else {
compileTreeNTimes(qn.target, qn.lower);
}
-
+
if (qn.greedy) {
if (qn.headExact != null) {
addOpcodeRelAddr(OPCode.PUSH_OR_JUMP_EXACT1, modTLen + OPSize.JUMP);
@@ -722,7 +722,7 @@ final class ArrayCompiler extends Compiler {
addBytes(sn.bytes, sn.p, 1);
compileTreeEmptyCheck(qn.target, emptyInfo);
addOpcodeRelAddr(OPCode.JUMP, -(modTLen + OPSize.JUMP + OPSize.PUSH_OR_JUMP_EXACT1));
- } else if (qn.nextHeadExact != null) {
+ } else if (qn.nextHeadExact != null) {
addOpcodeRelAddr(OPCode.PUSH_IF_PEEK_NEXT, modTLen + OPSize.JUMP);
StringNode sn = (StringNode)qn.nextHeadExact;
addBytes(sn.bytes, sn.p, 1);
@@ -741,11 +741,11 @@ final class ArrayCompiler extends Compiler {
} else if (qn.upper == 0 && qn.isRefered) { /* /(?<n>..){0}/ */
addOpcodeRelAddr(OPCode.JUMP, tlen);
compileTree(qn.target);
- } else if (!infinite && qn.greedy &&
+ } else if (!infinite && qn.greedy &&
(qn.upper == 1 || (tlen + OPSize.PUSH) * qn.upper <= QUANTIFIER_EXPAND_LIMIT_SIZE)) {
int n = qn.upper - qn.lower;
compileTreeNTimes(qn.target, qn.lower);
-
+
for (int i=0; i<n; i++) {
addOpcodeRelAddr(OPCode.PUSH, (n - i) * tlen + (n - i - 1) * OPSize.PUSH);
compileTree(qn.target);
@@ -764,7 +764,7 @@ final class ArrayCompiler extends Compiler {
regex.options = node.option;
int tlen = compileLengthTree(node.target);
regex.options = prev;
-
+
if (isDynamic(prev ^ node.option)) {
return OPSize.SET_OPTION_PUSH + OPSize.SET_OPTION + OPSize.FAIL + tlen + OPSize.SET_OPTION;
} else {
@@ -775,17 +775,17 @@ final class ArrayCompiler extends Compiler {
@Override
protected void compileOptionNode(EncloseNode node) {
int prev = regex.options;
-
+
if (isDynamic(prev ^ node.option)) {
addOpcodeOption(OPCode.SET_OPTION_PUSH, node.option);
addOpcodeOption(OPCode.SET_OPTION, prev);
addOpcode(OPCode.FAIL);
}
-
+
regex.options = node.option;
compileTree(node.target);
regex.options = prev;
-
+
if (isDynamic(prev ^ node.option)) {
addOpcodeOption(OPCode.SET_OPTION, prev);
}
@@ -795,14 +795,14 @@ final class ArrayCompiler extends Compiler {
if (node.isOption()) {
return compileLengthOptionNode(node);
}
-
+
int tlen;
if (node.target != null) {
tlen = compileLengthTree(node.target);
} else {
tlen = 0;
}
-
+
int len;
switch (node.type) {
case EncloseType.MEMORY:
@@ -822,17 +822,17 @@ final class ArrayCompiler extends Compiler {
len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
}
break;
-
+
case EncloseType.STOP_BACKTRACK:
if (node.isStopBtSimpleRepeat()) {
QuantifierNode qn = (QuantifierNode)node.target;
tlen = compileLengthTree(qn.target);
len = tlen * qn.lower + OPSize.PUSH + tlen + OPSize.POP + OPSize.JUMP;
- } else {
+ } else {
len = OPSize.PUSH_STOP_BT + tlen + OPSize.POP_STOP_BT;
}
break;
-
+
default:
newInternalException(ERR_PARSER_BUG);
return 0; // not reached
@@ -861,16 +861,16 @@ final class ArrayCompiler extends Compiler {
addOpcodeRelAddr(OPCode.JUMP, len);
}
} // USE_SUBEXP_CALL
-
+
if (bsAt(regex.btMemStart, node.regNum)) {
addOpcode(OPCode.MEMORY_START_PUSH);
} else {
addOpcode(OPCode.MEMORY_START);
}
-
+
addMemNum(node.regNum);
compileTree(node.target);
-
+
if (Config.USE_SUBEXP_CALL && node.isCalled()) {
if (bsAt(regex.btMemEnd, node.regNum)) {
addOpcode(node.isRecursion() ? OPCode.MEMORY_END_PUSH_REC : OPCode.MEMORY_END_PUSH);
@@ -888,14 +888,14 @@ final class ArrayCompiler extends Compiler {
addMemNum(node.regNum);
}
break;
-
+
case EncloseType.STOP_BACKTRACK:
if (node.isStopBtSimpleRepeat()) {
QuantifierNode qn = (QuantifierNode)node.target;
-
+
compileTreeNTimes(qn.target, qn.lower);
-
- len = compileLengthTree(qn.target);
+
+ len = compileLengthTree(qn.target);
addOpcodeRelAddr(OPCode.PUSH, len + OPSize.POP + OPSize.JUMP);
compileTree(qn.target);
addOpcode(OPCode.POP);
@@ -906,13 +906,13 @@ final class ArrayCompiler extends Compiler {
addOpcode(OPCode.POP_STOP_BT);
}
break;
-
+
default:
newInternalException(ERR_PARSER_BUG);
break;
} // switch
}
-
+
private int compileLengthAnchorNode(AnchorNode node) {
int tlen;
if (node.target != null) {
@@ -920,25 +920,25 @@ final class ArrayCompiler extends Compiler {
} else {
tlen = 0;
}
-
+
int len;
switch (node.type) {
case AnchorType.PREC_READ:
len = OPSize.PUSH_POS + tlen + OPSize.POP_POS;
break;
-
+
case AnchorType.PREC_READ_NOT:
len = OPSize.PUSH_POS_NOT + tlen + OPSize.FAIL_POS;
break;
-
+
case AnchorType.LOOK_BEHIND:
len = OPSize.LOOK_BEHIND + tlen;
break;
-
+
case AnchorType.LOOK_BEHIND_NOT:
len = OPSize.PUSH_LOOK_BEHIND_NOT + tlen + OPSize.FAIL_LOOK_BEHIND_NOT;
break;
-
+
default:
len = OPSize.OPCODE;
break;
@@ -950,33 +950,33 @@ final class ArrayCompiler extends Compiler {
protected void compileAnchorNode(AnchorNode node) {
int len;
int n;
-
+
switch (node.type) {
case AnchorType.BEGIN_BUF: addOpcode(OPCode.BEGIN_BUF); break;
case AnchorType.END_BUF: addOpcode(OPCode.END_BUF); break;
- case AnchorType.BEGIN_LINE: addOpcode(OPCode.BEGIN_LINE); break;
+ case AnchorType.BEGIN_LINE: addOpcode(OPCode.BEGIN_LINE); break;
case AnchorType.END_LINE: addOpcode(OPCode.END_LINE); break;
case AnchorType.SEMI_END_BUF: addOpcode(OPCode.SEMI_END_BUF); break;
- case AnchorType.BEGIN_POSITION: addOpcode(OPCode.BEGIN_POSITION); break;
+ case AnchorType.BEGIN_POSITION: addOpcode(OPCode.BEGIN_POSITION); break;
- case AnchorType.WORD_BOUND:
+ case AnchorType.WORD_BOUND:
addOpcode(enc.isSingleByte() ? OPCode.WORD_BOUND_SB : OPCode.WORD_BOUND);
break;
-
+
case AnchorType.NOT_WORD_BOUND:
addOpcode(enc.isSingleByte() ? OPCode.NOT_WORD_BOUND_SB : OPCode.NOT_WORD_BOUND);
break;
-
+
case AnchorType.WORD_BEGIN:
if (Config.USE_WORD_BEGIN_END)
addOpcode(enc.isSingleByte() ? OPCode.WORD_BEGIN_SB : OPCode.WORD_BEGIN);
break;
-
+
case AnchorType.WORD_END:
if (Config.USE_WORD_BEGIN_END)
addOpcode(enc.isSingleByte() ? OPCode.WORD_END_SB : OPCode.WORD_END);
- break;
-
+ break;
+
case AnchorType.PREC_READ:
addOpcode(OPCode.PUSH_POS);
compileTree(node.target);
@@ -989,7 +989,7 @@ final class ArrayCompiler extends Compiler {
compileTree(node.target);
addOpcode(OPCode.FAIL_POS);
break;
-
+
case AnchorType.LOOK_BEHIND:
addOpcode(enc.isSingleByte() ? OPCode.LOOK_BEHIND_SB : OPCode.LOOK_BEHIND);
if (node.charLength < 0) {
@@ -1001,7 +1001,7 @@ final class ArrayCompiler extends Compiler {
addLength(n);
compileTree(node.target);
break;
-
+
case AnchorType.LOOK_BEHIND_NOT:
len = compileLengthTree(node.target);
addOpcodeRelAddr(OPCode.PUSH_LOOK_BEHIND_NOT, len + OPSize.FAIL_LOOK_BEHIND_NOT);
@@ -1015,7 +1015,7 @@ final class ArrayCompiler extends Compiler {
compileTree(node.target);
addOpcode(OPCode.FAIL_LOOK_BEHIND_NOT);
break;
-
+
default:
newInternalException(ERR_PARSER_BUG);
} // switch
@@ -1023,7 +1023,7 @@ final class ArrayCompiler extends Compiler {
private int compileLengthTree(Node node) {
int len = 0;
-
+
switch (node.getType()) {
case NodeType.LIST:
ConsAltNode lin = (ConsAltNode)node;
@@ -1031,7 +1031,7 @@ final class ArrayCompiler extends Compiler {
len += compileLengthTree(lin.car);
} while ((lin = lin.cdr) != null);
break;
-
+
case NodeType.ALT:
ConsAltNode aln = (ConsAltNode)node;
int n = 0;
@@ -1041,7 +1041,7 @@ final class ArrayCompiler extends Compiler {
} while ((aln = aln.cdr) != null);
len += (OPSize.PUSH + OPSize.JUMP) * (n - 1);
break;
-
+
case NodeType.STR:
StringNode sn = (StringNode)node;
if (sn.isRaw()) {
@@ -1050,21 +1050,21 @@ final class ArrayCompiler extends Compiler {
len = compileLengthStringNode(sn);
}
break;
-
+
case NodeType.CCLASS:
len = compileLengthCClassNode((CClassNode)node);
break;
-
+
case NodeType.CTYPE:
case NodeType.CANY:
len = OPSize.OPCODE;
break;
-
+
case NodeType.BREF:
BackRefNode br = (BackRefNode)node;
-
+
if (Config.USE_BACKREF_WITH_LEVEL && br.isNestLevel()) {
- len = OPSize.OPCODE + OPSize.OPTION + OPSize.LENGTH +
+ len = OPSize.OPCODE + OPSize.OPTION + OPSize.LENGTH +
OPSize.LENGTH + (OPSize.MEMNUM * br.backNum);
} else { // USE_BACKREF_AT_LEVEL
if (br.backNum == 1) {
@@ -1075,14 +1075,14 @@ final class ArrayCompiler extends Compiler {
}
}
break;
-
+
case NodeType.CALL:
if (Config.USE_SUBEXP_CALL) {
len = OPSize.CALL;
break;
} // USE_SUBEXP_CALL
break;
-
+
case NodeType.QTFR:
if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
len = compileCECLengthQuantifierNode((QuantifierNode)node);
@@ -1090,18 +1090,18 @@ final class ArrayCompiler extends Compiler {
len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
}
break;
-
+
case NodeType.ENCLOSE:
len = compileLengthEncloseNode((EncloseNode)node);
break;
-
+
case NodeType.ANCHOR:
len = compileLengthAnchorNode((AnchorNode)node);
break;
default:
newInternalException(ERR_PARSER_BUG);
-
+
} //switch
return len;
}
@@ -1115,7 +1115,7 @@ final class ArrayCompiler extends Compiler {
regex.code = tmp;
}
}
-
+
private void addInt(int i) {
if (regex.codeLength >= regex.code.length) {
int[]tmp = new int[regex.code.length << 1];
@@ -1124,40 +1124,40 @@ final class ArrayCompiler extends Compiler {
}
regex.code[regex.codeLength++] = i;
}
-
+
void setInt(int i, int offset) {
ensure(offset);
regex.code[offset] = i;
}
-
+
private void addObject(Object o) {
if (regex.operands == null) {
regex.operands = new Object[4];
} else if (regex.operandLength >= regex.operands.length) {
- Object[]tmp = new Object[regex.operands.length << 1];
- System.arraycopy(regex.operands, 0, tmp, 0, regex.operands.length);
- regex.operands = tmp;
+ Object[]tmp = new Object[regex.operands.length << 1];
+ System.arraycopy(regex.operands, 0, tmp, 0, regex.operands.length);
+ regex.operands = tmp;
}
addInt(regex.operandLength);
regex.operands[regex.operandLength++] = o;
}
-
+
private void addBytes(byte[]bytes, int p ,int length) {
ensure(regex.codeLength + length);
int end = p + length;
-
+
while (p < end) regex.code[regex.codeLength++] = bytes[p++];
}
-
- private void addInts(int[]ints, int length) {
+
+ private void addInts(int[]ints, int length) {
ensure(regex.codeLength + length);
System.arraycopy(ints, 0, regex.code, regex.codeLength, length);
regex.codeLength += length;
}
-
+
private void addOpcode(int opcode) {
addInt(opcode);
-
+
switch(opcode) {
case OPCode.ANYCHAR_STAR:
case OPCode.ANYCHAR_STAR_SB:
@@ -1165,11 +1165,11 @@ final class ArrayCompiler extends Compiler {
case OPCode.ANYCHAR_ML_STAR_SB:
case OPCode.ANYCHAR_STAR_PEEK_NEXT:
case OPCode.ANYCHAR_STAR_PEEK_NEXT_SB:
- case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT:
+ case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT:
case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT_SB:
case OPCode.STATE_CHECK_ANYCHAR_STAR:
case OPCode.STATE_CHECK_ANYCHAR_STAR_SB:
- case OPCode.STATE_CHECK_ANYCHAR_ML_STAR:
+ case OPCode.STATE_CHECK_ANYCHAR_ML_STAR:
case OPCode.MEMORY_START_PUSH:
case OPCode.MEMORY_END_PUSH:
case OPCode.MEMORY_END_PUSH_REC:
@@ -1187,7 +1187,7 @@ final class ArrayCompiler extends Compiler {
case OPCode.REPEAT_INC_SG:
case OPCode.REPEAT_INC_NG:
case OPCode.REPEAT_INC_NG_SG:
- case OPCode.PUSH_POS:
+ case OPCode.PUSH_POS:
case OPCode.PUSH_POS_NOT:
case OPCode.PUSH_STOP_BT:
case OPCode.PUSH_LOOK_BEHIND_NOT:
@@ -1233,5 +1233,5 @@ final class ArrayCompiler extends Compiler {
private void addOpcodeOption(int opcode, int option) {
addOpcode(opcode);
addOption(option);
- }
+ }
}
diff --git a/src/org/joni/AsmCompiler.java b/src/org/joni/AsmCompiler.java
index 433d324..e39dc05 100644
--- a/src/org/joni/AsmCompiler.java
+++ b/src/org/joni/AsmCompiler.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -33,7 +33,7 @@ final class AsmCompiler extends AsmCompilerSupport {
public AsmCompiler(Analyser analyser) {
super(analyser);
}
-
+
@Override
protected void prepare() {
REG_NUM++;
@@ -44,7 +44,7 @@ final class AsmCompiler extends AsmCompilerSupport {
prepareFactory();
prepareFactoryInit();
}
-
+
@Override
protected void finish() {
setupFactoryInit();
diff --git a/src/org/joni/AsmCompilerSupport.java b/src/org/joni/AsmCompilerSupport.java
index 217aa8b..9f98015 100644
--- a/src/org/joni/AsmCompilerSupport.java
+++ b/src/org/joni/AsmCompilerSupport.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -32,7 +32,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
protected MethodVisitor factoryInit;// factory constructor
protected String factoryName;
- protected ClassWriter machine; // matcher
+ protected ClassWriter machine; // matcher
protected MethodVisitor machineInit;// matcher constructor
protected MethodVisitor match; // actual matcher implementation (the matchAt method)
protected String machineName;
@@ -40,7 +40,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
// we will? try to manage visitMaxs ourselves for efficiency
protected int maxStack = 1;
protected int maxVars = LAST_INDEX;
-
+
// for field generation
protected int bitsets, ranges, templates;
@@ -54,7 +54,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
}
};
- private static final DummyClassLoader loader = new DummyClassLoader();
+ private static final DummyClassLoader loader = new DummyClassLoader();
AsmCompilerSupport(Analyser analyser) {
super(analyser);
@@ -97,7 +97,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
machine = new ClassWriter(ClassWriter.COMPUTE_MAXS);
machineName = "org/joni/NativeMachine" + REG_NUM;
}
-
+
protected final void prepareMachineInit() {
machine.visit(V1_4, ACC_PUBLIC + ACC_FINAL, machineName, null, "org/joni/NativeMachine", null);
machineInit = machine.visitMethod(ACC_PROTECTED, "<init>", "(Lorg/joni/Regex;[BII)V", null, null);
@@ -108,7 +108,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
machineInit.visitVarInsn(ILOAD, 4); // end
machineInit.visitMethodInsn(INVOKESPECIAL, "org/joni/NativeMachine", "<init>", "(Lorg/joni/Regex;[BII)V");
}
-
+
protected final void setupMachineInit() {
if (bitsets + ranges + templates > 0) { // ok, some of these are in use, we'd like to cache the factory
machine.visitField(ACC_PRIVATE + ACC_FINAL, "factory", "L" + factoryName + ";", null, null);
@@ -129,7 +129,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
match = machine.visitMethod(ACC_SYNTHETIC, "matchAt", "(III)I", null, null);
move(S, SSTART); // s = sstart
load("bytes", "[B"); //
- astore(BYTES); // byte[]bytes = this.bytes
+ astore(BYTES); // byte[]bytes = this.bytes
}
protected final void setupMachineMatch() {
@@ -232,7 +232,7 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
factory.visitField(ACC_PRIVATE + ACC_FINAL, name, "[I", null, null);
factoryInit.visitVarInsn(ALOAD, THIS); // this;
loadInt(factoryInit, arr.length); // this, length
- factoryInit.visitIntInsn(NEWARRAY, T_INT); // this, arr
+ factoryInit.visitIntInsn(NEWARRAY, T_INT); // this, arr
for (int i=0;i < arr.length; i++) buildArray(i, arr[i], IASTORE);
factoryInit.visitFieldInsn(PUTFIELD, factoryName, name, "[I");
}
@@ -241,13 +241,13 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
factory.visitField(ACC_PRIVATE + ACC_FINAL, name, "[B", null, null);
factoryInit.visitVarInsn(ALOAD, THIS); // this;
loadInt(factoryInit, arr.length); // this, length
- factoryInit.visitIntInsn(NEWARRAY, T_BYTE); // this, arr
+ factoryInit.visitIntInsn(NEWARRAY, T_BYTE); // this, arr
for (int i=p, j=0; i < p + length; i++, j++) buildArray(j, arr[i] & 0xff, BASTORE);
factoryInit.visitFieldInsn(PUTFIELD, factoryName, name, "[B");
}
private void buildArray(int index, int value, int type) {
- factoryInit.visitInsn(DUP); // ... arr, arr
+ factoryInit.visitInsn(DUP); // ... arr, arr
loadInt(factoryInit, index); // ... arr, arr, index
loadInt(factoryInit, value); // ... arr, arr, index, value
factoryInit.visitInsn(type); // ... arr
@@ -255,13 +255,13 @@ abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConsta
private void loadInt(MethodVisitor mv, int value) {
if (value >= -1 && value <= 5) {
- mv.visitInsn(value + ICONST_0); // ICONST_0 == 3
+ mv.visitInsn(value + ICONST_0); // ICONST_0 == 3
} else if (value >= 6 && value <= 127 || value >= -128 && value <= -2) {
mv.visitIntInsn(BIPUSH, value);
} else if (value >= 128 && value <= 32767 || value >= -32768 && value <= -129) {
mv.visitIntInsn(SIPUSH, value);
} else {
- mv.visitLdcInsn(new Integer(value));
+ mv.visitLdcInsn(new Integer(value));
}
}
}
diff --git a/src/org/joni/BitSet.java b/src/org/joni/BitSet.java
index 3d9cf99..b58d5eb 100644
--- a/src/org/joni/BitSet.java
+++ b/src/org/joni/BitSet.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -25,7 +25,7 @@ public final class BitSet {
private static final int BITS_IN_ROOM = 4 * BITS_PER_BYTE;
static final int BITSET_SIZE = (SINGLE_BYTE_SIZE / BITS_IN_ROOM);
static final int ROOM_SHIFT = log2(BITS_IN_ROOM);
-
+
final int[] bits = new int[BITSET_SIZE];
private static final int BITS_TO_STRING_WRAP = 4;
@@ -38,23 +38,23 @@ public final class BitSet {
}
return buffer.toString();
}
-
+
public boolean at(int pos) {
return (bits[pos >>> ROOM_SHIFT] & bit(pos)) != 0;
}
public void set(int pos) {
- bits[pos >>> ROOM_SHIFT] |= bit(pos);
+ bits[pos >>> ROOM_SHIFT] |= bit(pos);
}
public void clear(int pos) {
- bits[pos >>> ROOM_SHIFT] &= ~bit(pos);
+ bits[pos >>> ROOM_SHIFT] &= ~bit(pos);
}
public void invert(int pos) {
bits[pos >>> ROOM_SHIFT] ^= bit(pos);
}
-
+
public void clear() {
for (int i=0; i<BITSET_SIZE; i++) bits[i]=0;
}
@@ -69,11 +69,11 @@ public final class BitSet {
public void setRange(int from, int to) {
for (int i=from; i<=to && i < SINGLE_BYTE_SIZE; i++) set(i);
}
-
+
public void setAll() {
for (int i=0; i<BITSET_SIZE; i++) bits[i] = ~0;
}
-
+
public void invert() {
for (int i=0; i<BITSET_SIZE; i++) bits[i] = ~bits[i];
}
@@ -101,11 +101,11 @@ public final class BitSet {
}
return num;
}
-
+
static int bit(int pos){
return 1 << (pos % SINGLE_BYTE_SIZE);
}
-
+
private static int log2(int n){
int log = 0;
while ((n >>>= 1) != 0) log++;
diff --git a/src/org/joni/BitStatus.java b/src/org/joni/BitStatus.java
index 1440170..0c68616 100644
--- a/src/org/joni/BitStatus.java
+++ b/src/org/joni/BitStatus.java
@@ -1,27 +1,27 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
final class BitStatus {
public static final int BIT_STATUS_BITS_NUM = 4 * 8;
-
+
public static int bsClear() {
return 0;
}
@@ -29,9 +29,9 @@ final class BitStatus {
return -1;
}
public static boolean bsAt(int stats, int n) {
- return (n < BIT_STATUS_BITS_NUM ? stats & (1 << n) : (stats & 1)) != 0;
+ return (n < BIT_STATUS_BITS_NUM ? stats & (1 << n) : (stats & 1)) != 0;
}
- public static int bsOnAt(int stats, int n) {
+ public static int bsOnAt(int stats, int n) {
if (n < BIT_STATUS_BITS_NUM) {
stats |= (1 << n);
} else {
@@ -43,7 +43,7 @@ final class BitStatus {
if (n < BIT_STATUS_BITS_NUM) stats |= (1 << n);
return stats;
}
-
+
public static int bsOnOff(int v, int f, boolean negative) {
if (negative) {
v &= ~f;
diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index 9ca1988..7591848 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -40,7 +40,7 @@ class ByteCodeMachine extends StackMachine {
private int bestLen; // return value
private int s = 0; // current char
- private int range; // right range
+ private int range; // right range
private int sprev;
private int sstart;
private int sbegin;
@@ -58,7 +58,7 @@ class ByteCodeMachine extends StackMachine {
//CaptureTreeNode child;
int k = stkp;
//int k = kp;
-
+
while (k < stk) {
StackEntry e = stack[k];
if (e.type == MEM_START) {
@@ -70,7 +70,7 @@ class ByteCodeMachine extends StackMachine {
node.addChild(child);
stkp = k + 1;
if (makeCaptureHistoryTree(child)) return true;
-
+
k = stkp;
child.end = e.getMemPStr() - str;
}
@@ -93,12 +93,12 @@ class ByteCodeMachine extends StackMachine {
node = region.historyRoot;
node.clear();
}
-
+
// was clear ???
node.group = 0;
node.beg = sstart - str;
node.end = s - str;
-
+
stkp = 0;
makeCaptureHistoryTree(region.historyRoot);
}
@@ -113,11 +113,11 @@ class ByteCodeMachine extends StackMachine {
protected final byte[]cfbuf2() {
return cfbuf2 == null ? cfbuf2 = new byte[Config.ENC_MBC_CASE_FOLD_MAXLEN] : cfbuf2;
}
-
+
private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, int textEnd) {
byte[]buf1 = cfbuf();
byte[]buf2 = cfbuf2();
-
+
int s2 = ps2.value;
int end1 = s1 + mbLen;
@@ -128,11 +128,11 @@ class ByteCodeMachine extends StackMachine {
value = s2;
int len2 = enc.mbcCaseFold(caseFlodFlag, bytes, this, textEnd, buf2);
s2 = value;
-
+
if (len1 != len2) return false;
int p1 = 0;
int p2 = 0;
-
+
while (len1-- > 0) {
if (buf1[p1] != buf2[p2]) return false;
p1++; p2++;
@@ -141,16 +141,16 @@ class ByteCodeMachine extends StackMachine {
ps2.value = s2;
return true;
}
-
+
private void debugMatchBegin() {
Config.log.println("match_at: " +
"str: " + str +
", end: " + end +
- ", start: " + this.sstart +
+ ", start: " + this.sstart +
", sprev: " + this.sprev);
Config.log.println("size: " + (end - str) + ", start offset: " + (this.sstart - str));
}
-
+
private void debugMatchLoop() {
if (Config.DEBUG_MATCH) {
Config.log.printf("%4d", (s - str)).print("> \"");
@@ -166,28 +166,28 @@ class ByteCodeMachine extends StackMachine {
StringBuilder sb = new StringBuilder();
new ByteCodePrinter(regex).compiledByteCodeToString(sb, ip);
Config.log.println(sb.toString());
- }
+ }
}
-
+
protected final int matchAt(int range, int sstart, int sprev) {
this.range = range;
this.sstart = sstart;
this.sprev = sprev;
-
+
stk = 0;
ip = 0;
-
+
if (Config.DEBUG_MATCH) debugMatchBegin();
-
+
init();
-
+
bestLen = -1;
s = sstart;
final int[]code = this.code;
while (true) {
if (Config.DEBUG_MATCH) debugMatchLoop();
-
+
sbegin = s;
switch (code[ip++]) {
case OPCode.END: if (opEnd()) return finish(); break;
@@ -215,7 +215,7 @@ class ByteCodeMachine extends StackMachine {
case OPCode.CCLASS_MB_NOT: opCClassMBNot(); break;
case OPCode.CCLASS_MIX_NOT: opCClassMIXNot(); break;
case OPCode.CCLASS_NODE: opCClassNode(); break;
-
+
case OPCode.ANYCHAR: opAnyChar(); break;
case OPCode.ANYCHAR_ML: opAnyCharML(); break;
case OPCode.ANYCHAR_STAR: opAnyCharStar(); break;
@@ -224,28 +224,28 @@ class ByteCodeMachine extends StackMachine {
case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT: opAnyCharMLStarPeekNext(); break;
case OPCode.STATE_CHECK_ANYCHAR_STAR: opStateCheckAnyCharStar(); break;
case OPCode.STATE_CHECK_ANYCHAR_ML_STAR:opStateCheckAnyCharMLStar();break;
-
+
case OPCode.WORD: opWord(); break;
case OPCode.NOT_WORD: opNotWord(); break;
case OPCode.WORD_BOUND: opWordBound(); continue;
case OPCode.NOT_WORD_BOUND: opNotWordBound(); continue;
case OPCode.WORD_BEGIN: opWordBegin(); continue;
case OPCode.WORD_END: opWordEnd(); continue;
-
+
case OPCode.BEGIN_BUF: opBeginBuf(); continue;
case OPCode.END_BUF: opEndBuf(); continue;
case OPCode.BEGIN_LINE: opBeginLine(); continue;
case OPCode.END_LINE: opEndLine(); continue;
case OPCode.SEMI_END_BUF: opSemiEndBuf(); continue;
case OPCode.BEGIN_POSITION: opBeginPosition(); continue;
-
+
case OPCode.MEMORY_START_PUSH: opMemoryStartPush(); continue;
case OPCode.MEMORY_START: opMemoryStart(); continue;
case OPCode.MEMORY_END_PUSH: opMemoryEndPush(); continue;
case OPCode.MEMORY_END: opMemoryEnd(); continue;
case OPCode.MEMORY_END_PUSH_REC: opMemoryEndPushRec(); continue;
case OPCode.MEMORY_END_REC: opMemoryEndRec(); continue;
-
+
case OPCode.BACKREF1: opBackRef1(); continue;
case OPCode.BACKREF2: opBackRef2(); continue;
case OPCode.BACKREFN: opBackRefN(); continue;
@@ -253,50 +253,50 @@ class ByteCodeMachine extends StackMachine {
case OPCode.BACKREF_MULTI: opBackRefMulti(); continue;
case OPCode.BACKREF_MULTI_IC: opBackRefMultiIC(); continue;
case OPCode.BACKREF_WITH_LEVEL: opBackRefAtLevel(); continue;
-
+
case OPCode.NULL_CHECK_START: opNullCheckStart(); continue;
case OPCode.NULL_CHECK_END: opNullCheckEnd(); continue;
case OPCode.NULL_CHECK_END_MEMST: opNullCheckEndMemST(); continue;
case OPCode.NULL_CHECK_END_MEMST_PUSH: opNullCheckEndMemSTPush(); continue;
-
+
case OPCode.JUMP: opJump(); continue;
case OPCode.PUSH: opPush(); continue;
-
+
// CEC
case OPCode.STATE_CHECK_PUSH: opStateCheckPush(); continue;
case OPCode.STATE_CHECK_PUSH_OR_JUMP: opStateCheckPushOrJump(); continue;
case OPCode.STATE_CHECK: opStateCheck(); continue;
-
+
case OPCode.POP: opPop(); continue;
case OPCode.PUSH_OR_JUMP_EXACT1: opPushOrJumpExact1(); continue;
case OPCode.PUSH_IF_PEEK_NEXT: opPushIfPeekNext(); continue;
-
+
case OPCode.REPEAT: opRepeat(); continue;
case OPCode.REPEAT_NG: opRepeatNG(); continue;
case OPCode.REPEAT_INC: opRepeatInc(); continue;
case OPCode.REPEAT_INC_SG: opRepeatIncSG(); continue;
case OPCode.REPEAT_INC_NG: opRepeatIncNG(); continue;
case OPCode.REPEAT_INC_NG_SG: opRepeatIncNGSG(); continue;
-
+
case OPCode.PUSH_POS: opPushPos(); continue;
case OPCode.POP_POS: opPopPos(); continue;
case OPCode.PUSH_POS_NOT: opPushPosNot(); continue;
case OPCode.FAIL_POS: opFailPos(); continue;
case OPCode.PUSH_STOP_BT: opPushStopBT(); continue;
case OPCode.POP_STOP_BT: opPopStopBT(); continue;
-
+
case OPCode.LOOK_BEHIND: opLookBehind(); continue;
case OPCode.PUSH_LOOK_BEHIND_NOT: opPushLookBehindNot(); continue;
case OPCode.FAIL_LOOK_BEHIND_NOT: opFailLookBehindNot(); continue;
-
+
// USE_SUBEXP_CALL
case OPCode.CALL: opCall(); continue;
case OPCode.RETURN: opReturn(); continue;
-
+
// single byte implementations
case OPCode.CCLASS_SB: opCClassSb(); break;
- case OPCode.CCLASS_NOT_SB: opCClassNotSb(); break;
-
+ case OPCode.CCLASS_NOT_SB: opCClassNotSb(); break;
+
case OPCode.ANYCHAR_SB: opAnyCharSb(); break;
case OPCode.ANYCHAR_ML_SB: opAnyCharMLSb(); break;
case OPCode.ANYCHAR_STAR_SB: opAnyCharStarSb(); break;
@@ -305,14 +305,14 @@ class ByteCodeMachine extends StackMachine {
case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT_SB: opAnyCharMLStarPeekNextSb(); break;
case OPCode.STATE_CHECK_ANYCHAR_STAR_SB: opStateCheckAnyCharStarSb(); break;
case OPCode.STATE_CHECK_ANYCHAR_ML_STAR_SB: opStateCheckAnyCharMLStarSb();break;
-
+
case OPCode.WORD_SB: opWordSb(); break;
case OPCode.NOT_WORD_SB: opNotWordSb(); break;
case OPCode.WORD_BOUND_SB: opWordBoundSb(); continue;
case OPCode.NOT_WORD_BOUND_SB: opNotWordBoundSb(); continue;
case OPCode.WORD_BEGIN_SB: opWordBeginSb(); continue;
case OPCode.WORD_END_SB: opWordEndSb(); continue;
-
+
case OPCode.LOOK_BEHIND_SB: opLookBehindSb(); continue;
case OPCode.EXACT1_IC_SB: opExact1ICSb(); break;
@@ -320,19 +320,19 @@ class ByteCodeMachine extends StackMachine {
case OPCode.FINISH:
return finish();
-
+
case OPCode.FAIL: opFail(); continue;
-
+
default:
throw new InternalException(ErrorMessages.ERR_UNDEFINED_BYTECODE);
-
+
} // main switch
} // main while
}
private boolean opEnd() {
int n = s - sstart;
-
+
if (n > bestLen) {
if (Config.USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE) {
if (isFindLongest(regex.options)) {
@@ -345,7 +345,7 @@ class ByteCodeMachine extends StackMachine {
}
}
} // USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
-
+
bestLen = n;
final Region region = msaRegion;
if (region != null) {
@@ -357,25 +357,25 @@ class ByteCodeMachine extends StackMachine {
if (repeatStk[memEndStk + i] != INVALID_INDEX) {
region.beg[i] = bsAt(regex.btMemStart, i) ?
stack[repeatStk[memStartStk + i]].getMemPStr() - str :
- repeatStk[memStartStk + i] - str;
-
-
+ repeatStk[memStartStk + i] - str;
+
+
region.end[i] = bsAt(regex.btMemEnd, i) ?
stack[repeatStk[memEndStk + i]].getMemPStr() :
repeatStk[memEndStk + i] - str;
-
+
} else {
region.beg[i] = region.end[i] = Region.REGION_NOTPOS;
}
-
+
}
-
+
if (Config.USE_CAPTURE_HISTORY) {
if (regex.captureHistory != 0) checkCaptureHistory(region);
}
} else {
msaBegin = sstart - str;
- msaEnd = s - str;
+ msaEnd = s - str;
}
} else {
Region region = msaRegion;
@@ -393,13 +393,13 @@ class ByteCodeMachine extends StackMachine {
} else {
msaBegin = msaEnd = 0;
}
- } // USE_POSIX_REGION_OPTION
+ } // USE_POSIX_REGION_OPTION
}
// end_best_len:
/* default behavior: return first-matching result. */
return endBestLength();
}
-
+
private boolean endBestLength() {
if (isFindCondition(regex.options)) {
if (isFindNotEmpty(regex.options) && s == sstart) {
@@ -416,11 +416,11 @@ class ByteCodeMachine extends StackMachine {
private void opExact1() {
if (s >= range || code[ip] != bytes[s++]) {opFail(); return;}
- //if (s > range) {opFail(); return;}
+ //if (s > range) {opFail(); return;}
ip++;
sprev = sbegin; // break;
}
-
+
private void opExact2() {
if (s + 2 > range) {opFail(); return;}
if (code[ip] != bytes[s]) {opFail(); return;}
@@ -440,7 +440,7 @@ class ByteCodeMachine extends StackMachine {
sprev = s;
ip++; s++;
}
-
+
private void opExact4() {
if (s + 4 > range) {opFail(); return;}
if (code[ip] != bytes[s]) {opFail(); return;}
@@ -453,7 +453,7 @@ class ByteCodeMachine extends StackMachine {
sprev = s;
ip++; s++;
}
-
+
private void opExact5() {
if (s + 5 > range) {opFail(); return;}
if (code[ip] != bytes[s]) {opFail(); return;}
@@ -468,11 +468,11 @@ class ByteCodeMachine extends StackMachine {
sprev = s;
ip++; s++;
}
-
+
private void opExactN() {
- int tlen = code[ip++];
+ int tlen = code[ip++];
if (s + tlen > range) {opFail(); return;}
-
+
while (tlen-- > 0) if (code[ip++] != bytes[s++]) {opFail(); return;}
sprev = s - 1;
}
@@ -485,7 +485,7 @@ class ByteCodeMachine extends StackMachine {
ip++; s++;
sprev = sbegin; // break;
}
-
+
private void opExactMB2N2() {
if (s + 4 > range) {opFail(); return;}
if (code[ip] != bytes[s]) {opFail(); return;}
@@ -498,7 +498,7 @@ class ByteCodeMachine extends StackMachine {
if (code[ip] != bytes[s]) {opFail(); return;}
ip++; s++;
}
-
+
private void opExactMB2N3() {
if (s + 6 > range) {opFail(); return;}
if (code[ip] != bytes[s]) {opFail(); return;}
@@ -515,11 +515,11 @@ class ByteCodeMachine extends StackMachine {
if (code[ip] != bytes[s]) {opFail(); return;}
ip++; s++;
}
-
- private void opExactMB2N() {
+
+ private void opExactMB2N() {
int tlen = code[ip++];
if (tlen * 2 > range) {opFail(); return;}
-
+
while(tlen-- > 0) {
if (code[ip] != bytes[s]) {opFail(); return;}
ip++; s++;
@@ -528,11 +528,11 @@ class ByteCodeMachine extends StackMachine {
}
sprev = s - 2;
}
-
+
private void opExactMB3N() {
int tlen = code[ip++];
if (tlen * 3 > range) {opFail(); return;}
-
+
while (tlen-- > 0) {
if (code[ip] != bytes[s]) {opFail(); return;}
ip++; s++;
@@ -543,30 +543,30 @@ class ByteCodeMachine extends StackMachine {
}
sprev = s - 3;
}
-
+
private void opExactMBN() {
int tlen = code[ip++]; /* mb-len */
int tlen2= code[ip++]; /* string len */
-
+
tlen2 *= tlen;
if (s + tlen2 > range) {opFail(); return;}
-
+
while(tlen2-- > 0) {
if (code[ip] != bytes[s]) {opFail(); return;}
ip++; s++;
}
sprev = s - tlen;
}
-
+
private void opExact1IC() {
if (s >= range) {opFail(); return;}
-
+
byte[]lowbuf = cfbuf();
-
+
value = s;
int len = enc.mbcCaseFold(regex.caseFoldFlag, bytes, this, end, lowbuf);
s = value;
-
+
if (s > range) {opFail(); return;}
int q = 0;
@@ -576,7 +576,7 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opExact1ICSb() {
if (s >= range || code[ip] != enc.toLowerCaseTable()[bytes[s++] & 0xff]) {opFail(); return;}
ip++;
@@ -586,39 +586,39 @@ class ByteCodeMachine extends StackMachine {
private void opExactNIC() {
int tlen = code[ip++];
int endp = ip + tlen;
-
+
byte[]lowbuf = cfbuf();
-
+
while (ip < endp) {
sprev = s;
if (s >= range) {opFail(); return;}
-
+
value = s;
int len = enc.mbcCaseFold(regex.caseFoldFlag, bytes, this, end, lowbuf);
s = value;
-
+
if (s > range) {opFail(); return;}
int q = 0;
- while (len-- > 0) {
+ while (len-- > 0) {
if (code[ip] != lowbuf[q]) {opFail(); return;}
ip++; q++;
}
}
}
-
+
private void opExactNICSb() {
- int tlen = code[ip++];
+ int tlen = code[ip++];
if (s + tlen > range) {opFail(); return;}
byte[]toLowerTable = enc.toLowerCaseTable();
while (tlen-- > 0) if (code[ip++] != toLowerTable[bytes[s++] & 0xff]) {opFail(); return;}
sprev = s - 1;
- }
-
+ }
+
private boolean isInBitSet() {
int c = bytes[s] & 0xff;
return ((code[ip + (c >>> BitSet.ROOM_SHIFT)] & (1 << c)) != 0);
}
-
+
private void opCClass() {
if (s >= range || !isInBitSet()) {opFail(); return;}
ip += BitSet.BITSET_SIZE;
@@ -626,16 +626,16 @@ class ByteCodeMachine extends StackMachine {
if (s > end) s = end;
sprev = sbegin; // break;
}
-
+
private void opCClassSb() {
if (s >= range || !isInBitSet()) {opFail(); return;}
ip += BitSet.BITSET_SIZE;
s++;
sprev = sbegin; // break;
- }
-
+ }
+
private boolean isInClassMB() {
- int tlen = code[ip++];
+ int tlen = code[ip++];
if (s >= range) return false;
int mbLen = enc.length(bytes, s, end);
if (s + mbLen > range) return false;
@@ -644,16 +644,16 @@ class ByteCodeMachine extends StackMachine {
int c = enc.mbcToCode(bytes, ss, s);
if (!CodeRange.isInCodeRange(code, ip, c)) return false;
ip += tlen;
- return true;
+ return true;
}
-
+
private void opCClassMB() {
- // beyond string check
+ // beyond string check
if (s >= range || !enc.isMbcHead(bytes, s, end)) {opFail(); return;}
if (!isInClassMB()) {opFail(); return;} // not!!!
sprev = sbegin; // break;
}
-
+
private void opCClassMIX() {
if (s >= range) {opFail(); return;}
if (enc.isMbcHead(bytes, s, end)) {
@@ -668,7 +668,7 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opCClassNot() {
if (s >= range || isInBitSet()) {opFail(); return;}
ip += BitSet.BITSET_SIZE;
@@ -676,34 +676,34 @@ class ByteCodeMachine extends StackMachine {
if (s > end) s = end;
sprev = sbegin; // break;
}
-
+
private void opCClassNotSb() {
if (s >= range || isInBitSet()) {opFail(); return;}
ip += BitSet.BITSET_SIZE;
s++;
sprev = sbegin; // break;
- }
-
+ }
+
private boolean isNotInClassMB() {
int tlen = code[ip++];
int mbLen = enc.length(bytes, s, end);
-
+
if (!(s + mbLen <= range)) {
if (s >= range) return false;
s = end;
ip += tlen;
return true;
}
-
+
int ss = s;
s += mbLen;
int c = enc.mbcToCode(bytes, ss, s);
-
+
if (CodeRange.isInCodeRange(code, ip, c)) return false;
ip += tlen;
return true;
- }
-
+ }
+
private void opCClassMBNot() {
if (s >= range) {opFail(); return;}
if (!enc.isMbcHead(bytes, s, end)) {
@@ -716,7 +716,7 @@ class ByteCodeMachine extends StackMachine {
if (!isNotInClassMB()) {opFail(); return;}
sprev = sbegin; // break;
}
-
+
private void opCClassMIXNot() {
if (s >= range) {opFail(); return;}
if (enc.isMbcHead(bytes, s, end)) {
@@ -731,7 +731,7 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opCClassNode() {
if (s >= range) {opFail(); return;}
CClassNode cc = (CClassNode)regex.operands[code[ip++]];
@@ -743,7 +743,7 @@ class ByteCodeMachine extends StackMachine {
if (!cc.isCodeInCCLength(mbLen, c)) {opFail(); return;}
sprev = sbegin; // break;
}
-
+
private void opAnyChar() {
if (s >= range) {opFail(); return;}
int n = enc.length(bytes, s, end);
@@ -752,28 +752,28 @@ class ByteCodeMachine extends StackMachine {
s += n;
sprev = sbegin; // break;
}
-
+
private void opAnyCharSb() {
if (s >= range) {opFail(); return;}
if (bytes[s] == Encoding.NEW_LINE) {opFail(); return;}
s++;
sprev = sbegin; // break;
}
-
+
private void opAnyCharML() {
if (s >= range) {opFail(); return;}
int n = enc.length(bytes, s, end);
if (s + n > range) {opFail(); return;}
- s += n;
- sprev = sbegin; // break;
+ s += n;
+ sprev = sbegin; // break;
}
private void opAnyCharMLSb() {
if (s >= range) {opFail(); return;}
s++;
- sprev = sbegin; // break;
+ sprev = sbegin; // break;
}
-
+
private void opAnyCharStar() {
final byte[]bytes = this.bytes;
while (s < range) {
@@ -786,7 +786,7 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opAnyCharStarSb() {
final byte[]bytes = this.bytes;
while (s < range) {
@@ -797,7 +797,7 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opAnyCharMLStar() {
final byte[]bytes = this.bytes;
while (s < range) {
@@ -818,11 +818,11 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opAnyCharStarPeekNext() {
final byte c = (byte)code[ip];
final byte[]bytes = this.bytes;
-
+
while (s < range) {
if (c == bytes[s]) pushAlt(ip + 1, s, sprev);
int n = enc.length(bytes, s, end);
@@ -833,11 +833,11 @@ class ByteCodeMachine extends StackMachine {
ip++;
sprev = sbegin; // break;
}
-
+
private void opAnyCharStarPeekNextSb() {
final byte c = (byte)code[ip];
final byte[]bytes = this.bytes;
-
+
while (s < range) {
byte b = bytes[s];
if (c == b) pushAlt(ip + 1, s, sprev);
@@ -848,11 +848,11 @@ class ByteCodeMachine extends StackMachine {
ip++;
sprev = sbegin; // break;
}
-
+
private void opAnyCharMLStarPeekNext() {
final byte c = (byte)code[ip];
final byte[]bytes = this.bytes;
-
+
while (s < range) {
if (c == bytes[s]) pushAlt(ip + 1, s, sprev);
int n = enc.length(bytes, s, end);
@@ -863,7 +863,7 @@ class ByteCodeMachine extends StackMachine {
ip++;
sprev = sbegin; // break;
}
-
+
private void opAnyCharMLStarPeekNextSb() {
final byte c = (byte)code[ip];
final byte[]bytes = this.bytes;
@@ -876,12 +876,12 @@ class ByteCodeMachine extends StackMachine {
ip++;
sprev = sbegin; // break;
}
-
+
// CEC
private void opStateCheckAnyCharStar() {
int mem = code[ip++];
final byte[]bytes = this.bytes;
-
+
while (s < range) {
if (stateCheckVal(s, mem)) {opFail(); return;}
pushAltWithStateCheck(ip, s, sprev, mem);
@@ -892,11 +892,11 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opStateCheckAnyCharStarSb() {
int mem = code[ip++];
final byte[]bytes = this.bytes;
-
+
while (s < range) {
if (stateCheckVal(s, mem)) {opFail(); return;}
pushAltWithStateCheck(ip, s, sprev, mem);
@@ -906,12 +906,12 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
// CEC
private void opStateCheckAnyCharMLStar() {
int mem = code[ip++];
-
- final byte[]bytes = this.bytes;
+
+ final byte[]bytes = this.bytes;
while (s < range) {
if (stateCheckVal(s, mem)) {opFail(); return;}
pushAltWithStateCheck(ip, s, sprev, mem);
@@ -922,10 +922,10 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opStateCheckAnyCharMLStarSb() {
int mem = code[ip++];
-
+
while (s < range) {
if (stateCheckVal(s, mem)) {opFail(); return;}
pushAltWithStateCheck(ip, s, sprev, mem);
@@ -934,7 +934,7 @@ class ByteCodeMachine extends StackMachine {
}
sprev = sbegin; // break;
}
-
+
private void opWord() {
if (s >= range || !enc.isMbcWord(bytes, s, end)) {opFail(); return;}
s += enc.length(bytes, s, end);
@@ -943,22 +943,22 @@ class ByteCodeMachine extends StackMachine {
private void opWordSb() {
if (s >= range || !enc.isWord(bytes[s] & 0xff)) {opFail(); return;}
- s++;
+ s++;
sprev = sbegin; // break;
}
-
+
private void opNotWord() {
if (s >= range || enc.isMbcWord(bytes, s, end)) {opFail(); return;}
s += enc.length(bytes, s, end);
sprev = sbegin; // break;
}
-
+
private void opNotWordSb() {
if (s >= range || enc.isWord(bytes[s] & 0xff)) {opFail(); return;}
s++;
sprev = sbegin; // break;
}
-
+
private void opWordBound() {
if (s == str) {
if (s >= range || !enc.isMbcWord(bytes, s, end)) {opFail(); return;}
@@ -968,7 +968,7 @@ class ByteCodeMachine extends StackMachine {
if (enc.isMbcWord(bytes, s, end) == enc.isMbcWord(bytes, sprev, end)) {opFail(); return;}
}
}
-
+
private void opWordBoundSb() {
if (s == str) {
if (s >= range || !enc.isWord(bytes[s] & 0xff)) {opFail(); return;}
@@ -978,7 +978,7 @@ class ByteCodeMachine extends StackMachine {
if (enc.isWord(bytes[s] & 0xff) == enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
}
}
-
+
private void opNotWordBound() {
if (s == str) {
if (s < range && enc.isMbcWord(bytes, s, end)) {opFail(); return;}
@@ -998,7 +998,7 @@ class ByteCodeMachine extends StackMachine {
if (enc.isWord(bytes[s] & 0xff) != enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
}
}
-
+
private void opWordBegin() {
if (s < range && enc.isMbcWord(bytes, s, end)) {
if (s == str || !enc.isMbcWord(bytes, sprev, end)) return;
@@ -1012,7 +1012,7 @@ class ByteCodeMachine extends StackMachine {
}
opFail();
}
-
+
private void opWordEnd() {
if (s != str && enc.isMbcWord(bytes, sprev, end)) {
if (s == end || !enc.isMbcWord(bytes, s, end)) return;
@@ -1026,15 +1026,15 @@ class ByteCodeMachine extends StackMachine {
}
opFail();
}
-
+
private void opBeginBuf() {
if (s != str) opFail();
}
-
+
private void opEndBuf() {
if (s != end) opFail();
}
-
+
private void opBeginLine() {
if (s == str) {
if (isNotBol(msaOptions)) opFail();
@@ -1044,7 +1044,7 @@ class ByteCodeMachine extends StackMachine {
}
opFail();
}
-
+
private void opEndLine() {
if (s == end) {
if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
@@ -1061,7 +1061,7 @@ class ByteCodeMachine extends StackMachine {
}
opFail();
}
-
+
private void opSemiEndBuf() {
if (s == end) {
if (Config.USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE) {
@@ -1091,162 +1091,162 @@ class ByteCodeMachine extends StackMachine {
int mem = code[ip++];
pushMemStart(mem, s);
}
-
+
private void opMemoryStart() {
int mem = code[ip++];
repeatStk[memStartStk + mem] = s;
}
-
+
private void opMemoryEndPush() {
int mem = code[ip++];
pushMemEnd(mem, s);
}
-
+
private void opMemoryEnd() {
int mem = code[ip++];
repeatStk[memEndStk + mem] = s;
}
-
+
private void opMemoryEndPushRec() {
int mem = code[ip++];
int stkp = getMemStart(mem); /* should be before push mem-end. */
pushMemEnd(mem, s);
repeatStk[memStartStk + mem] = stkp;
}
-
+
private void opMemoryEndRec() {
int mem = code[ip++];
repeatStk[memEndStk + mem] = s;
int stkp = getMemStart(mem);
-
+
if (BitStatus.bsAt(regex.btMemStart, mem)) {
repeatStk[memStartStk + mem] = stkp;
} else {
repeatStk[memStartStk + mem] = stack[stkp].getMemPStr();
}
-
+
pushMemEndMark(mem);
}
-
+
private boolean backrefInvalid(int mem) {
return repeatStk[memEndStk + mem] == INVALID_INDEX || repeatStk[memStartStk + mem] == INVALID_INDEX;
}
-
+
private int backrefStart(int mem) {
return bsAt(regex.btMemStart, mem) ? stack[repeatStk[memStartStk + mem]].getMemPStr() : repeatStk[memStartStk + mem];
}
-
+
private int backrefEnd(int mem) {
return bsAt(regex.btMemEnd, mem) ? stack[repeatStk[memEndStk + mem]].getMemPStr() : repeatStk[memEndStk + mem];
}
-
+
private void backref(int mem) {
/* if you want to remove following line,
you should check in parse and compile time. (numMem) */
if (mem > regex.numMem || backrefInvalid(mem)) {opFail(); return;}
-
+
int pstart = backrefStart(mem);
int pend = backrefEnd(mem);
-
+
int n = pend - pstart;
if (s + n > range) {opFail(); return;}
sprev = s;
-
+
// STRING_CMP
while(n-- > 0) if (bytes[pstart++] != bytes[s++]) {opFail(); return;}
int len;
-
+
// beyond string check
if (sprev < range) {
while (sprev + (len = enc.length(bytes, sprev, end)) < s) sprev += len;
}
}
-
+
private void opBackRef1() {
backref(1);
}
-
+
private void opBackRef2() {
backref(2);
}
-
+
private void opBackRefN() {
backref(code[ip++]);
}
-
+
private void opBackRefNIC() {
int mem = code[ip++];
- /* if you want to remove following line,
+ /* if you want to remove following line,
you should check in parse and compile time. (numMem) */
if (mem > regex.numMem || backrefInvalid(mem)) {opFail(); return;}
int pstart = backrefStart(mem);
int pend = backrefEnd(mem);
-
+
int n = pend - pstart;
if (s + n > range) {opFail(); return;}
sprev = s;
-
- value = s;
+
+ value = s;
if (!stringCmpIC(regex.caseFoldFlag, pstart, this, n, end)) {opFail(); return;}
s = value;
-
+
int len;
// if (sprev < bytes.length)
while (sprev + (len = enc.length(bytes, sprev, end)) < s) sprev += len;
}
-
+
private void opBackRefMulti() {
int tlen = code[ip++];
-
+
int i;
loop:for (i=0; i<tlen; i++) {
int mem = code[ip++];
if (backrefInvalid(mem)) continue;
-
+
int pstart = backrefStart(mem);
int pend = backrefEnd(mem);
-
+
int n = pend - pstart;
if (s + n > range) {opFail(); return;}
-
+
sprev = s;
int swork = s;
-
+
while (n-- > 0) {
if (bytes[pstart++] != bytes[swork++]) continue loop;
}
-
+
s = swork;
-
+
int len;
// beyond string check
if (sprev < range) {
while (sprev + (len = enc.length(bytes, sprev, end)) < s) sprev += len;
}
-
+
ip += tlen - i - 1; // * SIZE_MEMNUM (1)
break; /* success */
}
if (i == tlen) {opFail(); return;}
}
-
+
private void opBackRefMultiIC() {
int tlen = code[ip++];
-
+
int i;
loop:for (i=0; i<tlen; i++) {
int mem = code[ip++];
if (backrefInvalid(mem)) continue;
-
+
int pstart = backrefStart(mem);
int pend = backrefEnd(mem);
-
+
int n = pend - pstart;
if (s + n > range) {opFail(); return;}
-
+
sprev = s;
value = s;
@@ -1256,13 +1256,13 @@ class ByteCodeMachine extends StackMachine {
int len;
// if (sprev < bytes.length)
while (sprev + (len = enc.length(bytes, sprev, end)) < s) sprev += len;
-
+
ip += tlen - i - 1; // * SIZE_MEMNUM (1)
break; /* success */
}
if (i == tlen) {opFail(); return;}
}
-
+
private boolean memIsInMemp(int mem, int num, int memp) {
for (int i=0; i<num; i++) {
int m = code[memp++];
@@ -1270,9 +1270,9 @@ class ByteCodeMachine extends StackMachine {
}
return false;
}
-
+
// USE_BACKREF_AT_LEVEL // (s) and (end) implicit
- private boolean backrefMatchAtNestedLevel(boolean ignoreCase, int caseFoldFlag,
+ private boolean backrefMatchAtNestedLevel(boolean ignoreCase, int caseFoldFlag,
int nest, int memNum, int memp) {
int pend = -1;
int level = 0;
@@ -1280,7 +1280,7 @@ class ByteCodeMachine extends StackMachine {
while (k >= 0) {
StackEntry e = stack[k];
-
+
if (e.type == CALL_FRAME) {
level--;
} else if (e.type == RETURN) {
@@ -1317,13 +1317,13 @@ class ByteCodeMachine extends StackMachine {
k--;
}
return false;
- }
-
+ }
+
private void opBackRefAtLevel() {
int ic = code[ip++];
int level = code[ip++];
int tlen = code[ip++];
-
+
sprev = s;
if (backrefMatchAtNestedLevel(ic != 0, regex.caseFoldFlag, level, tlen, ip)) { // (s) and (end) implicit
int len;
@@ -1349,7 +1349,7 @@ class ByteCodeMachine extends StackMachine {
int mem = code[ip++];
pushNullCheckStart(mem, s);
}
-
+
private void nullCheckFound() {
// null_check_found:
/* empty loop founded, skip next instruction */
@@ -1366,69 +1366,69 @@ class ByteCodeMachine extends StackMachine {
break;
default:
throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
- } // switch
+ } // switch
}
-
+
private void opNullCheckEnd() {
int mem = code[ip++];
int isNull = nullCheck(mem, s); /* mem: null check id */
-
+
if (isNull != 0) {
if (Config.DEBUG_MATCH) {
Config.log.println("NULL_CHECK_END: skip id:" + mem + ", s:" + s);
}
-
+
nullCheckFound();
}
}
-
+
// USE_INFINITE_REPEAT_MONOMANIAC_MEM_STATUS_CHECK
private void opNullCheckEndMemST() {
int mem = code[ip++]; /* mem: null check id */
int isNull = nullCheckMemSt(mem, s);
-
+
if (isNull != 0) {
if (Config.DEBUG_MATCH) {
Config.log.println("NULL_CHECK_END_MEMST: skip id:" + mem + ", s:" + s);
}
-
+
if (isNull == -1) {opFail(); return;}
nullCheckFound();
}
}
-
+
// USE_SUBEXP_CALL
private void opNullCheckEndMemSTPush() {
int mem = code[ip++]; /* mem: null check id */
-
+
int isNull;
if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) {
isNull = nullCheckMemStRec(mem, s);
} else {
isNull = nullCheckRec(mem, s);
}
-
+
if (isNull != 0) {
if (Config.DEBUG_MATCH) {
Config.log.println("NULL_CHECK_END_MEMST_PUSH: skip id:" + mem + ", s:" + s);
- }
-
+ }
+
if (isNull == -1) {opFail(); return;}
nullCheckFound();
} else {
pushNullCheckEnd(mem);
}
}
-
+
private void opJump() {
ip += code[ip] + 1;
}
-
+
private void opPush() {
int addr = code[ip++];
pushAlt(ip + addr, s, sprev);
}
-
+
// CEC
private void opStateCheckPush() {
int mem = code[ip++];
@@ -1436,30 +1436,30 @@ class ByteCodeMachine extends StackMachine {
int addr = code[ip++];
pushAltWithStateCheck(ip + addr, s, sprev, mem);
}
-
+
// CEC
private void opStateCheckPushOrJump() {
int mem = code[ip++];
int addr= code[ip++];
-
+
if (stateCheckVal(s, mem)) {
ip += addr;
} else {
pushAltWithStateCheck(ip + addr, s, sprev, mem);
}
}
-
+
// CEC
private void opStateCheck() {
int mem = code[ip++];
if (stateCheckVal(s, mem)) {opFail(); return;}
pushStateCheck(s, mem);
}
-
+
private void opPop() {
popOne();
}
-
+
private void opPushOrJumpExact1() {
int addr = code[ip++];
if (code[ip] == bytes[s] && s < range) {
@@ -1469,10 +1469,10 @@ class ByteCodeMachine extends StackMachine {
}
ip += addr + 1;
}
-
+
private void opPushIfPeekNext() {
int addr = code[ip++];
- // beyond string check
+ // beyond string check
if (s < range && code[ip] == bytes[s]) {
ip++;
pushAlt(ip + addr, s, sprev);
@@ -1480,39 +1480,39 @@ class ByteCodeMachine extends StackMachine {
}
ip++;
}
-
+
private void opRepeat() {
int mem = code[ip++]; /* mem: OP_REPEAT ID */
int addr= code[ip++];
-
+
// ensure1();
repeatStk[mem] = stk;
pushRepeat(mem, ip);
-
+
if (regex.repeatRangeLo[mem] == 0) { // lower
pushAlt(ip + addr, s, sprev);
}
}
-
+
private void opRepeatNG() {
int mem = code[ip++]; /* mem: OP_REPEAT ID */
int addr= code[ip++];
-
+
// ensure1();
repeatStk[mem] = stk;
pushRepeat(mem, ip);
-
+
if (regex.repeatRangeLo[mem] == 0) {
pushAlt(ip, s, sprev);
ip += addr;
}
}
-
+
private void repeatInc(int mem, int si) {
StackEntry e = stack[si];
-
+
e.increaseRepeatCount();
-
+
if (e.getRepeatCount() >= regex.repeatRangeHi[mem]) {
/* end of repeat. Nothing to do. */
} else if (e.getRepeatCount() >= regex.repeatRangeLo[mem]) {
@@ -1523,24 +1523,24 @@ class ByteCodeMachine extends StackMachine {
}
pushRepeatInc(si);
}
-
+
private void opRepeatInc() {
- int mem = code[ip++]; /* mem: OP_REPEAT ID */
- int si = repeatStk[mem];
+ int mem = code[ip++]; /* mem: OP_REPEAT ID */
+ int si = repeatStk[mem];
repeatInc(mem, si);
}
-
+
private void opRepeatIncSG() {
int mem = code[ip++]; /* mem: OP_REPEAT ID */
int si = getRepeat(mem);
repeatInc(mem, si);
}
-
+
private void repeatIncNG(int mem, int si) {
StackEntry e = stack[si];
-
+
e.increaseRepeatCount();
-
+
if (e.getRepeatCount() < regex.repeatRangeHi[mem]) {
if (e.getRepeatCount() >= regex.repeatRangeLo[mem]) {
int pcode = e.getRepeatPCode();
@@ -1554,43 +1554,43 @@ class ByteCodeMachine extends StackMachine {
pushRepeatInc(si);
}
}
-
+
private void opRepeatIncNG() {
int mem = code[ip++];
int si = repeatStk[mem];
repeatIncNG(mem, si);
}
-
+
private void opRepeatIncNGSG() {
int mem = code[ip++];
int si = getRepeat(mem);
repeatIncNG(mem, si);
}
-
+
private void opPushPos() {
pushPos(s, sprev);
}
-
+
private void opPopPos() {
StackEntry e = stack[posEnd()];
s = e.getStatePStr();
- sprev= e.getStatePStrPrev();
+ sprev= e.getStatePStrPrev();
}
-
+
private void opPushPosNot() {
int addr = code[ip++];
pushPosNot(ip + addr, s, sprev);
}
-
+
private void opFailPos() {
popTilPosNot();
opFail();
}
-
+
private void opPushStopBT() {
pushStopBT();
}
-
+
private void opPopStopBT() {
stopBtEnd();
}
@@ -1606,9 +1606,9 @@ class ByteCodeMachine extends StackMachine {
int tlen = code[ip++];
s -= tlen;
if (s < str) {opFail(); return;}
- sprev = s == str ? -1 : s - 1;
+ sprev = s == str ? -1 : s - 1;
}
-
+
private void opPushLookBehindNot() {
int addr = code[ip++];
int tlen = code[ip++];
@@ -1629,25 +1629,25 @@ class ByteCodeMachine extends StackMachine {
popTilLookBehindNot();
opFail();
}
-
+
private void opCall() {
int addr = code[ip++];
pushCallFrame(ip);
ip = addr; // absolute address
}
-
+
private void opReturn() {
ip = sreturn();
pushReturn();
}
-
+
private void opFail() {
if (stack == null) {
ip = regex.codeLength - 1;
return;
}
-
+
StackEntry e = pop();
ip = e.getStatePCode();
s = e.getStatePStr();
@@ -1660,7 +1660,7 @@ class ByteCodeMachine extends StackMachine {
}
}
}
-
+
private int finish() {
return bestLen;
}
diff --git a/src/org/joni/ByteCodePrinter.java b/src/org/joni/ByteCodePrinter.java
index 5efb353..0a23211 100644
--- a/src/org/joni/ByteCodePrinter.java
+++ b/src/org/joni/ByteCodePrinter.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -29,36 +29,36 @@ import org.joni.exception.InternalException;
class ByteCodePrinter {
int[]code;
int codeLength;
-
+
Object[]operands;
int operantCount;
Encoding enc;
WarnCallback warnings;
-
+
public ByteCodePrinter(Regex regex) {
code = regex.code;
codeLength = regex.codeLength;
operands = regex.operands;
operantCount = regex.operandLength;
- enc = regex.enc;
+ enc = regex.enc;
warnings = regex.warnings;
}
-
+
public String byteCodeListToString() {
return compiledByteCodeListToString();
}
-
+
private void pString(StringBuilder sb, int len, int s) {
sb.append(":");
while (len-- > 0) sb.append(new String(new byte[]{(byte)code[s++]}));
}
-
+
private void pLenString(StringBuilder sb, int len, int mbLen, int s) {
int x = len * mbLen;
sb.append(":" + len + ":");
while (x-- > 0) sb.append(new String(new byte[]{(byte)code[s++]}));
}
-
+
public int compiledByteCodeToString(StringBuilder sb, int bp) {
int len, n, mem, addr, scn, cod;
BitSet bs;
@@ -77,27 +77,27 @@ class ByteCodePrinter {
sb.append(":(" + code[bp] + ")");
bp += OPSize.RELADDR;
break;
-
+
case Arguments.ABSADDR:
sb.append(":(" + code[bp] + ")");
bp += OPSize.ABSADDR;
break;
-
+
case Arguments.LENGTH:
sb.append(":" + code[bp]);
bp += OPSize.LENGTH;
break;
-
+
case Arguments.MEMNUM:
sb.append(":" + code[bp]);
bp += OPSize.MEMNUM;
break;
-
+
case Arguments.OPTION:
sb.append(":" + code[bp]);
bp += OPSize.OPTION;
break;
-
+
case Arguments.STATE_CHECK:
sb.append(":" + code[bp]);
bp += OPSize.STATE_CHECK;
@@ -108,53 +108,53 @@ class ByteCodePrinter {
case OPCode.EXACT1:
case OPCode.ANYCHAR_STAR_PEEK_NEXT:
case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT:
- case OPCode.ANYCHAR_STAR_PEEK_NEXT_SB:
+ case OPCode.ANYCHAR_STAR_PEEK_NEXT_SB:
case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT_SB:
pString(sb, 1, bp++);
break;
-
+
case OPCode.EXACT2:
pString(sb, 2, bp);
bp += 2;
break;
-
+
case OPCode.EXACT3:
pString(sb, 3, bp);
bp += 3;
break;
-
+
case OPCode.EXACT4:
pString(sb, 4, bp);
bp += 4;
break;
-
+
case OPCode.EXACT5:
- pString(sb, 5, bp);
+ pString(sb, 5, bp);
bp += 5;
break;
-
+
case OPCode.EXACTN:
len = code[bp];
bp += OPSize.LENGTH;
pLenString(sb, len, 1, bp);
bp += len;
break;
-
+
case OPCode.EXACTMB2N1:
pString(sb, 2, bp);
bp += 2;
break;
-
+
case OPCode.EXACTMB2N2:
pString(sb, 4, bp);
bp += 4;
break;
-
+
case OPCode.EXACTMB2N3:
pString(sb, 6, bp);
bp += 6;
break;
-
+
case OPCode.EXACTMB2N:
len = code[bp];
bp += OPSize.LENGTH;
@@ -168,7 +168,7 @@ class ByteCodePrinter {
pLenString(sb, len, 3, bp);
bp += len * 3;
break;
-
+
case OPCode.EXACTMBN:
int mbLen = code[bp];
bp += OPSize.LENGTH;
@@ -178,17 +178,17 @@ class ByteCodePrinter {
n = len * mbLen;
while (n-- > 0) sb.append(new String(new byte[]{(byte)code[bp++]}));
break;
-
+
case OPCode.EXACT1_IC:
case OPCode.EXACT1_IC_SB:
final int MAX_CHAR_LENGTH = 6;
byte[]bytes = new byte[MAX_CHAR_LENGTH];
- for (int i = 0; bp + i < code.length && i < MAX_CHAR_LENGTH; i++) bytes[i] = (byte)code[bp + i];
+ for (int i = 0; bp + i < code.length && i < MAX_CHAR_LENGTH; i++) bytes[i] = (byte)code[bp + i];
len = enc.length(bytes, 0, MAX_CHAR_LENGTH);
pString(sb, len, bp);
bp += len;
break;
-
+
case OPCode.EXACTN_IC:
case OPCode.EXACTN_IC_SB:
len = code[bp];
@@ -196,7 +196,7 @@ class ByteCodePrinter {
pLenString(sb, len, 1, bp);
bp += len;
break;
-
+
case OPCode.CCLASS:
case OPCode.CCLASS_SB:
bs = new BitSet();
@@ -205,7 +205,7 @@ class ByteCodePrinter {
bp += BitSet.BITSET_SIZE;
sb.append(":" + n);
break;
-
+
case OPCode.CCLASS_NOT:
case OPCode.CCLASS_NOT_SB:
bs = new BitSet();
@@ -214,15 +214,15 @@ class ByteCodePrinter {
bp += BitSet.BITSET_SIZE;
sb.append(":" + n);
break;
-
+
case OPCode.CCLASS_MB:
- case OPCode.CCLASS_MB_NOT:
+ case OPCode.CCLASS_MB_NOT:
len = code[bp];
bp += OPSize.LENGTH;
cod = code[bp];
//bp += OPSize.CODE_POINT;
bp += len;
- sb.append(":" + cod + ":" + len);
+ sb.append(":" + cod + ":" + len);
break;
case OPCode.CCLASS_MIX:
@@ -245,13 +245,13 @@ class ByteCodePrinter {
n = cc.bs.numOn();
sb.append(":" + cc + ":" + n);
break;
-
+
case OPCode.BACKREFN_IC:
mem = code[bp];
bp += OPSize.MEMNUM;
sb.append(":" + mem);
break;
-
+
case OPCode.BACKREF_MULTI_IC:
case OPCode.BACKREF_MULTI:
sb.append(" ");
@@ -264,7 +264,7 @@ class ByteCodePrinter {
sb.append(mem);
}
break;
-
+
case OPCode.BACKREF_WITH_LEVEL: {
int option = code[bp];
bp += OPSize.OPTION;
@@ -283,7 +283,7 @@ class ByteCodePrinter {
}
break;
}
-
+
case OPCode.REPEAT:
case OPCode.REPEAT_NG:
mem = code[bp];
@@ -292,7 +292,7 @@ class ByteCodePrinter {
bp += OPSize.RELADDR;
sb.append(":" + mem + ":" + addr);
break;
-
+
case OPCode.PUSH_OR_JUMP_EXACT1:
case OPCode.PUSH_IF_PEEK_NEXT:
addr = code[bp];
@@ -301,14 +301,14 @@ class ByteCodePrinter {
pString(sb, 1, bp);
bp++;
break;
-
+
case OPCode.LOOK_BEHIND:
case OPCode.LOOK_BEHIND_SB:
len = code[bp];
bp += OPSize.LENGTH;
sb.append(":" + len);
break;
-
+
case OPCode.PUSH_LOOK_BEHIND_NOT:
addr = code[bp];
bp += OPSize.RELADDR;
@@ -316,7 +316,7 @@ class ByteCodePrinter {
bp += OPSize.LENGTH;
sb.append(":" + len + ":(" + addr + ")");
break;
-
+
case OPCode.STATE_CHECK_PUSH:
case OPCode.STATE_CHECK_PUSH_OR_JUMP:
scn = code[bp];
@@ -325,7 +325,7 @@ class ByteCodePrinter {
bp += OPSize.RELADDR;
sb.append(":" + scn + ":(" + addr + ")");
break;
-
+
default:
throw new InternalException("undefined code: " + code[--bp]);
}
@@ -342,14 +342,14 @@ class ByteCodePrinter {
private String compiledByteCodeListToString() {
StringBuilder sb = new StringBuilder();
sb.append("code length: " + codeLength + "\n");
-
+
int ncode = 0;
int bp = 0;
int end = codeLength;
-
+
while (bp < end) {
ncode++;
-
+
if (bp > 0) sb.append(ncode % 5 == 0 ? "\n" : " ");
bp = compiledByteCodeToString(sb, bp);
diff --git a/src/org/joni/CaptureTreeNode.java b/src/org/joni/CaptureTreeNode.java
index dd6549c..4cbd31d 100644
--- a/src/org/joni/CaptureTreeNode.java
+++ b/src/org/joni/CaptureTreeNode.java
@@ -1,27 +1,27 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
public class CaptureTreeNode {
-
+
int group;
int beg;
int end;
@@ -34,7 +34,7 @@ public class CaptureTreeNode {
end = Region.REGION_NOTPOS;
group = -1;
}
-
+
static final int HISTORY_TREE_INIT_ALLOC_SIZE = 8;
void addChild(CaptureTreeNode child) {
if (children == null) {
@@ -44,11 +44,11 @@ public class CaptureTreeNode {
System.arraycopy(children, 0, tmp, 0, children.length);
children = tmp;
}
-
+
children[numChildren] = child;
numChildren++;
}
-
+
void clear() {
for (int i=0; i<numChildren; i++) {
children[i] = null; // ???
@@ -57,7 +57,7 @@ public class CaptureTreeNode {
beg = end = Region.REGION_NOTPOS;
group = -1;
}
-
+
CaptureTreeNode cloneTree() {
CaptureTreeNode clone = new CaptureTreeNode();
clone.beg = beg;
@@ -69,6 +69,6 @@ public class CaptureTreeNode {
}
return clone;
}
-
-
+
+
}
diff --git a/src/org/joni/CodeRangeBuffer.java b/src/org/joni/CodeRangeBuffer.java
index 51b77e7..7e7e5e3 100644
--- a/src/org/joni/CodeRangeBuffer.java
+++ b/src/org/joni/CodeRangeBuffer.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -24,51 +24,51 @@ import org.joni.exception.ErrorMessages;
import org.joni.exception.ValueException;
public final class CodeRangeBuffer {
- private static final int INIT_MULTI_BYTE_RANGE_SIZE = 5;
+ private static final int INIT_MULTI_BYTE_RANGE_SIZE = 5;
private static final int ALL_MULTI_BYTE_RANGE = 0x7fffffff;
-
- int[]p;
+
+ int[]p;
int used;
-
+
public CodeRangeBuffer(int[]ranges) {
p = ranges;
used = ranges[0] + 1;
}
-
+
public CodeRangeBuffer() {
p = new int[INIT_MULTI_BYTE_RANGE_SIZE];
writeCodePoint(0, 0);
}
-
+
public int[]getCodeRange() {
return p;
}
-
+
private CodeRangeBuffer(CodeRangeBuffer orig) {
p = new int[orig.p.length];
System.arraycopy(orig.p, 0, p, 0, p.length);
used = orig.used;
}
-
+
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("CodeRange");
buf.append("\n used: " + used);
buf.append("\n code point: " + p[0]);
buf.append("\n ranges: ");
-
+
for (int i=0; i<p[0]; i++) {
buf.append("[" + rangeNumToString(p[i * 2 + 1]) + ".." + rangeNumToString(p[i * 2 + 2]) + "]");
if (i > 0 && i % 6 == 0) buf.append("\n ");
}
-
+
return buf.toString();
}
-
+
private static String rangeNumToString(int num){
return "0x" + Integer.toString(num, 16);
}
-
+
public void expand(int low) {
int length = p.length;
do { length <<= 1; } while (length < low);
@@ -76,27 +76,27 @@ public final class CodeRangeBuffer {
System.arraycopy(p, 0, tmp, 0, used);
p = tmp;
}
-
+
public void ensureSize(int size) {
int length = p.length;
while (length < size ) { length <<= 1; }
- if (p.length != length) {
+ if (p.length != length) {
int[]tmp = new int[length];
System.arraycopy(p, 0, tmp, 0, used);
- p = tmp;
+ p = tmp;
}
- }
-
+ }
+
private void moveRight(int from, int to, int n) {
if (to + n > p.length) expand(to + n);
System.arraycopy(p, from, p, to, n);
if (to + n > used) used = to + n;
}
-
+
protected void moveLeft(int from, int to, int n) {
System.arraycopy(p, from, p, to, n);
}
-
+
private void moveLeftAndReduce(int from, int to) {
System.arraycopy(p, from, p, to, used - from);
used -= from - to;
@@ -108,11 +108,11 @@ public final class CodeRangeBuffer {
p[pos] = b;
if (used < u) used = u;
}
-
+
public CodeRangeBuffer clone() {
return new CodeRangeBuffer(this);
}
-
+
// ugly part: these methods should be made OO
// add_code_range_to_buf
public static CodeRangeBuffer addCodeRangeToBuff(CodeRangeBuffer pbuf, int from, int to) {
@@ -121,15 +121,15 @@ public final class CodeRangeBuffer {
from = to;
to = n;
}
-
+
if (pbuf == null) pbuf = new CodeRangeBuffer(); // move to CClassNode
-
+
int[]p = pbuf.p;
int n = p[0];
-
+
int low = 0;
int bound = n;
-
+
while (low < bound) {
int x = (low + bound) >>> 1;
if (from > p[x * 2 + 2]) {
@@ -138,10 +138,10 @@ public final class CodeRangeBuffer {
bound = x;
}
}
-
+
int high = low;
bound = n;
-
+
while (high < bound) {
int x = (high + bound) >>> 1;
if (to >= p[x * 2 + 1] - 1) {
@@ -150,38 +150,38 @@ public final class CodeRangeBuffer {
bound = x;
}
}
-
+
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.ERR_TOO_MANY_MULTI_BYTE_RANGES);
+
if (incN != 1) {
if (from > p[low * 2 + 1]) from = p[low * 2 + 1];
if (to < p[(high - 1) * 2 + 2]) to = p[(high - 1) * 2 + 2];
}
-
+
if (incN != 0 && high < n) {
int fromPos = 1 + high * 2;
int toPos = 1 + (low + 1) * 2;
int size = (n - high) * 2;
-
+
if (incN > 0) {
pbuf.moveRight(fromPos, toPos, size);
} else {
pbuf.moveLeftAndReduce(fromPos, toPos);
}
}
-
+
int pos = 1 + low * 2;
// pbuf.ensureSize(pos + 2);
pbuf.writeCodePoint(pos, from);
pbuf.writeCodePoint(pos + 1, to);
n += incN;
pbuf.writeCodePoint(0, n);
-
+
return pbuf;
}
-
+
// add_code_range, be aware of it returning null!
public static CodeRangeBuffer addCodeRange(CodeRangeBuffer pbuf, ScanEnvironment env, int from, int to) {
if (from >to) {
@@ -198,26 +198,26 @@ public final class CodeRangeBuffer {
protected static CodeRangeBuffer setAllMultiByteRange(Encoding enc, CodeRangeBuffer pbuf) {
return addCodeRangeToBuff(pbuf, enc.mbcodeStartPosition(), ALL_MULTI_BYTE_RANGE);
}
-
+
// ADD_ALL_MULTI_BYTE_RANGE
public static CodeRangeBuffer addAllMultiByteRange(Encoding enc, CodeRangeBuffer pbuf) {
if (!enc.isSingleByte()) return setAllMultiByteRange(enc, pbuf);
return pbuf;
}
-
+
// not_code_range_buf
public static CodeRangeBuffer notCodeRangeBuff(Encoding enc, CodeRangeBuffer bbuf) {
CodeRangeBuffer pbuf = null;
if (bbuf == null) return setAllMultiByteRange(enc, pbuf);
-
+
int[]p = bbuf.p;
int n = p[0];
-
+
if (n <= 0) return setAllMultiByteRange(enc, pbuf);
-
+
int pre = enc.mbcodeStartPosition();
-
+
int from;
int to = 0;
for (int i=0; i<n; i++) {
@@ -229,16 +229,16 @@ public final class CodeRangeBuffer {
if (to == ALL_MULTI_BYTE_RANGE) break;
pre = to + 1;
}
-
+
if (to < ALL_MULTI_BYTE_RANGE) pbuf = addCodeRangeToBuff(pbuf, to + 1, ALL_MULTI_BYTE_RANGE);
return pbuf;
}
-
+
// or_code_range_buf
public static CodeRangeBuffer orCodeRangeBuff(Encoding enc, CodeRangeBuffer bbuf1, boolean not1,
CodeRangeBuffer bbuf2, boolean not2) {
CodeRangeBuffer pbuf = null;
-
+
if (bbuf1 == null && bbuf2 == null) {
if (not1 || not2) {
return setAllMultiByteRange(enc, pbuf);
@@ -251,13 +251,13 @@ public final class CodeRangeBuffer {
boolean tnot;
// swap
tnot = not1; not1 = not2; not2 = tnot;
- tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf;
+ tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf;
}
-
+
if (bbuf1 == null) {
if (not1) {
return setAllMultiByteRange(enc, pbuf);
- } else {
+ } else {
if (!not2) {
return bbuf2.clone();
} else {
@@ -265,13 +265,13 @@ public final class CodeRangeBuffer {
}
}
}
-
+
if (not1) {
CodeRangeBuffer tbuf;
boolean tnot;
// swap
tnot = not1; not1 = not2; not2 = tnot;
- tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf;
+ tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf;
}
if (!not2 && !not1) { /* 1 OR 2 */
@@ -279,19 +279,19 @@ public final class CodeRangeBuffer {
} else if (!not1) { /* 1 OR (not 2) */
pbuf = notCodeRangeBuff(enc, bbuf2);
}
-
+
int[]p1 = bbuf1.p;
int n1 = p1[0];
-
+
for (int i=0; i<n1; i++) {
int from = p1[i * 2 + 1];
int to = p1[i * 2 + 2];
pbuf = addCodeRangeToBuff(pbuf, from, to);
}
-
+
return pbuf;
}
-
+
// and_code_range1
public static CodeRangeBuffer andCodeRange1(CodeRangeBuffer pbuf, int from1, int to1, int[]data, int n) {
for (int i=0; i<n; i++) {
@@ -317,35 +317,35 @@ public final class CodeRangeBuffer {
}
if (from1 > to1) break;
}
-
+
if (from1 <= to1) {
pbuf = addCodeRangeToBuff(pbuf, from1, to1);
}
-
+
return pbuf;
}
-
+
// and_code_range_buf
public static CodeRangeBuffer andCodeRangeBuff(CodeRangeBuffer bbuf1, boolean not1,
CodeRangeBuffer bbuf2, boolean not2) {
CodeRangeBuffer pbuf = null;
-
- if (bbuf1 == null) {
+
+ if (bbuf1 == null) {
if (not1 && bbuf2 != null) return bbuf2.clone(); /* not1 != 0 -> not2 == 0 */
- return null;
+ return null;
} else if (bbuf2 == null) {
if (not2) return bbuf1.clone();
return null;
}
-
+
if (not1) {
CodeRangeBuffer tbuf;
boolean tnot;
// swap
tnot = not1; not1 = not2; not2 = tnot;
- tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf;
+ tbuf = bbuf1; bbuf1 = bbuf2; bbuf2 = tbuf;
}
-
+
int[]p1 = bbuf1.p;
int n1 = p1[0];
int[]p2 = bbuf2.p;
diff --git a/src/org/joni/Compiler.java b/src/org/joni/Compiler.java
index c9ea261..00059f1 100644
--- a/src/org/joni/Compiler.java
+++ b/src/org/joni/Compiler.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -39,26 +39,26 @@ abstract class Compiler implements ErrorMessages {
protected final Analyser analyser;
protected final Encoding enc;
protected final Regex regex;
-
+
protected Compiler(Analyser analyser) {
this.analyser = analyser;
this.regex = analyser.regex;
this.enc = regex.enc;
}
-
+
final void compile() {
prepare();
compileTree(analyser.root);
finish();
}
-
+
protected abstract void prepare();
protected abstract void finish();
-
+
protected abstract void compileAltNode(ConsAltNode node);
-
+
private void compileStringRawNode(StringNode sn) {
- if (sn.length() <= 0) return;
+ if (sn.length() <= 0) return;
addCompileString(sn.bytes, sn.p, 1 /*sb*/, sn.length(), false);
}
@@ -75,8 +75,8 @@ abstract class Compiler implements ErrorMessages {
int prevLen = enc.length(bytes, p, end);
p += prevLen;
int slen = 1;
-
- while (p < end) {
+
+ while (p < end) {
int len = enc.length(bytes, p, end);
if (len == prevLen) {
slen++;
@@ -88,11 +88,11 @@ abstract class Compiler implements ErrorMessages {
}
p += len;
}
- addCompileString(bytes, prev, prevLen, slen, ambig);
+ addCompileString(bytes, prev, prevLen, slen, ambig);
}
-
+
protected abstract void addCompileString(byte[]bytes, int p, int mbLength, int strLength, boolean ignoreCase);
-
+
protected abstract void compileCClassNode(CClassNode node);
protected abstract void compileCTypeNode(CTypeNode node);
protected abstract void compileAnyCharNode();
@@ -103,7 +103,7 @@ abstract class Compiler implements ErrorMessages {
protected abstract void compileOptionNode(EncloseNode node);
protected abstract void compileEncloseNode(EncloseNode node);
protected abstract void compileAnchorNode(AnchorNode node);
-
+
protected final void compileTree(Node node) {
switch (node.getType()) {
case NodeType.LIST:
@@ -112,11 +112,11 @@ abstract class Compiler implements ErrorMessages {
compileTree(lin.car);
} while ((lin = lin.cdr) != null);
break;
-
+
case NodeType.ALT:
compileAltNode((ConsAltNode)node);
break;
-
+
case NodeType.STR:
StringNode sn = (StringNode)node;
if (sn.isRaw()) {
@@ -125,15 +125,15 @@ abstract class Compiler implements ErrorMessages {
compileStringNode(sn);
}
break;
-
+
case NodeType.CCLASS:
compileCClassNode((CClassNode)node);
break;
-
+
case NodeType.CTYPE:
compileCTypeNode((CTypeNode)node);
break;
-
+
case NodeType.CANY:
compileAnyCharNode();
break;
@@ -141,14 +141,14 @@ abstract class Compiler implements ErrorMessages {
case NodeType.BREF:
compileBackrefNode((BackRefNode)node);
break;
-
+
case NodeType.CALL:
if (Config.USE_SUBEXP_CALL) {
compileCallNode((CallNode)node);
break;
} // USE_SUBEXP_CALL
break;
-
+
case NodeType.QTFR:
if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
compileCECQuantifierNode((QuantifierNode)node);
@@ -156,7 +156,7 @@ abstract class Compiler implements ErrorMessages {
compileNonCECQuantifierNode((QuantifierNode)node);
}
break;
-
+
case NodeType.ENCLOSE:
EncloseNode enode = (EncloseNode)node;
if (enode.isOption()) {
@@ -164,7 +164,7 @@ abstract class Compiler implements ErrorMessages {
} else {
compileEncloseNode(enode);
}
- break;
+ break;
case NodeType.ANCHOR:
compileAnchorNode((AnchorNode)node);
@@ -175,7 +175,7 @@ abstract class Compiler implements ErrorMessages {
newInternalException(ERR_PARSER_BUG);
} // switch
}
-
+
protected final void compileTreeNTimes(Node node, int n) {
for (int i=0; i<n; i++) compileTree(node);
}
diff --git a/src/org/joni/MatcherFactory.java b/src/org/joni/MatcherFactory.java
index 729eeb0..09d6083 100644
--- a/src/org/joni/MatcherFactory.java
+++ b/src/org/joni/MatcherFactory.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
diff --git a/src/org/joni/MinMaxLen.java b/src/org/joni/MinMaxLen.java
index dca90e6..072d5f3 100644
--- a/src/org/joni/MinMaxLen.java
+++ b/src/org/joni/MinMaxLen.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -25,40 +25,40 @@ final class MinMaxLen {
MinMaxLen() {
}
-
+
MinMaxLen(int min, int max) {
this.min = min;
this.max = max;
}
-
- /* 1000 / (min-max-dist + 1) */
- private static final short distValues[] = {
- 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100,
- 91, 83, 77, 71, 67, 63, 59, 56, 53, 50,
- 48, 45, 43, 42, 40, 38, 37, 36, 34, 33,
- 32, 31, 30, 29, 29, 28, 27, 26, 26, 25,
- 24, 24, 23, 23, 22, 22, 21, 21, 20, 20,
- 20, 19, 19, 19, 18, 18, 18, 17, 17, 17,
- 16, 16, 16, 16, 15, 15, 15, 15, 14, 14,
- 14, 14, 14, 14, 13, 13, 13, 13, 13, 13,
- 12, 12, 12, 12, 12, 12, 11, 11, 11, 11,
+
+ /* 1000 / (min-max-dist + 1) */
+ private static final short distValues[] = {
+ 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100,
+ 91, 83, 77, 71, 67, 63, 59, 56, 53, 50,
+ 48, 45, 43, 42, 40, 38, 37, 36, 34, 33,
+ 32, 31, 30, 29, 29, 28, 27, 26, 26, 25,
+ 24, 24, 23, 23, 22, 22, 21, 21, 20, 20,
+ 20, 19, 19, 19, 18, 18, 18, 17, 17, 17,
+ 16, 16, 16, 16, 15, 15, 15, 15, 14, 14,
+ 14, 14, 14, 14, 13, 13, 13, 13, 13, 13,
+ 12, 12, 12, 12, 12, 12, 11, 11, 11, 11,
11, 11, 11, 11, 11, 10, 10, 10, 10, 10
};
-
+
int distanceValue() {
if (max == INFINITE_DISTANCE) return 0;
int d = max - min;
/* return dist_vals[d] * 16 / (mm->min + 12); */
- return d < distValues.length ? distValues[d] : 1;
+ return d < distValues.length ? distValues[d] : 1;
}
-
+
int compareDistanceValue(MinMaxLen other, int v1, int v2) {
if (v2 <= 0) return -1;
if (v1 <= 0) return 1;
-
+
v1 *= distanceValue();
v2 *= other.distanceValue();
-
+
if (v2 > v1) return 1;
if (v2 < v1) return -1;
@@ -68,38 +68,38 @@ final class MinMaxLen {
}
boolean equal(MinMaxLen other) {
- return min == other.min && max == other.max;
+ return min == other.min && max == other.max;
}
void set(int min, int max) {
this.min = min;
this.max = max;
}
-
+
void clear() {
min = max = 0;
}
-
- void copy(MinMaxLen other) {
+
+ void copy(MinMaxLen other) {
min = other.min;
max = other.max;
}
-
+
void add(MinMaxLen other) {
min = distanceAdd(min, other.min);
max = distanceAdd(max, other.max);
}
-
+
void addLength(int len) {
min = distanceAdd(min, len);
- max = distanceAdd(max, len);
+ max = distanceAdd(max, len);
}
void altMerge(MinMaxLen other) {
if (min > other.min) min = other.min;
- if (max < other.max) max = other.max;
+ if (max < other.max) max = other.max;
}
-
+
static final int INFINITE_DISTANCE = 0x7FFFFFFF;
static int distanceAdd(int d1, int d2) {
if (d1 == INFINITE_DISTANCE || d2 == INFINITE_DISTANCE) {
@@ -118,7 +118,7 @@ final class MinMaxLen {
return INFINITE_DISTANCE;
}
}
-
+
static String distanceRangeToString(int a, int b) {
String s = "";
if (a == INFINITE_DISTANCE) {
@@ -128,12 +128,12 @@ final class MinMaxLen {
}
s += "-";
-
+
if (b == INFINITE_DISTANCE) {
s += "inf";
} else {
s += "(" + b + ")";
}
- return s;
+ return s;
}
}
diff --git a/src/org/joni/NameEntry.java b/src/org/joni/NameEntry.java
index 794cf1b..55c34b3 100644
--- a/src/org/joni/NameEntry.java
+++ b/src/org/joni/NameEntry.java
@@ -1,35 +1,35 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
public final class NameEntry {
static final int INIT_NAME_BACKREFS_ALLOC_NUM = 8;
-
+
public final byte[]name;
public final int nameP;
public final int nameEnd;
-
+
int backNum;
int backRef1;
int backRefs[];
-
+
public NameEntry(byte[]bytes, int p, int end) {
name = bytes;
nameP = p;
@@ -52,18 +52,18 @@ public final class NameEntry {
private void alloc() {
backRefs = new int[INIT_NAME_BACKREFS_ALLOC_NUM];
}
-
+
private void ensureSize() {
if (backNum > backRefs.length) {
- int[]tmp = new int[backRefs.length << 1];
+ int[]tmp = new int[backRefs.length << 1];
System.arraycopy(backRefs, 0, tmp, 0, backRefs.length);
backRefs = tmp;
}
}
-
+
public void addBackref(int backRef) {
backNum++;
-
+
switch (backNum) {
case 1:
backRef1 = backRef;
@@ -78,7 +78,7 @@ public final class NameEntry {
backRefs[backNum - 1] = backRef;
}
}
-
+
public String toString() {
StringBuilder buff = new StringBuilder(new String(name, nameP, nameEnd - nameP) + " ");
if (backNum == 0) {
@@ -91,7 +91,7 @@ public final class NameEntry {
buff.append(backRefs[i]);
}
}
- return buff.toString();
+ return buff.toString();
}
}
diff --git a/src/org/joni/NativeMachine.java b/src/org/joni/NativeMachine.java
index 6fc5dbb..3c37ad3 100644
--- a/src/org/joni/NativeMachine.java
+++ b/src/org/joni/NativeMachine.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
diff --git a/src/org/joni/NodeOptInfo.java b/src/org/joni/NodeOptInfo.java
index 20bc0bc..1943666 100644
--- a/src/org/joni/NodeOptInfo.java
+++ b/src/org/joni/NodeOptInfo.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -28,13 +28,13 @@ public final class NodeOptInfo {
final OptExactInfo exm = new OptExactInfo(); /* middle */
final OptExactInfo expr = new OptExactInfo(); /* prec read (?=...) */
final OptMapInfo map = new OptMapInfo(); /* boundary */
-
+
public void setBoundNode(MinMaxLen mmd) {
exb.mmd.copy(mmd);
expr.mmd.copy(mmd);
map.mmd.copy(mmd);
- }
-
+ }
+
public void clear() {
length.clear();
anchor.clear();
@@ -43,7 +43,7 @@ public final class NodeOptInfo {
expr.clear();
map.clear();
}
-
+
public void copy(NodeOptInfo other) {
length.copy(other.length);
anchor.copy(other.anchor);
@@ -52,40 +52,40 @@ public final class NodeOptInfo {
expr.copy(other.expr);
map.copy(other.map);
}
-
+
public void concatLeftNode(NodeOptInfo other, Encoding enc) {
OptAnchorInfo tanchor = new OptAnchorInfo(); // remove it somehow ?
tanchor.concat(anchor, other.anchor, length.max, other.length.max);
anchor.copy(tanchor);
-
+
if (other.exb.length > 0 && length.max == 0) {
tanchor.concat(anchor, other.exb.anchor, length.max, other.length.max);
other.exb.anchor.copy(tanchor);
}
-
+
if (other.map.value > 0 && length.max == 0) {
if (other.map.mmd.max == 0) {
other.map.anchor.leftAnchor |= anchor.leftAnchor;
}
}
-
+
boolean exbReach = exb.reachEnd;
boolean exmReach = exm.reachEnd;
-
+
if (other.length.max != 0) {
exb.reachEnd = exm.reachEnd = false;
}
-
+
if (other.exb.length > 0) {
if (exbReach) {
exb.concat(other.exb, enc);
other.exb.clear();
- } else if (exmReach) {
- exm.concat(other.exb, enc);
- other.exb.clear();
+ } else if (exmReach) {
+ exm.concat(other.exb, enc);
+ other.exb.clear();
}
}
-
+
exm.select(other.exb, enc);
exm.select(other.exm, enc);
@@ -108,7 +108,7 @@ public final class NodeOptInfo {
map.select(other.map);
length.add(other.length);
}
-
+
public void altMerge(NodeOptInfo other, OptEnvironment env) {
anchor.altMerge(other.anchor);
exb.altMerge(other.exb, env);
@@ -123,5 +123,5 @@ public final class NodeOptInfo {
expr.mmd.copy(mmd);
map.mmd.copy(mmd);
}
-
+
}
diff --git a/src/org/joni/OptAnchorInfo.java b/src/org/joni/OptAnchorInfo.java
index 9084728..202ba81 100644
--- a/src/org/joni/OptAnchorInfo.java
+++ b/src/org/joni/OptAnchorInfo.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -24,16 +24,16 @@ import org.joni.constants.AnchorType;
final class OptAnchorInfo implements AnchorType {
int leftAnchor;
int rightAnchor;
-
+
void clear() {
leftAnchor = rightAnchor = 0;
}
-
+
void copy(OptAnchorInfo other) {
leftAnchor = other.leftAnchor;
rightAnchor = other.rightAnchor;
}
-
+
void concat(OptAnchorInfo left, OptAnchorInfo right, int leftLength, int rightLength) {
leftAnchor = left.leftAnchor;
if (leftLength == 0) leftAnchor |= right.leftAnchor;
@@ -41,12 +41,12 @@ final class OptAnchorInfo implements AnchorType {
rightAnchor = right.rightAnchor;
if (rightLength == 0) rightAnchor |= left.rightAnchor;
}
-
+
boolean isSet(int anchor) {
if ((leftAnchor & anchor) != 0) return true;
- return (rightAnchor & anchor) != 0;
+ return (rightAnchor & anchor) != 0;
}
-
+
void add(int anchor) {
if (isLeftAnchor(anchor)) {
leftAnchor |= anchor;
@@ -54,7 +54,7 @@ final class OptAnchorInfo implements AnchorType {
rightAnchor |= anchor;
}
}
-
+
void remove(int anchor) {
if (isLeftAnchor(anchor)) {
leftAnchor &= ~anchor;
@@ -62,18 +62,18 @@ final class OptAnchorInfo implements AnchorType {
rightAnchor &= ~anchor;
}
}
-
+
void altMerge(OptAnchorInfo other) {
leftAnchor &= other.leftAnchor;
rightAnchor &= other.rightAnchor;
}
-
+
static boolean isLeftAnchor(int anchor) { // make a mask for it ?
return !(anchor == END_BUF || anchor == SEMI_END_BUF ||
anchor == END_LINE || anchor == PREC_READ ||
anchor == PREC_READ_NOT);
}
-
+
static String anchorToString(int anchor) {
StringBuffer s = new StringBuffer("[");
diff --git a/src/org/joni/OptEnvironment.java b/src/org/joni/OptEnvironment.java
index 4b59c31..bc62750 100644
--- a/src/org/joni/OptEnvironment.java
+++ b/src/org/joni/OptEnvironment.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -28,7 +28,7 @@ final class OptEnvironment {
int options;
int caseFoldFlag;
ScanEnvironment scanEnv;
-
+
void copy(OptEnvironment other) {
mmd.copy(other.mmd);
enc = other.enc;
diff --git a/src/org/joni/OptExactInfo.java b/src/org/joni/OptExactInfo.java
index 45d94fc..1ccc610 100644
--- a/src/org/joni/OptExactInfo.java
+++ b/src/org/joni/OptExactInfo.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -23,49 +23,49 @@ import org.jcodings.Encoding;
final class OptExactInfo {
static final int OPT_EXACT_MAXLEN = 24;
-
+
final MinMaxLen mmd = new MinMaxLen();
final OptAnchorInfo anchor = new OptAnchorInfo();
-
+
boolean reachEnd;
boolean ignoreCase;
int length;
final byte s[] = new byte[OPT_EXACT_MAXLEN];
-
+
boolean isFull() {
- return length >= OPT_EXACT_MAXLEN;
+ return length >= OPT_EXACT_MAXLEN;
}
-
+
void clear() {
mmd.clear();
anchor.clear();
-
+
reachEnd = false;
ignoreCase = false;
length = 0;
s[0] = 0; // ???
}
-
+
void copy(OptExactInfo other) {
mmd.copy(other.mmd);
anchor.copy(other.anchor);
reachEnd = other.reachEnd;
ignoreCase = other.ignoreCase;
length = other.length;
-
+
System.arraycopy(other.s, 0, s, 0, OPT_EXACT_MAXLEN);
}
-
+
void concat(OptExactInfo other, Encoding enc) {
if (!ignoreCase && other.ignoreCase) {
if (length >= other.length) return; /* avoid */
- ignoreCase = true;
+ ignoreCase = true;
}
-
+
int p = 0; // add->s;
int end = p + other.length;
-
+
int i;
for (i=length; p < end;) {
int len = enc.length(other.s, p, end);
@@ -83,7 +83,7 @@ final class OptExactInfo {
if (!other.reachEnd) tmp.rightAnchor = 0;
anchor.copy(tmp);
}
-
+
// ?? raw is not used here
void concatStr(byte[]bytes, int p, int end, boolean raw, Encoding enc) {
int i;
@@ -94,7 +94,7 @@ final class OptExactInfo {
s[i++] = bytes[p++];
}
}
-
+
length = i;
}
@@ -103,12 +103,12 @@ final class OptExactInfo {
clear();
return;
}
-
+
if (!mmd.equal(other.mmd)) {
clear();
return;
}
-
+
int i;
for (i=0; i<length && i<other.length;) {
if (s[i] != other.s[i]) break;
@@ -118,26 +118,26 @@ final class OptExactInfo {
for (j=1; j<len; j++) {
if (s[i+j] != other.s[i+j]) break;
}
-
+
if (j < len) break;
i += len;
}
-
+
if (!other.reachEnd || i<other.length || i<length) reachEnd = false;
-
+
length = i;
ignoreCase |= other.ignoreCase;
-
+
anchor.altMerge(other.anchor);
-
+
if (!reachEnd) anchor.rightAnchor = 0;
}
-
-
+
+
void select(OptExactInfo alt, Encoding enc) {
int v1 = length;
int v2 = alt.length;
-
+
if (v2 == 0) {
return;
} else if (v1 == 0) {
@@ -147,25 +147,25 @@ final class OptExactInfo {
/* ByteValTable[x] is big value --> low price */
v2 = OptMapInfo.positionValue(enc, s[0] & 0xff);
v1 = OptMapInfo.positionValue(enc, alt.s[0] & 0xff);
-
+
if (length > 1) v1 += 5;
if (alt.length > 1) v2 += 5;
}
-
+
if (!ignoreCase) v1 *= 2;
if (!alt.ignoreCase) v2 *= 2;
-
+
if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt);
}
-
+
// comp_opt_exact_or_map_info
private static final int COMP_EM_BASE = 20;
int compare(OptMapInfo m) {
if (m.value <= 0) return -1;
-
+
int ve = COMP_EM_BASE * length * (ignoreCase ? 1 : 2);
int vm = COMP_EM_BASE * 5 * 2 / m.value;
-
+
return mmd.compareDistanceValue(m.mmd, ve, vm);
}
}
diff --git a/src/org/joni/OptMapInfo.java b/src/org/joni/OptMapInfo.java
index 2763b53..9d3574b 100644
--- a/src/org/joni/OptMapInfo.java
+++ b/src/org/joni/OptMapInfo.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -23,20 +23,20 @@ import org.jcodings.CaseFoldCodeItem;
import org.jcodings.Encoding;
final class OptMapInfo {
-
+
final MinMaxLen mmd = new MinMaxLen(); /* info position */
final OptAnchorInfo anchor = new OptAnchorInfo();
-
+
int value; /* weighted value */
final byte map[] = new byte[Config.CHAR_TABLE_SIZE];
-
+
void clear() {
mmd.clear();
anchor.clear();
value = 0;
for (int i=0; i<map.length; i++) map[i] = 0;
}
-
+
void copy(OptMapInfo other) {
mmd.copy(other.mmd);
anchor.copy(other.anchor);
@@ -44,7 +44,7 @@ final class OptMapInfo {
//for(int i=0; i<map.length; i++) map[i] = other.map[i];
System.arraycopy(other.map, 0, map, 0, other.map.length);
}
-
+
void addChar(byte c, Encoding enc) {
int c_ = c & 0xff;
if (map[c_] == 0) {
@@ -52,10 +52,10 @@ final class OptMapInfo {
value += positionValue(enc, c_);
}
}
-
+
void addCharAmb(byte[]bytes, int p, int end, Encoding enc, int caseFoldFlag) {
addChar(bytes[p], enc);
-
+
caseFoldFlag &= ~Config.INTERNAL_ENC_CASE_FOLD_MULTI_CHAR;
CaseFoldCodeItem[]items = enc.caseFoldCodesByString(caseFoldFlag, bytes, p, end);
@@ -74,13 +74,13 @@ final class OptMapInfo {
copy(alt);
return;
}
-
+
int v1 = z / value;
int v2 = z /alt.value;
-
+
if (mmd.compareDistanceValue(alt.mmd, v1, v2) > 0) copy(alt);
}
-
+
// alt_merge_opt_map_info
void altMerge(OptMapInfo other, Encoding enc) {
/* if (! is_equal_mml(&to->mmd, &add->mmd)) return ; */
@@ -89,19 +89,19 @@ final class OptMapInfo {
clear();
return;
}
-
+
mmd.altMerge(other.mmd);
-
+
int val = 0;
for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) {
if (other.map[i] != 0) map[i] = 1;
if (map[i] != 0) val += positionValue(enc, i);
}
-
+
value = val;
anchor.altMerge(other.anchor);
}
-
+
static final short ByteValTable[] = {
5, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 10, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -112,9 +112,9 @@ final class OptMapInfo {
5, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 1
};
-
+
// map_position_value
- static int positionValue(Encoding enc, int i) {
+ static int positionValue(Encoding enc, int i) {
if (i < ByteValTable.length) {
if (i == 0 && enc.minLength() > 1) {
return 20;
@@ -125,5 +125,5 @@ final class OptMapInfo {
return 4; /* Take it easy. */
}
}
-
+
}
diff --git a/src/org/joni/Option.java b/src/org/joni/Option.java
index adee24f..13fbba3 100644
--- a/src/org/joni/Option.java
+++ b/src/org/joni/Option.java
@@ -1,42 +1,42 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
public class Option {
-
+
/* options */
public static final int NONE = 0;
- public static final int IGNORECASE = (1<<0);
+ public static final int IGNORECASE = (1<<0);
public static final int EXTEND = (1<<1);
public static final int MULTILINE = (1<<2);
- public static final int SINGLELINE = (1<<3);
- public static final int FIND_LONGEST = (1<<4);
+ public static final int SINGLELINE = (1<<3);
+ public static final int FIND_LONGEST = (1<<4);
public static final int FIND_NOT_EMPTY = (1<<5);
public static final int NEGATE_SINGLELINE = (1<<6);
public static final int DONT_CAPTURE_GROUP = (1<<7);
public static final int CAPTURE_GROUP = (1<<8);
-
+
/* options (search time) */
public static final int NOTBOL = (1<<9);
public static final int NOTEOL = (1<<10);
- public static final int POSIX_REGION = (1<<11);
+ public static final int POSIX_REGION = (1<<11);
public static final int MAXBIT = (1<<12); /* limit */
public static final int DEFAULT = NONE;
@@ -52,67 +52,67 @@ public class Option {
if (isNegateSingleline(option)) options += "NEGATE_SINGLELINE ";
if (isDontCaptureGroup(option)) options += "DONT_CAPTURE_GROUP ";
if (isCaptureGroup(option)) options += "CAPTURE_GROUP ";
-
+
if (isNotBol(option)) options += "NOTBOL ";
if (isNotEol(option)) options += "NOTEOL ";
- if (isPosixRegion(option)) options += "POSIX_REGION ";
-
+ if (isPosixRegion(option)) options += "POSIX_REGION ";
+
return options;
- }
-
+ }
+
public static boolean isIgnoreCase(int option) {
return (option & IGNORECASE) != 0;
}
-
+
public static boolean isExtend(int option) {
return (option & EXTEND) != 0;
- }
+ }
public static boolean isSingleline(int option) {
return (option & SINGLELINE) != 0;
- }
+ }
public static boolean isMultiline(int option) {
return (option & MULTILINE) != 0;
- }
+ }
public static boolean isFindLongest(int option) {
return (option & FIND_LONGEST) != 0;
- }
+ }
public static boolean isFindNotEmpty(int option) {
return (option & FIND_NOT_EMPTY) != 0;
- }
+ }
public static boolean isFindCondition(int option) {
return (option & (FIND_LONGEST | FIND_NOT_EMPTY)) != 0;
- }
-
+ }
+
public static boolean isNegateSingleline(int option) {
return (option & NEGATE_SINGLELINE) != 0;
}
-
+
public static boolean isDontCaptureGroup(int option) {
return (option & DONT_CAPTURE_GROUP) != 0;
- }
-
+ }
+
public static boolean isCaptureGroup(int option) {
return (option & CAPTURE_GROUP) != 0;
- }
-
+ }
+
public static boolean isNotBol(int option) {
return (option & NOTBOL) != 0;
- }
+ }
public static boolean isNotEol(int option) {
return (option & NOTEOL) != 0;
}
-
+
public static boolean isPosixRegion(int option) {
return (option & POSIX_REGION) != 0;
- }
-
- /* OP_SET_OPTION is required for these options. ??? */
+ }
+
+ /* OP_SET_OPTION is required for these options. ??? */
// public static boolean isDynamic(int option) {
// return (option & (MULTILINE | IGNORECASE)) != 0;
// }
diff --git a/src/org/joni/Region.java b/src/org/joni/Region.java
index 08b90f9..cb54315 100644
--- a/src/org/joni/Region.java
+++ b/src/org/joni/Region.java
@@ -1,44 +1,44 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
public final class Region {
static final int REGION_NOTPOS = -1;
-
+
public final int numRegs;
public final int[]beg;
public final int[]end;
public CaptureTreeNode historyRoot;
-
+
public Region(int num) {
this.numRegs = num;
this.beg = new int[num];
this.end = new int[num];
}
-
+
public Region(int begin, int end) {
this.numRegs = 1;
this.beg = new int[]{begin};
this.end = new int[]{end};
}
-
+
public Region clone() {
Region region = new Region(numRegs);
System.arraycopy(beg, 0, region.beg, 0, beg.length);
@@ -46,18 +46,18 @@ public final class Region {
if (historyRoot != null) region.historyRoot = historyRoot.cloneTree();
return region;
}
-
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Region: \n");
for (int i=0; i<beg.length; i++) sb.append(" " + i + ": (" + beg[i] + "-" + end[i] + ")");
return sb.toString();
}
-
+
CaptureTreeNode getCaptureTree() {
return historyRoot;
}
-
+
void clear() {
for (int i=0; i<beg.length; i++) {
beg[i] = end[i] = REGION_NOTPOS;
diff --git a/src/org/joni/ScanEnvironment.java b/src/org/joni/ScanEnvironment.java
index 95dd90a..02a1ad7 100644
--- a/src/org/joni/ScanEnvironment.java
+++ b/src/org/joni/ScanEnvironment.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -27,9 +27,9 @@ import org.joni.exception.ErrorMessages;
import org.joni.exception.InternalException;
public final class ScanEnvironment {
-
+
private static final int SCANENV_MEMNODES_SIZE = 8;
-
+
int option;
final int caseFoldFlag;
final public Encoding enc;
@@ -38,23 +38,23 @@ public final class ScanEnvironment {
int btMemStart;
int btMemEnd;
int backrefedMem;
-
+
final public Regex reg;
-
+
int numCall;
UnsetAddrList unsetAddrList; // USE_SUBEXP_CALL
public int numMem;
int numNamed; // USE_NAMED_GROUP
-
+
public Node memNodes[];
-
+
// USE_COMBINATION_EXPLOSION_CHECK
int numCombExpCheck;
int combExpMaxRegNum;
int currMaxRegNum;
boolean hasRecursion;
-
+
public ScanEnvironment(Regex regex, Syntax syntax) {
this.reg = regex;
option = regex.options;
@@ -81,7 +81,7 @@ public final class ScanEnvironment {
currMaxRegNum = 0;
hasRecursion = false;
}
-
+
public int addMemEntry() {
if (numMem++ == 0) {
memNodes = new Node[SCANENV_MEMNODES_SIZE];
@@ -93,7 +93,7 @@ public final class ScanEnvironment {
return numMem;
}
-
+
public void setMemNode(int num, Node node) {
if (numMem >= num) {
memNodes[num] = node;
@@ -101,7 +101,7 @@ public final class ScanEnvironment {
throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
}
}
-
+
public int convertBackslashValue(int c) {
if (syntax.opEscControlChars()) {
switch (c) {
@@ -121,7 +121,7 @@ public final class ScanEnvironment {
}
return c;
}
-
+
void ccEscWarn(String s) {
if (Config.USE_WARN) {
if (syntax.warnCCOpNotEscaped() && syntax.backSlashEscapeInCC()) {
@@ -129,7 +129,7 @@ public final class ScanEnvironment {
}
}
}
-
+
void closeBracketWithoutEscapeWarn(String s) {
if (Config.USE_WARN) {
if (syntax.warnCCOpNotEscaped()) {
diff --git a/src/org/joni/ScannerSupport.java b/src/org/joni/ScannerSupport.java
index 370d338..a2ced01 100644
--- a/src/org/joni/ScannerSupport.java
+++ b/src/org/joni/ScannerSupport.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -28,7 +28,7 @@ import org.joni.exception.ValueException;
abstract class ScannerSupport extends IntHolder implements ErrorMessages {
protected final Encoding enc; // fast access to encoding
-
+
protected final byte[]bytes; // pattern
protected int p; // current scanner position
protected int stop; // pattern end (mutable)
@@ -38,27 +38,27 @@ abstract class ScannerSupport extends IntHolder implements ErrorMessages {
private final int begin; // pattern begin position for reset() support
private final int end; // pattern end position for reset() support
protected int _p; // used by mark()/restore() to mark positions
-
+
protected ScannerSupport(Encoding enc, byte[]bytes, int p, int end) {
this.enc = enc;
-
+
this.bytes = bytes;
this.begin = p;
this.end = end;
-
+
reset();
}
-
+
protected int getBegin() {
return begin;
}
-
+
protected int getEnd() {
return end;
}
-
+
private final int INT_SIGN_BIT = 1 << 31;
-
+
protected final int scanUnsignedNumber() {
int num = 0; // long ???
while(left()) {
@@ -68,13 +68,13 @@ abstract class ScannerSupport extends IntHolder implements ErrorMessages {
num = num * 10 + Encoding.digitVal(c);
if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1;
} else {
- unfetch();
+ unfetch();
break;
}
- }
- return num;
+ }
+ return num;
}
-
+
protected final int scanUnsignedHexadecimalNumber(int maxLength) {
int num = 0;
while(left() && maxLength-- != 0) {
@@ -91,13 +91,13 @@ abstract class ScannerSupport extends IntHolder implements ErrorMessages {
}
return num;
}
-
+
protected final int scanUnsignedOctalNumber(int maxLength) {
int num = 0;
while(left() && maxLength-- != 0) {
fetch();
- if (enc.isDigit(c) && c < '8') {
- int onum = num;
+ if (enc.isDigit(c) && c < '8') {
+ int onum = num;
int val = Encoding.odigitVal(c);
num = (num << 3) + val;
if (((onum ^ num) & INT_SIGN_BIT) != 0) return -1;
@@ -106,56 +106,56 @@ abstract class ScannerSupport extends IntHolder implements ErrorMessages {
break;
}
}
- return num;
+ return num;
}
-
+
protected final void reset() {
p = begin;
stop = end;
}
-
+
protected final void mark() {
_p = p;
}
-
+
protected final void restore() {
p = _p;
}
-
+
protected final void inc() {
lastFetched = p;
p += enc.length(bytes, p, stop);
}
-
+
protected final void fetch() {
c = enc.mbcToCode(bytes, p, stop);
lastFetched = p;
p += enc.length(bytes, p, stop);
}
-
+
protected int fetchTo() {
int to = enc.mbcToCode(bytes, p, stop);
lastFetched = p;
p += enc.length(bytes, p, stop);
return to;
}
-
+
protected final void unfetch() {
p = lastFetched;
}
-
+
protected final int peek() {
- return p < stop ? enc.mbcToCode(bytes, p, stop) : 0;
+ return p < stop ? enc.mbcToCode(bytes, p, stop) : 0;
}
-
+
protected final boolean peekIs(int c) {
return peek() == c;
}
-
+
protected final boolean left() {
return p < stop;
}
-
+
protected void newSyntaxException(String message) {
throw new SyntaxException(message);
}
@@ -163,7 +163,7 @@ abstract class ScannerSupport extends IntHolder implements ErrorMessages {
protected void newValueException(String message) {
throw new ValueException(message);
}
-
+
protected void newValueException(String message, String str) {
throw new ValueException(message, str);
}
@@ -175,5 +175,5 @@ abstract class ScannerSupport extends IntHolder implements ErrorMessages {
protected void newInternalException(String message) {
throw new InternalException(message);
}
-
+
}
diff --git a/src/org/joni/SearchAlgorithm.java b/src/org/joni/SearchAlgorithm.java
index cdc5ff7..6d63c2f 100644
--- a/src/org/joni/SearchAlgorithm.java
+++ b/src/org/joni/SearchAlgorithm.java
@@ -1,3 +1,22 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
package org.joni;
import org.jcodings.Encoding;
diff --git a/src/org/joni/StackEntry.java b/src/org/joni/StackEntry.java
index 001c98d..81b1785 100644
--- a/src/org/joni/StackEntry.java
+++ b/src/org/joni/StackEntry.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -22,7 +22,7 @@ package org.joni;
final class StackEntry {
int type;
private int E1, E2, E3, E4;
-
+
// first union member
/* byte code position */
void setStatePCode(int pcode) {
@@ -52,7 +52,7 @@ final class StackEntry {
int getStateCheck() {
return E4;
}
-
+
// second union member
/* for OP_REPEAT_INC, OP_REPEAT_INC_NG */
void setRepeatCount(int count) {
@@ -63,7 +63,7 @@ final class StackEntry {
}
void decreaseRepeatCount() {
E1--;
- }
+ }
void increaseRepeatCount() {
E1++;
}
@@ -81,7 +81,7 @@ final class StackEntry {
int getRepeatNum() {
return E3;
}
-
+
// third union member
/* index of stack */ /*int repeat_inc struct*/
void setSi(int si) {
@@ -90,7 +90,7 @@ final class StackEntry {
int getSi() {
return E1;
}
-
+
// fourth union member
/* memory num */
void setMemNum(int num) {
@@ -106,7 +106,7 @@ final class StackEntry {
int getMemPStr() {
return E2;
}
-
+
/* Following information is set, if this stack type is MEM-START */
/* prev. info (for backtrack "(...)*" ) */
void setMemStart(int start) {
@@ -122,7 +122,7 @@ final class StackEntry {
int getMemEnd() {
return E4;
}
-
+
// fifth union member
/* null check id */
void setNullCheckNum(int num) {
@@ -137,8 +137,8 @@ final class StackEntry {
}
int getNullCheckPStr() {
return E2;
- }
-
+ }
+
// sixth union member
/* byte code position */
void setCallFrameRetAddr(int addr) {
@@ -158,7 +158,7 @@ final class StackEntry {
void setCallFramePStr(int pstr) {
E3 = pstr;
}
- int getCallFramePStr() {
- return E3;
+ int getCallFramePStr() {
+ return E3;
}
}
diff --git a/src/org/joni/StackMachine.java b/src/org/joni/StackMachine.java
index 7fe60a7..a5e51a4 100644
--- a/src/org/joni/StackMachine.java
+++ b/src/org/joni/StackMachine.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -29,7 +29,7 @@ import org.joni.constants.StackType;
abstract class StackMachine extends Matcher implements StackType {
protected static final int INVALID_INDEX = -1;
-
+
protected StackEntry[]stack;
protected int stk; // stkEnd
@@ -38,7 +38,7 @@ abstract class StackMachine extends Matcher implements StackType {
// CEC
protected byte[] stateCheckBuff; // move to int[] ?
- int stateCheckBuffSize;
+ int stateCheckBuffSize;
protected StackMachine(Regex regex, byte[]bytes, int p , int end) {
super(regex, bytes, p, end);
@@ -46,7 +46,7 @@ abstract class StackMachine extends Matcher implements StackType {
this.stack = regex.stackNeeded ? fetchStack() : null;
int n = regex.numRepeat + (regex.numMem << 1);
this.repeatStk = n > 0 ? new int[n] : null;
-
+
memStartStk = regex.numRepeat - 1;
memEndStk = memStartStk + regex.numMem;
/* for index start from 1, mem_start_stk[1]..mem_start_stk[num_mem] */
@@ -58,13 +58,13 @@ abstract class StackMachine extends Matcher implements StackType {
stack[0] = new StackEntry();
return stack;
}
-
+
private void doubleStack() {
StackEntry[] newStack = new StackEntry[stack.length << 1];
System.arraycopy(stack, 0, newStack, 0, stack.length);
stack = newStack;
- }
-
+ }
+
static final ThreadLocal<WeakReference<StackEntry[]>> stacks
= new ThreadLocal<WeakReference<StackEntry[]>>() {
@Override
@@ -86,7 +86,7 @@ abstract class StackMachine extends Matcher implements StackType {
protected final void init() {
if (stack != null) pushEnsured(ALT, regex.codeLength - 1); /* bottom stack */
if (repeatStk != null) {
- for (int i=1; i<=regex.numMem; i++) {
+ for (int i=1; i<=regex.numMem; i++) {
repeatStk[i + memStartStk] = repeatStk[i + memEndStk] = INVALID_INDEX;
}
}
@@ -98,7 +98,7 @@ abstract class StackMachine extends Matcher implements StackType {
if (e == null) stack[stk] = e = new StackEntry();
return e;
}
-
+
protected final void pushType(int type) {
ensure1().type = type;
stk++;
@@ -124,7 +124,7 @@ abstract class StackMachine extends Matcher implements StackType {
private void stateCheckMark() {
StackEntry e = stack[stk];
int x = stateCheckPos(e.getStatePStr(), e.getStateCheck());
- stateCheckBuff[x / 8] |= (1 << (x % 8));
+ stateCheckBuff[x / 8] |= (1 << (x % 8));
}
// STATE_CHECK_BUFF_INIT
@@ -133,16 +133,16 @@ abstract class StackMachine extends Matcher implements StackType {
if (stateNum > 0 && strLength >= Config.CHECK_STRING_THRESHOLD_LEN) {
int size = ((strLength + 1) * stateNum + 7) >>> 3;
offset = (offset * stateNum) >>> 3;
-
+
if (size > 0 && offset < size && size < Config.CHECK_BUFF_MAX_SIZE) {
if (size >= STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE) {
- stateCheckBuff = new byte[size];
+ stateCheckBuff = new byte[size];
} else {
// same impl, reduce...
stateCheckBuff = new byte[size];
}
Arrays.fill(stateCheckBuff, offset, (size - offset), (byte)0);
- stateCheckBuffSize = size;
+ stateCheckBuffSize = size;
} else {
stateCheckBuff = null; // reduce
stateCheckBuffSize = 0;
@@ -175,17 +175,17 @@ abstract class StackMachine extends Matcher implements StackType {
if (Config.USE_COMBINATION_EXPLOSION_CHECK) e.setStateCheck(0);
stk++;
}
-
+
protected final void pushAltWithStateCheck(int pat, int s, int sprev, int snum) {
StackEntry e = ensure1();
e.type = ALT;
e.setStatePCode(pat);
e.setStatePStr(s);
- e.setStatePStrPrev(sprev);
- if (Config.USE_COMBINATION_EXPLOSION_CHECK) e.setStateCheck(stateCheckBuff != null ? snum : 0);
+ e.setStatePStrPrev(sprev);
+ if (Config.USE_COMBINATION_EXPLOSION_CHECK) e.setStateCheck(stateCheckBuff != null ? snum : 0);
stk++;
}
-
+
protected final void pushStateCheck(int s, int snum) {
if (stateCheckBuff != null) {
StackEntry e = ensure1();
@@ -193,30 +193,30 @@ abstract class StackMachine extends Matcher implements StackType {
e.setStatePStr(s);
e.setStateCheck(snum);
stk++;
- }
+ }
}
protected final void pushAlt(int pat, int s, int prev) {
push(ALT, pat, s, prev);
}
-
+
protected final void pushPos(int s, int prev) {
push(POS, -1 /*NULL_UCHARP*/, s, prev);
}
-
+
protected final void pushPosNot(int pat, int s, int prev) {
push(POS_NOT, pat, s, prev);
}
-
- protected final void pushStopBT() {
+
+ protected final void pushStopBT() {
pushType(STOP_BT);
}
-
+
protected final void pushLookBehindNot(int pat, int s, int sprev) {
push(LOOK_BEHIND_NOT, pat, s, sprev);
}
-
- protected final void pushRepeat(int id, int pat) {
+
+ protected final void pushRepeat(int id, int pat) {
StackEntry e = ensure1();
e.type = REPEAT;
e.setRepeatNum(id);
@@ -224,14 +224,14 @@ abstract class StackMachine extends Matcher implements StackType {
e.setRepeatCount(0);
stk++;
}
-
+
protected final void pushRepeatInc(int sindex) {
StackEntry e = ensure1();
e.type = REPEAT_INC;
e.setSi(sindex);
stk++;
}
-
+
protected final void pushMemStart(int mnum, int s) {
StackEntry e = ensure1();
e.type = MEM_START;
@@ -239,7 +239,7 @@ abstract class StackMachine extends Matcher implements StackType {
e.setMemPstr(s);
e.setMemStart(repeatStk[memStartStk + mnum]);
e.setMemEnd(repeatStk[memEndStk + mnum]);
- repeatStk[memStartStk + mnum] = stk;
+ repeatStk[memStartStk + mnum] = stk;
repeatStk[memEndStk + mnum] = INVALID_INDEX;
stk++;
}
@@ -247,25 +247,25 @@ abstract class StackMachine extends Matcher implements StackType {
protected final void pushMemEnd(int mnum, int s) {
StackEntry e = ensure1();
e.type = MEM_END;
- e.setMemNum(mnum);
+ e.setMemNum(mnum);
e.setMemPstr(s);
e.setMemStart(repeatStk[memStartStk + mnum]);
e.setMemEnd(repeatStk[memEndStk + mnum]);
repeatStk[memEndStk + mnum] = stk;
stk++;
- }
-
+ }
+
protected final void pushMemEndMark(int mnum) {
StackEntry e = ensure1();
e.type = MEM_END_MARK;
e.setMemNum(mnum);
stk++;
}
-
+
protected final int getMemStart(int mnum) {
int level = 0;
int stkp = stk;
-
+
while (stkp > 0) {
stkp--;
StackEntry e = stack[stkp];
@@ -278,7 +278,7 @@ abstract class StackMachine extends Matcher implements StackType {
}
return stkp;
}
-
+
protected final void pushNullCheckStart(int cnum, int s) {
StackEntry e = ensure1();
e.type = NULL_CHECK_START;
@@ -286,30 +286,30 @@ abstract class StackMachine extends Matcher implements StackType {
e.setNullCheckPStr(s);
stk++;
}
-
+
protected final void pushNullCheckEnd(int cnum) {
StackEntry e = ensure1();
e.type = NULL_CHECK_END;
e.setNullCheckNum(cnum);
stk++;
}
-
+
protected final void pushCallFrame(int pat) {
StackEntry e = ensure1();
e.type = CALL_FRAME;
e.setCallFrameRetAddr(pat);
stk++;
}
-
+
protected final void pushReturn() {
StackEntry e = ensure1();
e.type = RETURN;
stk++;
}
-
+
// stack debug routines here
// ...
-
+
protected final void popOne() {
stk--;
}
@@ -328,7 +328,7 @@ abstract class StackMachine extends Matcher implements StackType {
private StackEntry popFree() {
while (true) {
StackEntry e = stack[--stk];
-
+
if ((e.type & MASK_POP_USED) != 0) {
return e;
} else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
@@ -340,8 +340,8 @@ abstract class StackMachine extends Matcher implements StackType {
private StackEntry popMemStart() {
while (true) {
StackEntry e = stack[--stk];
-
- if ((e.type & MASK_POP_USED) != 0) {
+
+ if ((e.type & MASK_POP_USED) != 0) {
return e;
} else if (e.type == MEM_START) {
repeatStk[memStartStk + e.getMemNum()] = e.getMemStart();
@@ -367,9 +367,9 @@ abstract class StackMachine extends Matcher implements StackType {
stack[e.getSi()].decreaseRepeatCount();
} else if (e.type == MEM_END) {
repeatStk[memStartStk + e.getMemNum()] = e.getMemStart();
- repeatStk[memEndStk + e.getMemNum()] = e.getMemEnd();
- } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
- if (e.type == STATE_CHECK_MARK) stateCheckMark();
+ repeatStk[memEndStk + e.getMemNum()] = e.getMemEnd();
+ } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
+ if (e.type == STATE_CHECK_MARK) stateCheckMark();
}
}
}
@@ -378,7 +378,7 @@ abstract class StackMachine extends Matcher implements StackType {
while (true) {
stk--;
StackEntry e = stack[stk];
-
+
if (e.type == POS_NOT) {
break;
} else if (e.type == MEM_START) {
@@ -396,12 +396,12 @@ abstract class StackMachine extends Matcher implements StackType {
}
}
}
-
+
protected final void popTilLookBehindNot() {
while (true) {
stk--;
StackEntry e = stack[stk];
-
+
if (e.type == LOOK_BEHIND_NOT) {
break;
} else if (e.type == MEM_START) {
@@ -419,7 +419,7 @@ abstract class StackMachine extends Matcher implements StackType {
}
}
}
-
+
protected final int posEnd() {
int k = stk;
while (true) {
@@ -429,12 +429,12 @@ abstract class StackMachine extends Matcher implements StackType {
e.type = VOID;
} else if (e.type == POS) {
e.type = VOID;
- break;
+ break;
}
}
return k;
}
-
+
protected final void stopBtEnd() {
int k = stk;
while (true) {
@@ -449,14 +449,14 @@ abstract class StackMachine extends Matcher implements StackType {
}
}
}
-
+
// int for consistency with other null check routines
protected final int nullCheck(int id, int s) {
int k = stk;
while (true) {
k--;
StackEntry e = stack[k];
-
+
if (e.type == NULL_CHECK_START) {
if (e.getNullCheckNum() == id) {
return e.getNullCheckPStr() == s ? 1 : 0;
@@ -464,14 +464,14 @@ abstract class StackMachine extends Matcher implements StackType {
}
}
}
-
+
protected final int nullCheckRec(int id, int s) {
int level = 0;
int k = stk;
while (true) {
k--;
StackEntry e = stack[k];
-
+
if (e.type == NULL_CHECK_START) {
if (e.getNullCheckNum() == id) {
if (level == 0) {
@@ -485,14 +485,14 @@ abstract class StackMachine extends Matcher implements StackType {
}
}
}
-
+
protected final int nullCheckMemSt(int id, int s) {
int k = stk;
int isNull;
while (true) {
k--;
StackEntry e = stack[k];
-
+
if (e.type == NULL_CHECK_START) {
if (e.getNullCheckNum() == id) {
if (e.getNullCheckPStr() != s) {
@@ -529,7 +529,7 @@ abstract class StackMachine extends Matcher implements StackType {
}
return isNull;
}
-
+
protected final int nullCheckMemStRec(int id, int s) {
int level = 0;
int k = stk;
@@ -580,14 +580,14 @@ abstract class StackMachine extends Matcher implements StackType {
}
return isNull;
}
-
+
protected final int getRepeat(int id) {
int level = 0;
int k = stk;
while (true) {
k--;
StackEntry e = stack[k];
-
+
if (e.type == REPEAT) {
if (level == 0) {
if (e.getRepeatNum() == id) return k;
@@ -599,15 +599,15 @@ abstract class StackMachine extends Matcher implements StackType {
}
}
}
-
+
protected final int sreturn() {
int level = 0;
int k = stk;
while (true) {
k--;
StackEntry e = stack[k];
-
- if (e.type == CALL_FRAME) {
+
+ if (e.type == CALL_FRAME) {
if (level == 0) {
return e.getCallFrameRetAddr();
} else {
diff --git a/src/org/joni/Syntax.java b/src/org/joni/Syntax.java
index b89abe9..74662a8 100644
--- a/src/org/joni/Syntax.java
+++ b/src/org/joni/Syntax.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -24,7 +24,7 @@ import static org.joni.constants.MetaChar.INEFFECTIVE_META_CHAR;
import org.joni.constants.SyntaxProperties;
public final class Syntax implements SyntaxProperties{
- private final int op;
+ private final int op;
private final int op2;
private final int behavior;
public final int options;
@@ -39,273 +39,273 @@ public final class Syntax implements SyntaxProperties{
}
public static class MetaCharTable {
- public final int esc;
+ public final int esc;
public final int anyChar;
public final int anyTime;
public final int zeroOrOneTime;
public final int oneOrMoreTime;
public final int anyCharAnyTime;
-
- public MetaCharTable(int esc, int anyChar, int anyTime,
+
+ public MetaCharTable(int esc, int anyChar, int anyTime,
int zeroOrOneTime, int oneOrMoreTime, int anyCharAnyTime) {
this.esc = esc;
this.anyChar = anyChar;
this.anyTime = anyTime;
this.zeroOrOneTime = zeroOrOneTime;
- this.oneOrMoreTime = oneOrMoreTime;
+ this.oneOrMoreTime = oneOrMoreTime;
this.anyCharAnyTime = anyCharAnyTime;
}
}
-
+
/**
* OP
- *
+ *
*/
protected boolean isOp(int opm) {
return (op & opm) != 0;
}
-
- public boolean opVariableMetaCharacters() {
+
+ public boolean opVariableMetaCharacters() {
return isOp(OP_VARIABLE_META_CHARACTERS);
}
-
- public boolean opDotAnyChar() {
+
+ public boolean opDotAnyChar() {
return isOp(OP_DOT_ANYCHAR);
}
- public boolean opAsteriskZeroInf() {
+ public boolean opAsteriskZeroInf() {
return isOp(OP_ASTERISK_ZERO_INF);
}
-
- public boolean opEscAsteriskZeroInf() {
+
+ public boolean opEscAsteriskZeroInf() {
return isOp(OP_ESC_ASTERISK_ZERO_INF);
}
- public boolean opPlusOneInf() {
+ public boolean opPlusOneInf() {
return isOp(OP_PLUS_ONE_INF);
}
-
- public boolean opEscPlusOneInf() {
+
+ public boolean opEscPlusOneInf() {
return isOp(OP_ESC_PLUS_ONE_INF);
}
- public boolean opQMarkZeroOne() {
+ public boolean opQMarkZeroOne() {
return isOp(OP_QMARK_ZERO_ONE);
}
-
- public boolean opEscQMarkZeroOne() {
+
+ public boolean opEscQMarkZeroOne() {
return isOp(OP_ESC_QMARK_ZERO_ONE);
}
-
- public boolean opBraceInterval() {
+
+ public boolean opBraceInterval() {
return isOp(OP_BRACE_INTERVAL);
}
-
- public boolean opEscBraceInterval() {
+
+ public boolean opEscBraceInterval() {
return isOp(OP_ESC_BRACE_INTERVAL);
}
- public boolean opVBarAlt() {
+ public boolean opVBarAlt() {
return isOp(OP_VBAR_ALT);
}
- public boolean opEscVBarAlt() {
+ public boolean opEscVBarAlt() {
return isOp(OP_ESC_VBAR_ALT);
}
-
- public boolean opLParenSubexp() {
+
+ public boolean opLParenSubexp() {
return isOp(OP_LPAREN_SUBEXP);
}
- public boolean opEscLParenSubexp() {
+ public boolean opEscLParenSubexp() {
return isOp(OP_ESC_LPAREN_SUBEXP);
}
-
- public boolean opEscAZBufAnchor() {
+
+ public boolean opEscAZBufAnchor() {
return isOp(OP_ESC_AZ_BUF_ANCHOR);
}
- public boolean opEscCapitalGBeginAnchor() {
+ public boolean opEscCapitalGBeginAnchor() {
return isOp(OP_ESC_CAPITAL_G_BEGIN_ANCHOR);
}
-
- public boolean opDecimalBackref() {
+
+ public boolean opDecimalBackref() {
return isOp(OP_DECIMAL_BACKREF);
}
- public boolean opBracketCC() {
+ public boolean opBracketCC() {
return isOp(OP_BRACKET_CC);
}
-
- public boolean opEscWWord() {
+
+ public boolean opEscWWord() {
return isOp(OP_ESC_W_WORD);
}
- public boolean opEscLtGtWordBeginEnd() {
+ public boolean opEscLtGtWordBeginEnd() {
return isOp(OP_ESC_LTGT_WORD_BEGIN_END);
}
public boolean opEscBWordBound() {
return isOp(OP_ESC_B_WORD_BOUND);
}
-
+
public boolean opEscSWhiteSpace() {
return isOp(OP_ESC_S_WHITE_SPACE);
}
-
- public boolean opEscDDigit() {
+
+ public boolean opEscDDigit() {
return isOp(OP_ESC_D_DIGIT);
}
- public boolean opLineAnchor() {
+ public boolean opLineAnchor() {
return isOp(OP_LINE_ANCHOR);
}
-
- public boolean opPosixBracket() {
+
+ public boolean opPosixBracket() {
return isOp(OP_POSIX_BRACKET);
}
-
- public boolean opQMarkNonGreedy() {
+
+ public boolean opQMarkNonGreedy() {
return isOp(OP_QMARK_NON_GREEDY);
}
-
- public boolean opEscControlChars() {
+
+ public boolean opEscControlChars() {
return isOp(OP_ESC_CONTROL_CHARS);
}
-
- public boolean opEscCControl() {
+
+ public boolean opEscCControl() {
return isOp(OP_ESC_C_CONTROL);
}
- public boolean opEscOctal3() {
+ public boolean opEscOctal3() {
return isOp(OP_ESC_OCTAL3);
}
-
- public boolean opEscXHex2() {
+
+ public boolean opEscXHex2() {
return isOp(OP_ESC_X_HEX2);
}
-
- public boolean opEscXBraceHex8() {
+
+ public boolean opEscXBraceHex8() {
return isOp(OP_ESC_X_BRACE_HEX8);
}
-
+
/**
* OP
- *
+ *
*/
protected boolean isOp2(int opm) {
return (op2 & opm) != 0;
}
-
- public boolean op2EscCapitalQQuote() {
+
+ public boolean op2EscCapitalQQuote() {
return isOp2(OP2_ESC_CAPITAL_Q_QUOTE);
- }
-
- public boolean op2QMarkGroupEffect() {
+ }
+
+ public boolean op2QMarkGroupEffect() {
return isOp2(OP2_QMARK_GROUP_EFFECT);
- }
+ }
- public boolean op2OptionPerl() {
+ public boolean op2OptionPerl() {
return isOp2(OP2_OPTION_PERL);
- }
+ }
- public boolean op2OptionRuby() {
+ public boolean op2OptionRuby() {
return isOp2(OP2_OPTION_RUBY);
- }
-
- public boolean op2PlusPossessiveRepeat() {
+ }
+
+ public boolean op2PlusPossessiveRepeat() {
return isOp2(OP2_PLUS_POSSESSIVE_REPEAT);
- }
+ }
- public boolean op2PlusPossessiveInterval() {
+ public boolean op2PlusPossessiveInterval() {
return isOp2(OP2_PLUS_POSSESSIVE_INTERVAL);
- }
-
- public boolean op2CClassSetOp() {
+ }
+
+ public boolean op2CClassSetOp() {
return isOp2(OP2_CCLASS_SET_OP);
- }
+ }
- public boolean op2QMarkLtNamedGroup() {
+ public boolean op2QMarkLtNamedGroup() {
return isOp2(OP2_QMARK_LT_NAMED_GROUP);
- }
+ }
- public boolean op2EscKNamedBackref() {
+ public boolean op2EscKNamedBackref() {
return isOp2(OP2_ESC_K_NAMED_BACKREF);
- }
-
- public boolean op2EscGSubexpCall() {
+ }
+
+ public boolean op2EscGSubexpCall() {
return isOp2(OP2_ESC_G_SUBEXP_CALL);
- }
+ }
- public boolean op2AtMarkCaptureHistory() {
+ public boolean op2AtMarkCaptureHistory() {
return isOp2(OP2_ATMARK_CAPTURE_HISTORY);
- }
-
- public boolean op2EscCapitalCBarControl() {
+ }
+
+ public boolean op2EscCapitalCBarControl() {
return isOp2(OP2_ESC_CAPITAL_C_BAR_CONTROL);
- }
+ }
- public boolean op2EscCapitalMBarMeta() {
+ public boolean op2EscCapitalMBarMeta() {
return isOp2(OP2_ESC_CAPITAL_M_BAR_META);
- }
-
- public boolean op2EscVVtab() {
+ }
+
+ public boolean op2EscVVtab() {
return isOp2(OP2_ESC_V_VTAB);
}
-
- public boolean op2EscUHex4() {
+
+ public boolean op2EscUHex4() {
return isOp2(OP2_ESC_U_HEX4);
- }
-
- public boolean op2EscGnuBufAnchor() {
+ }
+
+ public boolean op2EscGnuBufAnchor() {
return isOp2(OP2_ESC_GNU_BUF_ANCHOR);
- }
-
- public boolean op2EscPBraceCharProperty() {
+ }
+
+ public boolean op2EscPBraceCharProperty() {
return isOp2(OP2_ESC_P_BRACE_CHAR_PROPERTY);
- }
+ }
- public boolean op2EscPBraceCircumflexNot() {
+ public boolean op2EscPBraceCircumflexNot() {
return isOp2(OP2_ESC_P_BRACE_CIRCUMFLEX_NOT);
- }
+ }
- public boolean op2EscHXDigit() {
+ public boolean op2EscHXDigit() {
return isOp2(OP2_ESC_H_XDIGIT);
- }
-
- public boolean op2IneffectiveEscape() {
+ }
+
+ public boolean op2IneffectiveEscape() {
return isOp2(OP2_INEFFECTIVE_ESCAPE);
- }
-
+ }
+
/**
* BEHAVIOR
- *
+ *
*/
protected boolean isBehavior(int bvm) {
return (behavior & bvm) != 0;
}
-
+
public boolean contextIndepRepeatOps() {
- return isBehavior(CONTEXT_INDEP_REPEAT_OPS);
+ return isBehavior(CONTEXT_INDEP_REPEAT_OPS);
}
-
+
public boolean contextInvalidRepeatOps() {
- return isBehavior(CONTEXT_INVALID_REPEAT_OPS);
+ return isBehavior(CONTEXT_INVALID_REPEAT_OPS);
}
-
+
public boolean allowUnmatchedCloseSubexp() {
- return isBehavior(ALLOW_UNMATCHED_CLOSE_SUBEXP);
+ return isBehavior(ALLOW_UNMATCHED_CLOSE_SUBEXP);
}
-
+
public boolean allowInvalidInterval() {
- return isBehavior(ALLOW_INVALID_INTERVAL);
+ return isBehavior(ALLOW_INVALID_INTERVAL);
}
public boolean allowIntervalLowAbbrev() {
- return isBehavior(ALLOW_INTERVAL_LOW_ABBREV);
+ return isBehavior(ALLOW_INTERVAL_LOW_ABBREV);
}
-
+
public boolean strictCheckBackref() {
return isBehavior(STRICT_CHECK_BACKREF);
}
@@ -313,7 +313,7 @@ public final class Syntax implements SyntaxProperties{
public boolean differentLengthAltLookBehind() {
return isBehavior(DIFFERENT_LEN_ALT_LOOK_BEHIND);
}
-
+
public boolean captureOnlyNamedGroup() {
return isBehavior(CAPTURE_ONLY_NAMED_GROUP);
}
@@ -325,8 +325,8 @@ public final class Syntax implements SyntaxProperties{
public boolean fixedIntervalIsGreedyOnly() {
return isBehavior(FIXED_INTERVAL_IS_GREEDY_ONLY);
}
-
-
+
+
public boolean notNewlineInNegativeCC() {
return isBehavior(NOT_NEWLINE_IN_NEGATIVE_CC);
}
@@ -334,30 +334,30 @@ public final class Syntax implements SyntaxProperties{
public boolean backSlashEscapeInCC() {
return isBehavior(BACKSLASH_ESCAPE_IN_CC);
}
-
+
public boolean allowEmptyRangeInCC() {
return isBehavior(ALLOW_EMPTY_RANGE_IN_CC);
}
-
+
public boolean allowDoubleRangeOpInCC() {
return isBehavior(ALLOW_DOUBLE_RANGE_OP_IN_CC);
}
-
+
public boolean warnCCOpNotEscaped() {
return isBehavior(WARN_CC_OP_NOT_ESCAPED);
}
-
+
public boolean warnReduntantNestedRepeat() {
return isBehavior(WARN_REDUNDANT_NESTED_REPEAT);
}
-
+
public static final Syntax RUBY = new Syntax(
(( GNU_REGEX_OP | OP_QMARK_NON_GREEDY |
OP_ESC_OCTAL3 | OP_ESC_X_HEX2 |
OP_ESC_X_BRACE_HEX8 | OP_ESC_CONTROL_CHARS |
OP_ESC_C_CONTROL )
& ~OP_ESC_LTGT_WORD_BEGIN_END ),
-
+
( OP2_QMARK_GROUP_EFFECT |
OP2_OPTION_RUBY |
OP2_QMARK_LT_NAMED_GROUP | OP2_ESC_K_NAMED_BACKREF |
@@ -368,8 +368,8 @@ public final class Syntax implements SyntaxProperties{
OP2_CCLASS_SET_OP | OP2_ESC_CAPITAL_C_BAR_CONTROL |
OP2_ESC_CAPITAL_M_BAR_META | OP2_ESC_V_VTAB |
OP2_ESC_H_XDIGIT ),
-
- ( GNU_REGEX_BV |
+
+ ( GNU_REGEX_BV |
ALLOW_INTERVAL_LOW_ABBREV |
DIFFERENT_LEN_ALT_LOOK_BEHIND |
CAPTURE_ONLY_NAMED_GROUP |
@@ -377,9 +377,9 @@ public final class Syntax implements SyntaxProperties{
FIXED_INTERVAL_IS_GREEDY_ONLY |
WARN_CC_OP_NOT_ESCAPED |
WARN_REDUNDANT_NESTED_REPEAT ),
-
+
Option.NONE,
-
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -389,14 +389,14 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR /* anychar anytime */
)
);
-
+
public static final Syntax DEFAULT = RUBY;
-
+
public static final Syntax ASIS = new Syntax(
0,
OP2_INEFFECTIVE_ESCAPE,
-
+
0,
Option.NONE,
@@ -410,17 +410,17 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR /* anychar anytime */
)
);
-
+
public static final Syntax PosixBasic = new Syntax(
(POSIX_COMMON_OP | OP_ESC_LPAREN_SUBEXP |
OP_ESC_BRACE_INTERVAL ),
-
+
0,
-
+
0,
-
+
( Option.SINGLELINE | Option.MULTILINE ),
-
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -428,23 +428,23 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
-
+
public static final Syntax PosixExtended = new Syntax(
( POSIX_COMMON_OP | OP_LPAREN_SUBEXP |
OP_BRACE_INTERVAL |
OP_PLUS_ONE_INF | OP_QMARK_ZERO_ONE |OP_VBAR_ALT ),
-
+
0,
-
- ( CONTEXT_INDEP_ANCHORS |
- CONTEXT_INDEP_REPEAT_OPS | CONTEXT_INVALID_REPEAT_OPS |
+
+ ( CONTEXT_INDEP_ANCHORS |
+ CONTEXT_INDEP_REPEAT_OPS | CONTEXT_INVALID_REPEAT_OPS |
ALLOW_UNMATCHED_CLOSE_SUBEXP |
ALLOW_DOUBLE_RANGE_OP_IN_CC ),
-
- ( Option.SINGLELINE | Option.MULTILINE ),
-
+
+ ( Option.SINGLELINE | Option.MULTILINE ),
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -452,9 +452,9 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
-
+
public static final Syntax Emacs = new Syntax(
( OP_DOT_ANYCHAR | OP_BRACKET_CC |
OP_ESC_BRACE_INTERVAL |
@@ -462,13 +462,13 @@ public final class Syntax implements SyntaxProperties{
OP_ASTERISK_ZERO_INF | OP_PLUS_ONE_INF |
OP_QMARK_ZERO_ONE | OP_DECIMAL_BACKREF |
OP_LINE_ANCHOR | OP_ESC_CONTROL_CHARS ),
-
+
OP2_ESC_GNU_BUF_ANCHOR,
-
+
ALLOW_EMPTY_RANGE_IN_CC,
Option.NONE,
-
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -476,9 +476,9 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
-
+
public static final Syntax Grep = new Syntax(
( OP_DOT_ANYCHAR | OP_BRACKET_CC | OP_POSIX_BRACKET |
OP_ESC_BRACE_INTERVAL | OP_ESC_LPAREN_SUBEXP |
@@ -487,13 +487,13 @@ public final class Syntax implements SyntaxProperties{
OP_ESC_QMARK_ZERO_ONE | OP_LINE_ANCHOR |
OP_ESC_W_WORD | OP_ESC_B_WORD_BOUND |
OP_ESC_LTGT_WORD_BEGIN_END | OP_DECIMAL_BACKREF ),
-
+
0,
-
+
( ALLOW_EMPTY_RANGE_IN_CC | NOT_NEWLINE_IN_NEGATIVE_CC ),
Option.NONE,
-
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -501,14 +501,14 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
-
+
public static final Syntax GnuRegex = new Syntax(
GNU_REGEX_OP,
0,
GNU_REGEX_BV,
-
+
Option.NONE,
new MetaCharTable(
@@ -520,23 +520,23 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR /* anychar anytime */
)
);
-
+
public static final Syntax Java = new Syntax(
(( GNU_REGEX_OP | OP_QMARK_NON_GREEDY |
OP_ESC_CONTROL_CHARS | OP_ESC_C_CONTROL |
OP_ESC_OCTAL3 | OP_ESC_X_HEX2 )
& ~OP_ESC_LTGT_WORD_BEGIN_END ),
-
+
( OP2_ESC_CAPITAL_Q_QUOTE | OP2_QMARK_GROUP_EFFECT |
OP2_OPTION_PERL | OP2_PLUS_POSSESSIVE_REPEAT |
OP2_PLUS_POSSESSIVE_INTERVAL | OP2_CCLASS_SET_OP |
OP2_ESC_V_VTAB | OP2_ESC_U_HEX4 |
OP2_ESC_P_BRACE_CHAR_PROPERTY ),
-
+
( GNU_REGEX_BV | DIFFERENT_LEN_ALT_LOOK_BEHIND ),
-
+
Option.SINGLELINE,
-
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -544,9 +544,9 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
-
+
public static final Syntax Perl = new Syntax(
(( GNU_REGEX_OP | OP_QMARK_NON_GREEDY |
OP_ESC_OCTAL3 | OP_ESC_X_HEX2 |
@@ -558,11 +558,11 @@ public final class Syntax implements SyntaxProperties{
OP2_QMARK_GROUP_EFFECT | OP2_OPTION_PERL |
OP2_ESC_P_BRACE_CHAR_PROPERTY |
OP2_ESC_P_BRACE_CIRCUMFLEX_NOT ),
-
+
GNU_REGEX_BV,
-
+
Option.SINGLELINE,
-
+
new MetaCharTable(
'\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
@@ -570,16 +570,16 @@ public final class Syntax implements SyntaxProperties{
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
-
+
public static final Syntax PerlNG = new Syntax(
(( GNU_REGEX_OP | OP_QMARK_NON_GREEDY |
OP_ESC_OCTAL3 | OP_ESC_X_HEX2 |
OP_ESC_X_BRACE_HEX8 | OP_ESC_CONTROL_CHARS |
OP_ESC_C_CONTROL )
& ~OP_ESC_LTGT_WORD_BEGIN_END ),
-
+
( OP2_ESC_CAPITAL_Q_QUOTE |
OP2_QMARK_GROUP_EFFECT | OP2_OPTION_PERL |
OP2_ESC_P_BRACE_CHAR_PROPERTY |
@@ -587,20 +587,20 @@ public final class Syntax implements SyntaxProperties{
OP2_QMARK_LT_NAMED_GROUP |
OP2_ESC_K_NAMED_BACKREF |
OP2_ESC_G_SUBEXP_CALL ),
-
+
( GNU_REGEX_BV |
CAPTURE_ONLY_NAMED_GROUP |
ALLOW_MULTIPLEX_DEFINITION_NAME ),
-
+
Option.SINGLELINE,
-
+
new MetaCharTable(
- '\\', /* esc */
+ '\\', /* esc */
INEFFECTIVE_META_CHAR, /* anychar '.' */
INEFFECTIVE_META_CHAR, /* anytime '*' */
INEFFECTIVE_META_CHAR, /* zero or one time '?' */
INEFFECTIVE_META_CHAR, /* one or more time '+' */
INEFFECTIVE_META_CHAR /* anychar anytime */
- )
+ )
);
}
diff --git a/src/org/joni/Token.java b/src/org/joni/Token.java
index 16e2b1a..8ad7330 100644
--- a/src/org/joni/Token.java
+++ b/src/org/joni/Token.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -153,7 +153,7 @@ final class Token {
}
void setCallGNum(int gnum) {
INT3 = gnum;
- }
+ }
// prop union member
int getPropCType() {
diff --git a/src/org/joni/UnsetAddrList.java b/src/org/joni/UnsetAddrList.java
index 8787972..34e472d 100644
--- a/src/org/joni/UnsetAddrList.java
+++ b/src/org/joni/UnsetAddrList.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -28,14 +28,14 @@ public final class UnsetAddrList {
int num;
Node[]targets;
int[]offsets;
-
+
public UnsetAddrList(int size) {
targets = new Node[size];
offsets = new int[size];
}
-
+
public void add(int offset, Node node) {
- if (num >= offsets.length) {
+ if (num >= offsets.length) {
Node []ttmp = new Node[targets.length << 1];
System.arraycopy(targets, 0, ttmp, 0, num);
targets = ttmp;
@@ -45,10 +45,10 @@ public final class UnsetAddrList {
}
targets[num] = node;
offsets[num] = offset;
-
+
num++;
}
-
+
public void fix(Regex regex) {
for (int i=0; i<num; i++) {
EncloseNode en = (EncloseNode)targets[i];
@@ -56,7 +56,7 @@ public final class UnsetAddrList {
regex.code[offsets[i]] = en.callAddr; // is this safe ?
}
}
-
+
public String toString() {
StringBuilder value = new StringBuilder();
if (num > 0) {
diff --git a/src/org/joni/WarnCallback.java b/src/org/joni/WarnCallback.java
index 351146b..b5f2a27 100644
--- a/src/org/joni/WarnCallback.java
+++ b/src/org/joni/WarnCallback.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni;
@@ -23,10 +23,11 @@ package org.joni;
* @author <a href="mailto:ola.bini at gmail.com">Ola Bini</a>
*/
public interface WarnCallback {
- WarnCallback DEFAULT = new WarnCallback(){
- public void warn(String message) {
- System.err.println(message);
- }
- };
+ WarnCallback DEFAULT = new WarnCallback() {
+ public void warn(String message) {
+ System.err.println(message);
+ }
+ };
+
void warn(String message);
-}// WarnCallback
+}
diff --git a/src/org/joni/ast/AnchorNode.java b/src/org/joni/ast/AnchorNode.java
index cccbc49..988d994 100644
--- a/src/org/joni/ast/AnchorNode.java
+++ b/src/org/joni/ast/AnchorNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -30,32 +30,32 @@ public final class AnchorNode extends Node implements AnchorType {
this.type = type;
charLength = -1;
}
-
+
@Override
public int getType() {
return ANCHOR;
}
-
+
@Override
protected void setChild(Node newChild) {
target = newChild;
}
-
+
@Override
protected Node getChild() {
return target;
- }
-
+ }
+
public void setTarget(Node tgt) {
target = tgt;
- tgt.parent = this;
+ tgt.parent = this;
}
-
+
@Override
public String getName() {
return "Anchor";
}
-
+
@Override
public String toString(int level) {
StringBuilder value = new StringBuilder();
@@ -63,7 +63,7 @@ public final class AnchorNode extends Node implements AnchorType {
value.append("\n target: " + pad(target, level + 1));
return value.toString();
}
-
+
public String typeToString() {
StringBuilder type = new StringBuilder();
if (isType(BEGIN_BUF)) type.append("BEGIN_BUF ");
@@ -82,11 +82,11 @@ public final class AnchorNode extends Node implements AnchorType {
if (isType(LOOK_BEHIND_NOT)) type.append("LOOK_BEHIND_NOT ");
if (isType(ANYCHAR_STAR)) type.append("ANYCHAR_STAR ");
if (isType(ANYCHAR_STAR_ML)) type.append("ANYCHAR_STAR_ML ");
- return type.toString();
+ return type.toString();
}
private boolean isType(int type) {
- return (this.type & type) != 0;
+ return (this.type & type) != 0;
}
}
diff --git a/src/org/joni/ast/AnyCharNode.java b/src/org/joni/ast/AnyCharNode.java
index d349d8c..5b4f9b6 100644
--- a/src/org/joni/ast/AnyCharNode.java
+++ b/src/org/joni/ast/AnyCharNode.java
@@ -1,40 +1,40 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
public final class AnyCharNode extends Node {
public AnyCharNode(){}
-
+
@Override
public int getType() {
return CANY;
}
-
+
@Override
public String getName() {
return "Any Char";
- }
-
+ }
+
@Override
public String toString(int level) {
String value = "";
return value;
- }
+ }
}
diff --git a/src/org/joni/ast/BackRefNode.java b/src/org/joni/ast/BackRefNode.java
index 040fb81..603cbe7 100644
--- a/src/org/joni/ast/BackRefNode.java
+++ b/src/org/joni/ast/BackRefNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -24,49 +24,49 @@ import org.joni.exception.ErrorMessages;
import org.joni.exception.ValueException;
public final class BackRefNode extends StateNode {
- //private static int NODE_BACKREFS_SIZE = 6;
-
+ //private static int NODE_BACKREFS_SIZE = 6;
+
//int state;
public int backNum;
public int back[];
-
+
public int nestLevel;
-
+
public BackRefNode(int backNum, int[]backRefs, boolean byName, ScanEnvironment env) {
this.backNum = backNum;
if (byName) setNameRef();
-
+
for (int i=0; i<backNum; i++) {
if (backRefs[i] <= env.numMem && env.memNodes[backRefs[i]] == null) {
setRecursion(); /* /...(\1).../ */
break;
}
}
-
+
back = new int[backNum];
System.arraycopy(backRefs, 0, back, 0, backNum); // shall we really dup it ???
}
-
+
// #ifdef USE_BACKREF_AT_LEVEL
public BackRefNode(int backNum, int[]backRefs, boolean byName, boolean existLevel, int nestLevel, ScanEnvironment env) {
this(backNum, backRefs, byName, env);
-
+
if (existLevel) {
//state |= NST_NEST_LEVEL;
setNestLevel();
this.nestLevel = nestLevel;
}
}
-
+
@Override
public int getType() {
return BREF;
- }
-
+ }
+
@Override
public String getName() {
return "Back Ref";
- }
+ }
@Override
public String toString(int level) {
@@ -78,12 +78,12 @@ public final class BackRefNode extends StateNode {
value.append("\n nextLevel: " + nestLevel);
return value.toString();
}
-
+
public void renumber(int[]map) {
if (!isNameRef()) throw new ValueException(ErrorMessages.ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
-
+
int oldNum = backNum;
-
+
int pos = 0;
for (int i=0; i<oldNum; i++) {
int n = map[back[i]];
@@ -94,5 +94,5 @@ public final class BackRefNode extends StateNode {
}
backNum = pos;
}
-
+
}
diff --git a/src/org/joni/ast/CTypeNode.java b/src/org/joni/ast/CTypeNode.java
index 093216a..017ce54 100644
--- a/src/org/joni/ast/CTypeNode.java
+++ b/src/org/joni/ast/CTypeNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -22,29 +22,29 @@ package org.joni.ast;
public final class CTypeNode extends Node {
public int ctype;
public boolean not;
-
+
public CTypeNode(int type, boolean not) {
this.ctype= type;
this.not = not;
}
-
+
@Override
public int getType() {
return CTYPE;
}
-
+
@Override
public String getName() {
return "Character Type";
- }
-
+ }
+
@Override
public String toString(int level) {
StringBuilder value = new StringBuilder();
value.append("\n ctype: " + ctype);
value.append("\n not: " + not);
-
+
return value.toString();
}
-
+
}
diff --git a/src/org/joni/ast/CallNode.java b/src/org/joni/ast/CallNode.java
index 8261f75..a361544 100644
--- a/src/org/joni/ast/CallNode.java
+++ b/src/org/joni/ast/CallNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -32,24 +32,24 @@ public final class CallNode extends StateNode {
public int groupNum;
public Node target; // is it an EncloseNode always ?
public UnsetAddrList unsetAddrList;
-
+
public CallNode(byte[]name, int nameP, int nameEnd, int gnum) {
this.name = name;
this.nameP = nameP;
this.nameEnd = nameEnd;
this.groupNum = gnum; /* call by number if gnum != 0 */
}
-
+
@Override
public int getType() {
return CALL;
}
-
+
@Override
protected void setChild(Node newChild) {
target = newChild;
}
-
+
@Override
protected Node getChild() {
return target;
@@ -57,21 +57,21 @@ public final class CallNode extends StateNode {
public void setTarget(Node tgt) {
target = tgt;
- tgt.parent = this;
- }
+ tgt.parent = this;
+ }
@Override
public String getName() {
return "Call";
}
-
+
@Override
public void verifyTree(Set<Node> set, WarnCallback warnings) {
if (target == null || target.parent == this)
warnings.warn(this.getAddressName() + " doesn't point to a target or the target has been stolen");
// do not recurse here
- }
-
+ }
+
@Override
public String toString(int level) {
StringBuilder value = new StringBuilder(super.toString(level));
@@ -79,8 +79,8 @@ public final class CallNode extends StateNode {
value.append("\n groupNum: " + groupNum);
value.append("\n target: " + pad(target.getAddressName(), level + 1));
value.append("\n unsetAddrList: " + pad(unsetAddrList, level + 1));
-
+
return value.toString();
- }
-
+ }
+
}
diff --git a/src/org/joni/ast/ConsAltNode.java b/src/org/joni/ast/ConsAltNode.java
index 3d7f784..1ffc889 100644
--- a/src/org/joni/ast/ConsAltNode.java
+++ b/src/org/joni/ast/ConsAltNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -30,27 +30,27 @@ public final class ConsAltNode extends Node {
public Node car;
public ConsAltNode cdr;
private int type; // List or Alt
-
+
private ConsAltNode(Node car, ConsAltNode cdr, int type) {
this.car = car;
if (car != null) car.parent = this;
this.cdr = cdr;
if (cdr != null) cdr.parent = this;
-
+
this.type = type;
}
-
+
public static ConsAltNode newAltNode(Node left, ConsAltNode right) {
return new ConsAltNode(left, right, ALT);
}
-
+
public static ConsAltNode newListNode(Node left, ConsAltNode right) {
return new ConsAltNode(left, right, LIST);
}
-
+
public static ConsAltNode listAdd(ConsAltNode list, Node x) {
ConsAltNode n = newListNode(x, null);
-
+
if (list != null) {
while (list.cdr != null) {
list = list.cdr;
@@ -59,25 +59,25 @@ public final class ConsAltNode extends Node {
}
return n;
}
-
+
public void toListNode() {
type = LIST;
}
-
+
public void toAltNode() {
type = ALT;
}
-
+
@Override
- public int getType() {
+ public int getType() {
return type;
}
-
+
@Override
protected void setChild(Node newChild) {
car = newChild;
- }
-
+ }
+
@Override
protected Node getChild() {
return car;
@@ -95,10 +95,10 @@ public final class ConsAltNode extends Node {
withCan.cdr = tmp;
}
}
-
+
super.swap(with);
- }
-
+ }
+
@Override
public void verifyTree(Set<Node> set, WarnCallback warnings) {
if (!set.contains(this)) {
@@ -123,13 +123,13 @@ public final class ConsAltNode extends Node {
ca.parent = this;
return car;
}
-
+
public ConsAltNode setCdr(ConsAltNode cd) {
cdr = cd;
cd.parent = this;
return cdr;
}
-
+
@Override
public String getName() {
switch (type) {
@@ -147,8 +147,8 @@ public final class ConsAltNode extends Node {
StringBuilder value = new StringBuilder();
value.append("\n left: " + pad(car, level + 1));
value.append("\n right: " + (cdr == null ? "NULL" : cdr.toString()));
-
+
return value.toString();
- }
+ }
}
diff --git a/src/org/joni/ast/EncloseNode.java b/src/org/joni/ast/EncloseNode.java
index 02b2391..0a07ed1 100644
--- a/src/org/joni/ast/EncloseNode.java
+++ b/src/org/joni/ast/EncloseNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -24,7 +24,7 @@ import org.joni.Option;
import org.joni.constants.EncloseType;
public final class EncloseNode extends StateNode implements EncloseType {
-
+
public int type; // enclose type
public int regNum;
public int option;
@@ -34,20 +34,20 @@ public final class EncloseNode extends StateNode implements EncloseType {
public int maxLength; // OnigDistance
public int charLength;
public int optCount; // referenced count in optimize_node_left()
-
+
// node_new_enclose / onig_node_new_enclose
public EncloseNode(int type) {
this.type = type;
callAddr = -1;
}
-
+
// node_new_enclose_memory
public EncloseNode(int option, boolean isNamed) {
this(MEMORY);
if (isNamed) setNamedGroup();
if (Config.USE_SUBEXP_CALL) this.option = option;
}
-
+
// node_new_option
public EncloseNode(int option, int _) {
this(OPTION);
@@ -58,12 +58,12 @@ public final class EncloseNode extends StateNode implements EncloseType {
public int getType() {
return ENCLOSE;
}
-
+
@Override
protected void setChild(Node newChild) {
target = newChild;
}
-
+
@Override
protected Node getChild() {
return target;
@@ -71,14 +71,14 @@ public final class EncloseNode extends StateNode implements EncloseType {
public void setTarget(Node tgt) {
target = tgt;
- tgt.parent = this;
- }
-
+ tgt.parent = this;
+ }
+
@Override
public String getName() {
return "Enclose";
- }
-
+ }
+
@Override
public String toString(int level) {
StringBuilder value = new StringBuilder(super.toString(level));
@@ -91,61 +91,61 @@ public final class EncloseNode extends StateNode implements EncloseType {
value.append("\n maxLength: " + maxLength);
value.append("\n charLength: " + charLength);
value.append("\n optCount: " + optCount);
-
+
return value.toString();
}
-
+
public String typeToString() {
StringBuilder types = new StringBuilder();
if (isStopBacktrack()) types.append("STOP_BACKTRACK ");
if (isMemory()) types.append("MEMORY ");
if (isOption()) types.append("OPTION ");
-
+
return types.toString();
}
-
+
public void setEncloseStatus(int flag) {
state |= flag;
}
-
+
public void clearEncloseStatus(int flag) {
state &= ~flag;
}
-
+
public void clearMemory() {
type &= ~MEMORY;
}
-
+
public void setMemory() {
type |= MEMORY;
}
-
+
public boolean isMemory() {
return (type & MEMORY) != 0;
}
-
+
public void clearOption() {
type &= ~OPTION;
}
-
+
public void setOption() {
type |= OPTION;
}
-
+
public boolean isOption() {
return (type & OPTION) != 0;
}
-
+
public void clearStopBacktrack() {
type &= ~STOP_BACKTRACK;
}
-
+
public void setStopBacktrack() {
type |= STOP_BACKTRACK;
}
-
+
public boolean isStopBacktrack() {
return (type & STOP_BACKTRACK) != 0;
- }
-
+ }
+
}
diff --git a/src/org/joni/ast/Node.java b/src/org/joni/ast/Node.java
index eef7790..f3061c0 100644
--- a/src/org/joni/ast/Node.java
+++ b/src/org/joni/ast/Node.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -27,13 +27,13 @@ import org.joni.constants.NodeType;
public abstract class Node implements NodeType {
public Node parent;
-
+
public abstract int getType();
public final int getType2Bit() {
- return 1 << getType();
- }
-
+ return 1 << getType();
+ }
+
protected void setChild(Node tgt){} // default definition
protected Node getChild(){return null;}; // default definition
@@ -42,20 +42,20 @@ public abstract class Node implements NodeType {
//if (getChild() != null) getChild().parent = with;
//if (with.getChild() != null) with.getChild().parent = this;
-
+
//tmp = getChild();
//setChild(with.getChild());
//with.setChild(tmp);
-
+
if (parent != null) parent.setChild(with);
-
+
if (with.parent != null) with.parent.setChild(this);
tmp = parent;
parent = with.parent;
with.parent = tmp;
}
-
+
// overridden by ConsAltNode and CallNode
public void verifyTree(Set<Node> set, WarnCallback warnings) {
if (!set.contains(this) && getChild() != null) {
@@ -65,31 +65,31 @@ public abstract class Node implements NodeType {
}
getChild().verifyTree(set, warnings);
}
- }
-
+ }
+
public abstract String getName();
protected abstract String toString(int level);
-
+
public String getAddressName() {
return getName() + ":0x" + Integer.toHexString(System.identityHashCode(this));
}
-
+
public final String toString() {
StringBuilder s = new StringBuilder();
s.append("<" + getAddressName() + ">");
- s.append("\n parent: " + (parent == null ? "NULL" : parent.getAddressName()));
+ s.append("\n parent: " + (parent == null ? "NULL" : parent.getAddressName()));
return s + toString(0);
}
-
+
protected static String pad(Object value, int level) {
if (value == null) return "NULL";
-
+
StringBuilder pad = new StringBuilder(" ");
for (int i=0; i<level; i++) pad.append(pad);
-
+
return value.toString().replace("\n", "\n" + pad);
}
-
+
public final boolean isInvalidQuantifier() {
if (!Config.VANILLA) return false;
@@ -99,37 +99,37 @@ public abstract class Node implements NodeType {
case ANCHOR:
return true;
-
+
case ENCLOSE:
/* allow enclosed elements */
/* return is_invalid_quantifier_target(NENCLOSE(node)->target); */
break;
-
+
case LIST:
node = (ConsAltNode)this;
do {
if (!node.car.isInvalidQuantifier()) return false;
} while ((node = node.cdr) != null);
return false;
-
+
case ALT:
node = (ConsAltNode)this;
do {
if (node.car.isInvalidQuantifier()) return true;
} while ((node = node.cdr) != null);
break;
-
+
default:
break;
}
-
+
return false;
}
-
+
public final boolean isAllowedInLookBehind() {
- return (getType2Bit() & ALLOWED_IN_LB) != 0;
+ return (getType2Bit() & ALLOWED_IN_LB) != 0;
}
-
+
public final boolean isSimple() {
return (getType2Bit() & SIMPLE) != 0;
}
diff --git a/src/org/joni/ast/StateNode.java b/src/org/joni/ast/StateNode.java
index 117d3df..299b319 100644
--- a/src/org/joni/ast/StateNode.java
+++ b/src/org/joni/ast/StateNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -28,7 +28,7 @@ public abstract class StateNode extends Node implements NodeStatus {
public String toString(int level) {
return "\n state: " + stateToString();
}
-
+
public String stateToString() {
StringBuilder states = new StringBuilder();
if (isMinFixed()) states.append("MIN_FIXED ");
@@ -48,185 +48,185 @@ public abstract class StateNode extends Node implements NodeStatus {
return states.toString();
}
-
+
public boolean isMinFixed() {
return (state & NST_MIN_FIXED) != 0;
}
-
+
public void setMinFixed() {
state |= NST_MIN_FIXED;
}
-
+
public void clearMinFixed() {
state &= ~NST_MIN_FIXED;
}
-
+
public boolean isMaxFixed() {
return (state & NST_MAX_FIXED) != 0;
}
-
+
public void setMaxFixed() {
state |= NST_MAX_FIXED;
}
-
+
public void clearMaxFixed() {
- state &= ~NST_MAX_FIXED;
+ state &= ~NST_MAX_FIXED;
}
-
+
public boolean isCLenFixed() {
return (state & NST_CLEN_FIXED) != 0;
}
-
+
public void setCLenFixed() {
state |= NST_CLEN_FIXED;
}
-
+
public void clearCLenFixed() {
- state &= ~NST_CLEN_FIXED;
+ state &= ~NST_CLEN_FIXED;
}
-
+
public boolean isMark1() {
return (state & NST_MARK1) != 0;
}
-
+
public void setMark1() {
state |= NST_MARK1;
}
-
+
public void clearMark1() {
- state &= ~NST_MARK1;
+ state &= ~NST_MARK1;
}
-
+
public boolean isMark2() {
return (state & NST_MARK2) != 0;
}
-
+
public void setMark2() {
state |= NST_MARK2;
}
-
+
public void clearMark2() {
- state &= ~NST_MARK2;
+ state &= ~NST_MARK2;
}
-
+
public boolean isMemBackrefed() {
return (state & NST_MEM_BACKREFED) != 0;
}
-
+
public void setMemBackrefed() {
state |= NST_MEM_BACKREFED;
}
-
+
public void clearMemBackrefed() {
- state &= ~NST_MEM_BACKREFED;
+ state &= ~NST_MEM_BACKREFED;
}
-
+
public boolean isStopBtSimpleRepeat() {
return (state & NST_STOP_BT_SIMPLE_REPEAT) != 0;
}
-
+
public void setStopBtSimpleRepeat() {
state |= NST_STOP_BT_SIMPLE_REPEAT;
}
-
+
public void clearStopBtSimpleRepeat() {
- state &= ~NST_STOP_BT_SIMPLE_REPEAT;
+ state &= ~NST_STOP_BT_SIMPLE_REPEAT;
}
public boolean isRecursion() {
return (state & NST_RECURSION) != 0;
}
-
+
public void setRecursion() {
state |= NST_RECURSION;
}
-
+
public void clearRecursion() {
- state &= ~NST_RECURSION;
+ state &= ~NST_RECURSION;
}
-
+
public boolean isCalled() {
return (state & NST_CALLED) != 0;
}
-
+
public void setCalled() {
state |= NST_CALLED;
}
-
- public void clearCAlled() {
- state &= ~NST_CALLED;
+
+ public void clearCAlled() {
+ state &= ~NST_CALLED;
}
-
+
public boolean isAddrFixed() {
return (state & NST_ADDR_FIXED) != 0;
}
-
+
public void setAddrFixed() {
state |= NST_ADDR_FIXED;
}
-
- public void clearAddrFixed() {
- state &= ~NST_ADDR_FIXED;
+
+ public void clearAddrFixed() {
+ state &= ~NST_ADDR_FIXED;
}
-
+
public boolean isNamedGroup() {
return (state & NST_NAMED_GROUP) != 0;
}
-
+
public void setNamedGroup() {
state |= NST_NAMED_GROUP;
}
-
- public void clearNamedGroup() {
- state &= ~NST_NAMED_GROUP;
+
+ public void clearNamedGroup() {
+ state &= ~NST_NAMED_GROUP;
}
public boolean isNameRef() {
return (state & NST_NAME_REF) != 0;
}
-
+
public void setNameRef() {
state |= NST_NAME_REF;
}
-
- public void clearNameRef() {
- state &= ~NST_NAME_REF;
+
+ public void clearNameRef() {
+ state &= ~NST_NAME_REF;
}
-
+
public boolean isInRepeat() {
return (state & NST_IN_REPEAT) != 0;
}
-
+
public void setInRepeat() {
state |= NST_IN_REPEAT;
}
-
- public void clearInRepeat() {
- state &= ~NST_IN_REPEAT;
+
+ public void clearInRepeat() {
+ state &= ~NST_IN_REPEAT;
}
-
+
public boolean isNestLevel() {
return (state & NST_NEST_LEVEL) != 0;
}
-
+
public void setNestLevel() {
state |= NST_NEST_LEVEL;
}
-
- public void clearNestLevel() {
- state &= ~NST_NEST_LEVEL;
+
+ public void clearNestLevel() {
+ state &= ~NST_NEST_LEVEL;
}
-
+
public boolean isByNumber() {
return (state & NST_BY_NUMBER) != 0;
}
-
+
public void setByNumber() {
state |= NST_BY_NUMBER;
}
-
- public void clearByNumber() {
- state &= ~NST_BY_NUMBER;
+
+ public void clearByNumber() {
+ state &= ~NST_BY_NUMBER;
}
-
+
}
diff --git a/src/org/joni/ast/StringNode.java b/src/org/joni/ast/StringNode.java
index bf8217e..1b419a3 100644
--- a/src/org/joni/ast/StringNode.java
+++ b/src/org/joni/ast/StringNode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.ast;
@@ -23,16 +23,16 @@ import org.jcodings.Encoding;
import org.joni.constants.StringType;
public final class StringNode extends Node implements StringType {
-
+
private static final int NODE_STR_MARGIN = 16;
private static final int NODE_STR_BUF_SIZE = 24;
-
+
public byte[]bytes;
public int p;
public int end;
-
+
int flag;
-
+
public StringNode() {
this.bytes = new byte[NODE_STR_BUF_SIZE];
}
@@ -43,7 +43,7 @@ public final class StringNode extends Node implements StringType {
this.end = end;
setShared();
}
-
+
public StringNode(byte c) {
this();
bytes[end++] = c;
@@ -60,7 +60,7 @@ public final class StringNode extends Node implements StringType {
bytes = tmp;
}
}
-
+
/* COW and/or ensure there is ahead bytes available in node's buffer
*/
private void modifyEnsure(int ahead) {
@@ -80,17 +80,17 @@ public final class StringNode extends Node implements StringType {
}
}
}
-
+
@Override
public int getType() {
return STR;
}
-
+
@Override
public String getName() {
return "String";
- }
-
+ }
+
@Override
public String toString(int level) {
StringBuilder value = new StringBuilder();
@@ -108,11 +108,11 @@ public final class StringNode extends Node implements StringType {
public int length() {
return end - p;
}
-
+
public int length(Encoding enc) {
return enc.strLength(bytes, p, end);
}
-
+
public StringNode splitLastChar(Encoding enc) {
StringNode n = null;
@@ -126,7 +126,7 @@ public final class StringNode extends Node implements StringType {
}
return n;
}
-
+
public boolean canBeSplit(Encoding enc) {
if (end > p) {
return enc.length(bytes, p, end) < (end - p);
@@ -140,19 +140,19 @@ public final class StringNode extends Node implements StringType {
this.end = end;
setShared();
}
-
+
public void cat(byte[]cat, int catP, int catEnd) {
int len = catEnd - catP;
modifyEnsure(len);
System.arraycopy(cat, catP, bytes, end, len);
end += len;
}
-
+
public void cat(byte c) {
modifyEnsure(1);
bytes[end++] = c;
}
-
+
public void clear() {
if (bytes.length > NODE_STR_BUF_SIZE) bytes = new byte[NODE_STR_BUF_SIZE];
flag = 0;
@@ -162,47 +162,47 @@ public final class StringNode extends Node implements StringType {
public void setRaw() {
flag |= NSTR_RAW;
}
-
+
public void clearRaw() {
flag &= ~NSTR_RAW;
}
-
+
public boolean isRaw() {
return (flag & NSTR_RAW) != 0;
}
-
+
public void setAmbig() {
flag |= NSTR_AMBIG;
}
-
+
public void clearAmbig() {
flag &= ~NSTR_AMBIG;
}
-
+
public boolean isAmbig() {
return (flag & NSTR_AMBIG) != 0;
}
-
+
public void setDontGetOptInfo() {
flag |= NSTR_DONT_GET_OPT_INFO;
}
-
+
public void clearDontGetOptInfo() {
flag &= ~NSTR_DONT_GET_OPT_INFO;
}
-
+
public boolean isDontGetOptInfo() {
return (flag & NSTR_DONT_GET_OPT_INFO) != 0;
}
-
+
public void setShared() {
flag |= NSTR_SHARED;
}
-
+
public void clearShared() {
flag &= ~NSTR_SHARED;
}
-
+
public boolean isShared() {
return (flag & NSTR_SHARED) != 0;
}
diff --git a/src/org/joni/bench/AbstractBench.java b/src/org/joni/bench/AbstractBench.java
index 5e058f9..7abcb51 100644
--- a/src/org/joni/bench/AbstractBench.java
+++ b/src/org/joni/bench/AbstractBench.java
@@ -9,7 +9,7 @@ public abstract class AbstractBench {
protected void bench(String _reg, String _str, int warmup, int times) throws Exception {
byte[] reg = _reg.getBytes();
byte[] str = _str.getBytes();
-
+
Regex p = new Regex(reg,0,reg.length,Option.DEFAULT,ASCIIEncoding.INSTANCE,Syntax.DEFAULT);
System.err.println("::: /" + _reg + "/ =~ \"" + _str + "\", " + warmup + " * " + times + " times");
@@ -27,7 +27,7 @@ public abstract class AbstractBench {
protected void benchBestOf(String _reg, String _str, int warmup, int times) throws Exception {
byte[] reg = _reg.getBytes();
byte[] str = _str.getBytes();
-
+
Regex p = new Regex(reg,0,reg.length,Option.DEFAULT,ASCIIEncoding.INSTANCE,Syntax.DEFAULT);
System.err.println("::: /" + _reg + "/ =~ \"" + _str + "\", " + warmup + " * " + times + " times");
diff --git a/src/org/joni/constants/AnchorType.java b/src/org/joni/constants/AnchorType.java
index 144dd1d..5d7336d 100644
--- a/src/org/joni/constants/AnchorType.java
+++ b/src/org/joni/constants/AnchorType.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
@@ -38,21 +38,21 @@ public interface AnchorType {
final int ANYCHAR_STAR = (1<<14); /* ".*" optimize info */
final int ANYCHAR_STAR_ML = (1<<15); /* ".*" optimize info (multi-line) */
-
+
final int ANYCHAR_STAR_MASK = (ANYCHAR_STAR | ANYCHAR_STAR_ML);
final int END_BUF_MASK = (END_BUF | SEMI_END_BUF);
-
+
final int ALLOWED_IN_LB = ( LOOK_BEHIND |
BEGIN_LINE |
END_LINE |
BEGIN_BUF |
BEGIN_POSITION );
-
+
final int ALLOWED_IN_LB_NOT = ( LOOK_BEHIND |
LOOK_BEHIND_NOT |
BEGIN_LINE |
END_LINE |
BEGIN_BUF |
- BEGIN_POSITION );
-
+ BEGIN_POSITION );
+
}
diff --git a/src/org/joni/constants/Arguments.java b/src/org/joni/constants/Arguments.java
index 1aacfdd..6098239 100644
--- a/src/org/joni/constants/Arguments.java
+++ b/src/org/joni/constants/Arguments.java
@@ -1,27 +1,27 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
public interface Arguments {
- final int SPECIAL = -1;
- final int NON = 0;
+ final int SPECIAL = -1;
+ final int NON = 0;
final int RELADDR = 1;
final int ABSADDR = 2;
final int LENGTH = 3;
diff --git a/src/org/joni/constants/AsmConstants.java b/src/org/joni/constants/AsmConstants.java
index 6329780..2e28958 100644
--- a/src/org/joni/constants/AsmConstants.java
+++ b/src/org/joni/constants/AsmConstants.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/CCSTATE.java b/src/org/joni/constants/CCSTATE.java
index 23baa87..669b821 100644
--- a/src/org/joni/constants/CCSTATE.java
+++ b/src/org/joni/constants/CCSTATE.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/CCVALTYPE.java b/src/org/joni/constants/CCVALTYPE.java
index b531e30..b2bcb30 100644
--- a/src/org/joni/constants/CCVALTYPE.java
+++ b/src/org/joni/constants/CCVALTYPE.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/EncloseType.java b/src/org/joni/constants/EncloseType.java
index 553b5dc..125af0c 100644
--- a/src/org/joni/constants/EncloseType.java
+++ b/src/org/joni/constants/EncloseType.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
@@ -23,7 +23,7 @@ public interface EncloseType {
final int MEMORY = 1<<0;
final int OPTION = 1<<1;
final int STOP_BACKTRACK = 1<<2;
-
+
final int ALLOWED_IN_LB = MEMORY;
final int ALLOWED_IN_LB_NOT = 0;
}
diff --git a/src/org/joni/constants/MetaChar.java b/src/org/joni/constants/MetaChar.java
index 3589aff..37f94a7 100644
--- a/src/org/joni/constants/MetaChar.java
+++ b/src/org/joni/constants/MetaChar.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
@@ -23,9 +23,9 @@ public interface MetaChar {
final int ESCAPE = 0;
final int ANYCHAR = 1;
final int ANYTIME = 2;
- final int ZERO_OR_ONE_TIME = 3;
+ final int ZERO_OR_ONE_TIME = 3;
final int ONE_OR_MORE_TIME = 4;
final int ANYCHAR_ANYTIME = 5;
-
+
final int INEFFECTIVE_META_CHAR = 0;
}
diff --git a/src/org/joni/constants/NodeStatus.java b/src/org/joni/constants/NodeStatus.java
index 901d47d..e7a4754 100644
--- a/src/org/joni/constants/NodeStatus.java
+++ b/src/org/joni/constants/NodeStatus.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/NodeType.java b/src/org/joni/constants/NodeType.java
index dccece2..4e37d67 100644
--- a/src/org/joni/constants/NodeType.java
+++ b/src/org/joni/constants/NodeType.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
@@ -32,7 +32,7 @@ public interface NodeType {
final int LIST = 8;
final int ALT = 9;
final int CALL = 10;
-
+
final int BIT_STR = 1 << STR;
final int BIT_CCLASS = 1 << CCLASS;
final int BIT_CTYPE = 1 << CTYPE;
@@ -44,9 +44,9 @@ public interface NodeType {
final int BIT_LIST = 1 << LIST;
final int BIT_ALT = 1 << ALT;
final int BIT_CALL = 1 << CALL;
-
+
/* allowed node types in look-behind */
- final int ALLOWED_IN_LB = ( BIT_LIST |
+ final int ALLOWED_IN_LB = ( BIT_LIST |
BIT_ALT |
BIT_STR |
BIT_CCLASS |
@@ -56,11 +56,11 @@ public interface NodeType {
BIT_ENCLOSE |
BIT_QTFR |
BIT_CALL );
-
+
final int SIMPLE = ( BIT_STR |
BIT_CCLASS |
BIT_CTYPE |
BIT_CANY |
BIT_BREF);
-
+
}
diff --git a/src/org/joni/constants/OPCode.java b/src/org/joni/constants/OPCode.java
index 8e06f88..05d1f8b 100644
--- a/src/org/joni/constants/OPCode.java
+++ b/src/org/joni/constants/OPCode.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
@@ -43,7 +43,7 @@ public interface OPCode {
final int CCLASS = 16;
final int CCLASS_MB = 17;
- final int CCLASS_MIX = 18;
+ final int CCLASS_MIX = 18;
final int CCLASS_NOT = 19;
final int CCLASS_MB_NOT = 20;
final int CCLASS_MIX_NOT = 21;
@@ -91,14 +91,14 @@ public interface OPCode {
final int POP = 57;
final int PUSH_OR_JUMP_EXACT1 = 58; /* if match exact then push, else jump. */
final int PUSH_IF_PEEK_NEXT = 59; /* if match exact then push, else none. */
-
+
final int REPEAT = 60; /* {n,m} */
final int REPEAT_NG = 61; /* {n,m}? (non greedy) */
final int REPEAT_INC = 62;
final int REPEAT_INC_NG = 63; /* non greedy */
final int REPEAT_INC_SG = 64; /* search and get in stack */
final int REPEAT_INC_NG_SG = 65; /* search and get in stack (non greedy) */
-
+
final int NULL_CHECK_START = 66; /* null loop checker start */
final int NULL_CHECK_END = 67; /* null loop checker end */
final int NULL_CHECK_END_MEMST = 68; /* null loop checker end (with capture status) */
@@ -126,7 +126,7 @@ public interface OPCode {
/* no need: IS_DYNAMIC_OPTION() == 0 */
final int SET_OPTION_PUSH = 86; /* set option and push recover option */
final int SET_OPTION = 87; /* set option */
-
+
// single byte versions
final int ANYCHAR_SB = 88; /* "." */
final int ANYCHAR_ML_SB = 89; /* "." multi-line */
@@ -145,12 +145,12 @@ public interface OPCode {
final int NOT_WORD_BOUND_SB = 101;
final int WORD_BEGIN_SB = 102;
final int WORD_END_SB = 103;
-
+
final int LOOK_BEHIND_SB = 104;
-
+
final int EXACT1_IC_SB = 105; /* single byte, N = 1, ignore case */
final int EXACTN_IC_SB = 106; /* single byte, ignore case */
-
+
public final String OpCodeNames[] = Config.DEBUG_COMPILE ? new String[] {
"finish", /*OP_FINISH*/
@@ -241,7 +241,7 @@ public interface OPCode {
"state-check-anychar-ml*", /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
"set-option-push", /*OP_SET_OPTION_PUSH*/
"set-option", /*OP_SET_OPTION*/
-
+
// single byte versions
"anychar-sb", /*OP_ANYCHAR*/
"anychar-ml-sb", /*OP_ANYCHAR_ML*/
@@ -254,21 +254,21 @@ public interface OPCode {
"cclass-sb", /*OP_CCLASS*/
"cclass-not-sb", /*OP_CCLASS_NOT*/
-
+
"word-sb", /*OP_WORD*/
"not-word-sb", /*OP_NOT_WORD*/
"word-bound-sb", /*OP_WORD_BOUND*/
"not-word-bound-sb", /*OP_NOT_WORD_BOUND*/
"word-begin-sb", /*OP_WORD_BEGIN*/
"word-end-sb", /*OP_WORD_END*/
-
+
"look-behind-sb", /*OP_LOOK_BEHIND*/
-
+
"exact1-ic-sb", /*OP_EXACT1_IC*/
"exactn-ic-sb", /*OP_EXACTN_IC*/
} : null;
-
+
public final int OpCodeArgTypes[] = Config.DEBUG_COMPILE ? new int[] {
Arguments.NON, /*OP_FINISH*/
Arguments.NON, /*OP_END*/
@@ -358,7 +358,7 @@ public interface OPCode {
Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
Arguments.OPTION, /*OP_SET_OPTION_PUSH*/
Arguments.OPTION, /*OP_SET_OPTION*/
-
+
// single byte versions
Arguments.NON, /*OP_ANYCHAR*/
Arguments.NON, /*OP_ANYCHAR_ML*/
@@ -380,7 +380,7 @@ public interface OPCode {
Arguments.NON, /*OP_WORD_END*/
Arguments.SPECIAL, /*OP_LOOK_BEHIND*/
-
+
Arguments.SPECIAL, /*OP_EXACT1_IC*/
Arguments.SPECIAL, /*OP_EXACTN_IC*/
} : null;
diff --git a/src/org/joni/constants/OPSize.java b/src/org/joni/constants/OPSize.java
index dcd419b..05efbed 100644
--- a/src/org/joni/constants/OPSize.java
+++ b/src/org/joni/constants/OPSize.java
@@ -1,26 +1,26 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
public interface OPSize {
-
+
// this might be helpful for potential byte[] migration
final int OPCODE = 1;
final int RELADDR = 1;
@@ -32,9 +32,9 @@ public interface OPSize {
final int OPTION = 1;
final int CODE_POINT = 1;
final int POINTER = 1;
-
+
/* op-code + arg size */
-
+
final int ANYCHAR_STAR = OPCODE;
final int ANYCHAR_STAR_PEEK_NEXT = (OPCODE + 1);
final int JUMP = (OPCODE + RELADDR);
diff --git a/src/org/joni/constants/Reduce.java b/src/org/joni/constants/Reduce.java
index e62de7f..07b5e18 100644
--- a/src/org/joni/constants/Reduce.java
+++ b/src/org/joni/constants/Reduce.java
@@ -1,23 +1,24 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
+
import static org.joni.constants.Reduce.ReduceType.A;
import static org.joni.constants.Reduce.ReduceType.AQ;
import static org.joni.constants.Reduce.ReduceType.ASIS;
@@ -27,7 +28,7 @@ import static org.joni.constants.Reduce.ReduceType.P_QQ;
import static org.joni.constants.Reduce.ReduceType.QQ;
public interface Reduce {
-
+
enum ReduceType {
ASIS, /* as is */
DEL, /* delete parent */
@@ -44,17 +45,17 @@ public interface Reduce {
{A, A, DEL, ASIS, P_QQ, DEL}, /* '+' */
{DEL, AQ, AQ, DEL, AQ, AQ}, /* '??' */
{DEL, DEL, DEL, DEL, DEL, DEL}, /* '*?' */
- {ASIS, PQ_Q, DEL, AQ, AQ, DEL} /* '+?' */
+ {ASIS, PQ_Q, DEL, AQ, AQ, DEL} /* '+?' */
};
-
-
+
+
final String PopularQStr[] = new String[] {
"?", "*", "+", "??", "*?", "+?"
};
-
+
String ReduceQStr[]= new String[] {
"", "", "*", "*?", "??", "+ and ??", "+? and ?"
- };
-
+ };
+
}
diff --git a/src/org/joni/constants/RegexState.java b/src/org/joni/constants/RegexState.java
index acc6d84..72dd3ff 100644
--- a/src/org/joni/constants/RegexState.java
+++ b/src/org/joni/constants/RegexState.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/StackPopLevel.java b/src/org/joni/constants/StackPopLevel.java
index f1f93bd..f5be8f4 100644
--- a/src/org/joni/constants/StackPopLevel.java
+++ b/src/org/joni/constants/StackPopLevel.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/StackType.java b/src/org/joni/constants/StackType.java
index 34ea41f..4a6527c 100644
--- a/src/org/joni/constants/StackType.java
+++ b/src/org/joni/constants/StackType.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/StringType.java b/src/org/joni/constants/StringType.java
index 46972e4..e1a6239 100644
--- a/src/org/joni/constants/StringType.java
+++ b/src/org/joni/constants/StringType.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/SyntaxProperties.java b/src/org/joni/constants/SyntaxProperties.java
index 3fd5b4c..61f2269 100644
--- a/src/org/joni/constants/SyntaxProperties.java
+++ b/src/org/joni/constants/SyntaxProperties.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
@@ -96,14 +96,14 @@ public interface SyntaxProperties {
/* syntax (behavior); warning */
final int WARN_CC_OP_NOT_ESCAPED = (1<<24); /* [,-,] */
final int WARN_REDUNDANT_NESTED_REPEAT = (1<<25); /* (?:a*);+ */
-
+
final int POSIX_COMMON_OP =
OP_DOT_ANYCHAR | OP_POSIX_BRACKET |
OP_DECIMAL_BACKREF |
OP_BRACKET_CC | OP_ASTERISK_ZERO_INF |
OP_LINE_ANCHOR |
OP_ESC_CONTROL_CHARS;
-
+
final int GNU_REGEX_OP =
OP_DOT_ANYCHAR | OP_BRACKET_CC |
OP_POSIX_BRACKET | OP_DECIMAL_BACKREF |
@@ -116,7 +116,7 @@ public interface SyntaxProperties {
OP_ESC_B_WORD_BOUND | OP_ESC_LTGT_WORD_BEGIN_END |
OP_ESC_S_WHITE_SPACE | OP_ESC_D_DIGIT |
OP_LINE_ANCHOR;
-
+
final int GNU_REGEX_BV =
CONTEXT_INDEP_ANCHORS | CONTEXT_INDEP_REPEAT_OPS |
CONTEXT_INVALID_REPEAT_OPS | ALLOW_INVALID_INTERVAL |
diff --git a/src/org/joni/constants/TargetInfo.java b/src/org/joni/constants/TargetInfo.java
index 3fdbe5a..ffec783 100644
--- a/src/org/joni/constants/TargetInfo.java
+++ b/src/org/joni/constants/TargetInfo.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/TokenType.java b/src/org/joni/constants/TokenType.java
index 9ea159d..59aa094 100644
--- a/src/org/joni/constants/TokenType.java
+++ b/src/org/joni/constants/TokenType.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/constants/Traverse.java b/src/org/joni/constants/Traverse.java
index 1c08ea5..035e9f7 100644
--- a/src/org/joni/constants/Traverse.java
+++ b/src/org/joni/constants/Traverse.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.constants;
diff --git a/src/org/joni/exception/ErrorMessages.java b/src/org/joni/exception/ErrorMessages.java
index d1c1279..f490713 100644
--- a/src/org/joni/exception/ErrorMessages.java
+++ b/src/org/joni/exception/ErrorMessages.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.exception;
@@ -24,10 +24,10 @@ import org.joni.Config;
public interface ErrorMessages extends org.jcodings.exception.ErrorMessages {
final String MISMATCH = "mismatch";
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_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)";
@@ -38,7 +38,7 @@ public interface ErrorMessages extends org.jcodings.exception.ErrorMessages {
/* general error */
final String ERR_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";
@@ -62,7 +62,7 @@ public interface ErrorMessages extends org.jcodings.exception.ErrorMessages {
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}";
-
+
/* 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";
diff --git a/src/org/joni/exception/InternalException.java b/src/org/joni/exception/InternalException.java
index 959f44f..b41e0aa 100644
--- a/src/org/joni/exception/InternalException.java
+++ b/src/org/joni/exception/InternalException.java
@@ -1,27 +1,27 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.exception;
public class InternalException extends JOniException{
private static final long serialVersionUID = -3871816465397927992L;
-
+
public InternalException(String message) {
super(message);
}
diff --git a/src/org/joni/exception/JOniException.java b/src/org/joni/exception/JOniException.java
index f5d728c..c2c5d47 100644
--- a/src/org/joni/exception/JOniException.java
+++ b/src/org/joni/exception/JOniException.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.exception;
diff --git a/src/org/joni/exception/SyntaxException.java b/src/org/joni/exception/SyntaxException.java
index 7b00d1c..7e50cf5 100644
--- a/src/org/joni/exception/SyntaxException.java
+++ b/src/org/joni/exception/SyntaxException.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.exception;
diff --git a/src/org/joni/exception/ValueException.java b/src/org/joni/exception/ValueException.java
index b07ac42..790f354 100644
--- a/src/org/joni/exception/ValueException.java
+++ b/src/org/joni/exception/ValueException.java
@@ -1,35 +1,35 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.exception;
public class ValueException extends SyntaxException{
private static final long serialVersionUID = -196013852479929134L;
-
+
public ValueException(String message) {
super(message);
}
-
+
public ValueException(String message, String str) {
super(message.replaceAll("%n", str));
}
-
+
public ValueException(String message, byte[]bytes, int p, int end) {
this(message, new String(bytes, p, end - p));
}
diff --git a/test/org/joni/test/TestA.java b/test/org/joni/test/TestA.java
index bc3ebf5..3d477a0 100644
--- a/test/org/joni/test/TestA.java
+++ b/test/org/joni/test/TestA.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.test;
@@ -33,14 +33,14 @@ public class TestA extends Test {
public Encoding encoding() {
return ASCIIEncoding.INSTANCE;
}
-
+
public String testEncoding() {
return "iso-8859-2";
}
public Syntax syntax() {
return Syntax.DEFAULT;
- }
+ }
public void test() {
x2s("", "", 0, 0);
@@ -451,11 +451,11 @@ public class TestA extends Test {
x2s("x((.)*)*x(?i:\\1)\\Z", "0x1x2x1X2", 1, 9);
x2s("(?:()|()|()|()|()|())*\\2\\5", "", 0, 0);
x2s("(?:()|()|()|(x)|()|())*\\2b\\5", "b", 0, 1);
-
+
x3s("\\A(?<a>|.|(?:(?<b>.)\\g<a>\\k<b+0>))\\z", "reer", 0, 4, 1);
x3s("(?-i:\\g<name>)(?i:(?<name>a)){0}", "A", 0, 1, 1);
-
- String pat =
+
+ String pat =
"(?<element> \\g<stag> \\g<content>* \\g<etag> ){0}" +
"(?<stag> < \\g<name> \\s* > ){0}" +
"(?<name> [a-zA-Z_:]+ ){0}" +
@@ -464,7 +464,7 @@ public class TestA extends Test {
"\\g<element>";
String str = "<foo>f<bar>bbb</bar>f</foo>";
-
+
x3s(pat, str, 0, 27, 0, Option.EXTEND);
x3s(pat, str, 0, 27, 1, Option.EXTEND);
x3s(pat, str, 6, 11, 2, Option.EXTEND);
@@ -474,7 +474,7 @@ public class TestA extends Test {
x2s("(a)b\\k<1>", "aba", 0, 3);
}
-
+
public static void main(String[] args) throws Throwable{
new TestA().run();
}
diff --git a/test/org/joni/test/TestCornerCases.java b/test/org/joni/test/TestCornerCases.java
index b2b8377..717766d 100644
--- a/test/org/joni/test/TestCornerCases.java
+++ b/test/org/joni/test/TestCornerCases.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.test;
@@ -35,14 +35,14 @@ public class TestCornerCases extends Test {
public Encoding encoding() {
return ASCIIEncoding.INSTANCE;
}
-
+
public String testEncoding() {
return "cp1250";
}
public Syntax syntax() {
return Syntax.DEFAULT;
- }
+ }
public void test() {
byte[] reg = "l.".getBytes();
@@ -55,7 +55,7 @@ public class TestCornerCases extends Test {
nfail++;
}
}
-
+
public static void main(String[] args) throws Throwable{
new TestCornerCases().run();
}
diff --git a/test/org/joni/test/TestCrnl.java b/test/org/joni/test/TestCrnl.java
index a8ef6a6..9a8c65c 100644
--- a/test/org/joni/test/TestCrnl.java
+++ b/test/org/joni/test/TestCrnl.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.test;
@@ -34,14 +34,14 @@ public class TestCrnl extends Test {
public Encoding encoding() {
return ASCIIEncoding.INSTANCE;
}
-
+
public String testEncoding() {
return "ascii";
}
public Syntax syntax() {
return Syntax.DEFAULT;
- }
+ }
public void test() {
x2s("", "\r\n", 0, 0);
@@ -76,10 +76,10 @@ public class TestCrnl extends Test {
x2s("(?=a\\Z).", "a\r\n", 0, 1);
ns("(?=a\\Z).", "a\r");
x2s("(?!a\\Z)..", "a\r", 0, 2);
-
+
if (nfail > 0 || nerror > 0) Config.err.println("make sure to enable USE_CRNL_AS_LINE_TERMINATOR");
}
-
+
public static void main(String[] args) throws Throwable{
new TestCrnl().run();
}
diff --git a/test/org/joni/test/TestJoni.java b/test/org/joni/test/TestJoni.java
index e4505f3..a94ed56 100644
--- a/test/org/joni/test/TestJoni.java
+++ b/test/org/joni/test/TestJoni.java
@@ -1,3 +1,22 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
package org.joni.test;
import junit.framework.TestCase;
diff --git a/test/org/joni/test/TestLookBehind.java b/test/org/joni/test/TestLookBehind.java
index 83ec6fe..9ae4379 100644
--- a/test/org/joni/test/TestLookBehind.java
+++ b/test/org/joni/test/TestLookBehind.java
@@ -1,3 +1,22 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
package org.joni.test;
import org.jcodings.Encoding;
diff --git a/test/org/joni/test/TestNSU8.java b/test/org/joni/test/TestNSU8.java
index 54dd902..ec4ed2d 100644
--- a/test/org/joni/test/TestNSU8.java
+++ b/test/org/joni/test/TestNSU8.java
@@ -1,20 +1,20 @@
/*
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.joni.test;
@@ -29,19 +29,19 @@ public class TestNSU8 extends Test {
public int option() {
return Option.DEFAULT;
}
-
+
public Encoding encoding() {
return NonStrictUTF8Encoding.INSTANCE;
}
-
+
public String testEncoding() {
return "utf-8";
}
-
+
public Syntax syntax() {
return Syntax.DEFAULT;
}
-
+
public void test() {
xx("([^\\[\\]]+)".getBytes(), new byte[]{(byte)240, (byte)32, (byte)32, (byte)32, (byte)32}, 0, 5, 1, false);
xx("([^\\[\\]]+)".getBytes(), new byte[]{(byte)240, (byte)32, (byte)32, (byte)32}, 0, 4, 1, false);
@@ -58,7 +58,7 @@ public class TestNSU8 extends Test {
xx("([^\\[\\]]+)".getBytes(), new byte[]{(byte)192, (byte)32}, 0, 2, 1, false);
xx("([^\\[\\]]+)".getBytes(), new byte[]{(byte)192}, 0, 1, 1, false);
}
-
+
public static void main(String[] args) throws Throwable {
new TestNSU8().run();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git
More information about the pkg-java-commits
mailing list