diff options
Diffstat (limited to 'libjava/classpath/gnu/regexp/RETokenRange.java')
-rw-r--r-- | libjava/classpath/gnu/regexp/RETokenRange.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libjava/classpath/gnu/regexp/RETokenRange.java b/libjava/classpath/gnu/regexp/RETokenRange.java index dadaf2d8072..8a1ac86b212 100644 --- a/libjava/classpath/gnu/regexp/RETokenRange.java +++ b/libjava/classpath/gnu/regexp/RETokenRange.java @@ -43,19 +43,32 @@ final class RETokenRange extends REToken { RETokenRange(int subIndex, char lo, char hi, boolean ins) { super(subIndex); - this.lo = (insens = ins) ? Character.toLowerCase(lo) : lo; - this.hi = ins ? Character.toLowerCase(hi) : hi; + insens = ins; + this.lo = lo; + this.hi = hi; } int getMinimumLength() { return 1; } + int getMaximumLength() { + return 1; + } + boolean match(CharIndexed input, REMatch mymatch) { char c = input.charAt(mymatch.index); if (c == CharIndexed.OUT_OF_BOUNDS) return false; - if (insens) c = Character.toLowerCase(c); - if ((c >= lo) && (c <= hi)) { + boolean matches = (c >= lo) && (c <= hi); + if (! matches && insens) { + char c1 = Character.toLowerCase(c); + matches = (c1 >= lo) && (c1 <= hi); + if (!matches) { + c1 = Character.toUpperCase(c); + matches = (c1 >= lo) && (c1 <= hi); + } + } + if (matches) { ++mymatch.index; return next(input, mymatch); } |