I am checking this in.

2006-01-17  Ito Kazumitsu  <[EMAIL PROTECTED]>

        Fixes bug #25817
        * gnu/regexp/RETokenRange.java(constructor):
        Keep lo and hi as they are.
        (match): Changed the case insensitive comparison.

Index: classpath/gnu/regexp/RETokenRange.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/regexp/RETokenRange.java,v
retrieving revision 1.2
diff -u -r1.2 RETokenRange.java
--- classpath/gnu/regexp/RETokenRange.java      2 Jul 2005 20:32:15 -0000       
1.2
+++ classpath/gnu/regexp/RETokenRange.java      17 Jan 2006 14:47:44 -0000
@@ -43,8 +43,9 @@
 
   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() {
@@ -54,8 +55,16 @@
     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);
        }
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to