Skip to content

Commit

Permalink
Merge pull request #72 from jruby/hack_fast_i_broken
Browse files Browse the repository at this point in the history
Use slow search on //i due to bad logic in choosing fast algo (to be fixed later)
  • Loading branch information
enebo authored Jun 7, 2023
2 parents 3f89185 + e2358a1 commit 92d391e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/org/joni/Regex.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ void setOptimizeExactInfo(OptExactInfo e) {
if (e.length >= 3 || (e.length >= 2 && allowReverse)) {
forward = enc.toLowerCaseTable() != null ? Search.SLOW_IC_SB_FORWARD : Search.SLOW_IC_FORWARD;
if (!setupBMSkipMap(true)) {
forward = allowReverse ? Search.BM_IC_FORWARD : Search.BM_NOT_REV_IC_FORWARD;
forward = allowReverse ? (enc.toLowerCaseTable() != null ? Search.SLOW_IC_SB_FORWARD : Search.SLOW_IC_FORWARD) : Search.BM_NOT_REV_IC_FORWARD;
// FIXME: put above line in place to work around some failures. Either BM_IC_FORWARD is broken here or we are choosing it when we shouldn't.
//forward = allowReverse ? Search.BM_IC_FORWARD : Search.BM_NOT_REV_IC_FORWARD;
} else {
forward = enc.toLowerCaseTable() != null ? Search.SLOW_IC_SB_FORWARD : Search.SLOW_IC_FORWARD;
}
Expand Down
10 changes: 5 additions & 5 deletions src/org/joni/SingleRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SingleRegion extends Region {
int end;

public SingleRegion(int num) {
if (num != 1) throw new IndexOutOfBoundsException(num);
if (num != 1) throw new IndexOutOfBoundsException(""+num);
}

public SingleRegion(int begin, int end) {
Expand All @@ -43,22 +43,22 @@ public SingleRegion clone() {
}

public int getBeg(int index) {
if (index != 0) throw new IndexOutOfBoundsException(index);
if (index != 0) throw new IndexOutOfBoundsException(""+index);
return beg;
}

public int setBeg(int index, int value) {
if (index != 0) throw new IndexOutOfBoundsException(index);
if (index != 0) throw new IndexOutOfBoundsException(""+index);
return beg = value;
}

public int getEnd(int index) {
if (index != 0) throw new IndexOutOfBoundsException(index);
if (index != 0) throw new IndexOutOfBoundsException(""+index);
return end;
}

public int setEnd(int index, int value) {
if (index != 0) throw new IndexOutOfBoundsException(index);
if (index != 0) throw new IndexOutOfBoundsException(""+index);
return end = value;
}

Expand Down

0 comments on commit 92d391e

Please sign in to comment.