[jruby-joni] 84/279: Fix unused option
Hideki Yamane
henrich at moszumanska.debian.org
Mon Nov 16 11:26:55 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 f820a9ef87571d04b99cb806a34732b14afd8878
Author: Marcin Mielzynski <lopx at gazeta.pl>
Date: Tue Feb 7 19:47:04 2012 +0100
Fix unused option
---
src/org/joni/Regex.java | 110 ++++++++++++++++++++++++------------------------
1 file changed, 55 insertions(+), 55 deletions(-)
diff --git a/src/org/joni/Regex.java b/src/org/joni/Regex.java
index 258920a..bebda18 100644
--- a/src/org/joni/Regex.java
+++ b/src/org/joni/Regex.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;
@@ -38,7 +38,7 @@ import org.joni.exception.InternalException;
import org.joni.exception.ValueException;
public final class Regex implements RegexState {
-
+
int[] code; /* compiled pattern */
int codeLength;
boolean stackNeeded;
@@ -69,9 +69,9 @@ public final class Regex implements RegexState {
Object userObject;
//final Syntax syntax;
final int caseFoldFlag;
-
+
BytesHash<NameEntry> nameTable; // named entries
-
+
/* optimization info (string search, char-map and anchors) */
SearchAlgorithm searchAlgorithm; /* optimize flag */
int thresholdLength; /* search str-length for apply optimize */
@@ -79,49 +79,49 @@ public final class Regex implements RegexState {
int anchorDmin; /* (SEMI_)END_BUF anchor distance */
int anchorDmax; /* (SEMI_)END_BUF anchor distance */
int subAnchor; /* start-anchor for exact or map */
-
+
byte[]exact;
int exactP;
int exactEnd;
-
+
byte[]map; /* used as BM skip or char-map */
int[]intMap; /* BM skip for exact_len > 255 */
int[]intMapBackward; /* BM skip for backward search */
int dMin; /* min-distance of exact or map */
int dMax; /* max-distance of exact or map */
-
+
public Regex(CharSequence cs) {
this(cs.toString());
}
-
+
public Regex(CharSequence cs, Encoding enc) {
this(cs.toString(), enc);
}
-
+
public Regex(String str) {
this(str.getBytes(), 0, str.length(), 0, UTF8Encoding.INSTANCE);
}
-
+
public Regex(String str, Encoding enc) {
this(str.getBytes(), 0, str.length(), 0, enc);
}
-
+
public Regex(byte[] bytes) {
this(bytes, 0, bytes.length, 0, ASCIIEncoding.INSTANCE);
}
-
+
public Regex(byte[] bytes, int p, int end) {
this(bytes, p, end, 0, ASCIIEncoding.INSTANCE);
}
-
+
public Regex(byte[] bytes, int p, int end, int option) {
- this(bytes, p, end, 0, ASCIIEncoding.INSTANCE);
+ this(bytes, p, end, option, ASCIIEncoding.INSTANCE);
}
public Regex(byte[]bytes, int p, int end, int option, Encoding enc) {
this(bytes, p, end, option, enc, Syntax.RUBY, WarnCallback.DEFAULT);
}
-
+
// onig_new
public Regex(byte[]bytes, int p, int end, int option, Encoding enc, Syntax syntax) {
this(bytes, p, end, option, Config.ENC_CASE_FOLD_DEFAULT, enc, syntax, WarnCallback.DEFAULT);
@@ -130,7 +130,7 @@ public final class Regex implements RegexState {
public Regex(byte[]bytes, int p, int end, int option, Encoding enc, WarnCallback warnings) {
this(bytes, p, end, option, enc, Syntax.RUBY, warnings);
}
-
+
// onig_new
public Regex(byte[]bytes, int p, int end, int option, Encoding enc, Syntax syntax, WarnCallback warnings) {
this(bytes, p, end, option, Config.ENC_CASE_FOLD_DEFAULT, enc, syntax, warnings);
@@ -138,19 +138,19 @@ public final class Regex implements RegexState {
// onig_alloc_init
public Regex(byte[]bytes, int p, int end, int option, int caseFoldFlag, Encoding enc, Syntax syntax, WarnCallback warnings) {
-
+
if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
(Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
}
-
+
if ((option & Option.NEGATE_SINGLELINE) != 0) {
option |= syntax.options;
option &= ~Option.SINGLELINE;
} else {
option |= syntax.options;
}
-
+
this.enc = enc;
this.options = option;
this.caseFoldFlag = caseFoldFlag;
@@ -160,19 +160,19 @@ public final class Regex implements RegexState {
this.warnings = null;
}
-
+
public Matcher matcher(byte[]bytes) {
return matcher(bytes, 0, bytes.length);
}
-
+
public Matcher matcher(byte[]bytes, int p, int end) {
return factory.create(this, bytes, p, end);
}
-
+
public int numberOfCaptures() {
return numMem;
}
-
+
public int numberOfCaptureHistories() {
if (Config.USE_CAPTURE_HISTORY) {
int n = 0;
@@ -184,10 +184,10 @@ public final class Regex implements RegexState {
return 0;
}
}
-
+
String nameTableToString() {
StringBuilder sb = new StringBuilder();
-
+
if (nameTable != null) {
sb.append("name table\n");
for (NameEntry ne : nameTable) {
@@ -197,7 +197,7 @@ public final class Regex implements RegexState {
}
return sb.toString();
}
-
+
NameEntry nameFind(byte[]name, int nameP, int nameEnd) {
if (nameTable != null) return nameTable.get(name, nameP, nameEnd);
return null;
@@ -215,7 +215,7 @@ public final class Regex implements RegexState {
}
}
}
- }
+ }
public int numberOfNames() {
return nameTable == null ? 0 : nameTable.size();
@@ -230,7 +230,7 @@ public final class Regex implements RegexState {
} else {
e = nameFind(name, nameP, nameEnd);
}
-
+
if (e == null) {
// dup the name here as oni does ?, what for ? (it has to manage it, we don't)
e = new NameEntry(name, nameP, nameEnd);
@@ -261,7 +261,7 @@ public final class Regex implements RegexState {
for (int i = e.backNum - 1; i >= 0; i--) {
if (region.beg[e.backRefs[i]] != Region.REGION_NOTPOS) return e.backRefs[i];
}
- }
+ }
return e.backRefs[e.backNum - 1];
}
}
@@ -272,7 +272,7 @@ public final class Regex implements RegexState {
public boolean noNameGroupIsActive(Syntax syntax) {
if (isDontCaptureGroup(options)) return false;
-
+
if (Config.USE_NAMED_GROUP) {
if (numberOfNames() > 0 && syntax.captureOnlyNamedGroup() && !isCaptureGroup(options)) return false;
}
@@ -294,7 +294,7 @@ public final class Regex implements RegexState {
for (int i=0; i<len-1; i++) map[bytes[p + i] & 0xff] = (byte)(len - 1 -i); // oxff ??
} else {
if (intMap == null) intMap = new int[Config.CHAR_TABLE_SIZE];
-
+
for (int i=0; i<len-1; i++) intMap[bytes[p + i] & 0xff] = len - 1 - i; // oxff ??
}
}
@@ -312,22 +312,22 @@ public final class Regex implements RegexState {
searchAlgorithm = enc.toLowerCaseTable() != null ? SearchAlgorithm.SLOW_IC_SB : new SearchAlgorithm.SLOW_IC(this);
} else {
boolean allowReverse = enc.isReverseMatchAllowed(exact, exactP, exactEnd);
-
+
if (e.length >= 3 || (e.length >= 2 && allowReverse)) {
setupBMSkipMap();
if (allowReverse) {
searchAlgorithm = SearchAlgorithm.BM;
} else {
- searchAlgorithm = SearchAlgorithm.BM_NOT_REV;
+ searchAlgorithm = SearchAlgorithm.BM_NOT_REV;
}
} else {
searchAlgorithm = enc.isSingleByte() ? SearchAlgorithm.SLOW_SB : SearchAlgorithm.SLOW;
}
}
-
+
dMin = e.mmd.min;
dMax = e.mmd.max;
-
+
if (dMin != MinMaxLen.INFINITE_DISTANCE) {
thresholdLength = dMin + (exactEnd - exactP);
}
@@ -340,16 +340,16 @@ public final class Regex implements RegexState {
}
*/
map = m.map;
-
+
searchAlgorithm = enc.isSingleByte() ? SearchAlgorithm.MAP_SB : SearchAlgorithm.MAP;
dMin = m.mmd.min;
dMax = m.mmd.max;
-
+
if (dMin != MinMaxLen.INFINITE_DISTANCE) {
thresholdLength = dMin + 1;
}
}
-
+
void setSubAnchor(OptAnchorInfo anc) {
subAnchor |= anc.leftAnchor & AnchorType.BEGIN_LINE;
subAnchor |= anc.rightAnchor & AnchorType.END_LINE;
@@ -361,14 +361,14 @@ public final class Regex implements RegexState {
anchorDmax = 0;
anchorDmin = 0;
subAnchor = 0;
-
+
exact = null;
exactP = exactEnd = 0;
}
-
+
public String encStringToString(byte[]bytes, int p, int end) {
StringBuilder sb = new StringBuilder("\nPATTERN: /");
-
+
if (enc.minLength() > 1) {
int p_ = p;
while (p_ < end) {
@@ -392,12 +392,12 @@ public final class Regex implements RegexState {
}
return sb.append("/").toString();
}
-
+
public String optimizeInfoToString() {
String s = "";
s += "optimize: " + searchAlgorithm.getName() + "\n";
s += " anchor: " + OptAnchorInfo.anchorToString(anchor);
-
+
if ((anchor & AnchorType.END_BUF_MASK) != 0) {
s += MinMaxLen.distanceRangeToString(anchorDmin, anchorDmax);
}
@@ -412,11 +412,11 @@ public final class Regex implements RegexState {
s += "threshold length: " + thresholdLength + "\n";
if (exact != null) {
- s += "exact: [" + new String(exact, exactP, exactEnd - exactP) + "]: length: " + (exactEnd - exactP) + "\n";
+ s += "exact: [" + new String(exact, exactP, exactEnd - exactP) + "]: length: " + (exactEnd - exactP) + "\n";
} else if (searchAlgorithm == SearchAlgorithm.MAP || searchAlgorithm == SearchAlgorithm.MAP_SB) {
int n=0;
for (int i=0; i<Config.CHAR_TABLE_SIZE; i++) if (map[i] != 0) n++;
-
+
s += "map: n = " + n + "\n";
if (n > 0) {
int c=0;
--
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