harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r418971 - in /incubator/harmony/enhanced/classlib/trunk/modules/regex/src: main/java/java/util/regex/AbstractCharClass.java test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
Date Tue, 04 Jul 2006 10:45:41 GMT
Author: gharley
Date: Tue Jul  4 03:45:40 2006
New Revision: 418971

URL: http://svn.apache.org/viewvc?rev=418971&view=rev
Log:
HARMONY 696 : Harmony regex does not support Character.isXXX character classes

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
    incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java?rev=418971&r1=418970&r2=418971&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/src/main/java/java/util/regex/AbstractCharClass.java
Tue Jul  4 03:45:40 2006
@@ -323,6 +323,126 @@
             };
         }
     }
+    
+    static class LazyJavaDefined extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isDefined((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaDigit extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isDigit((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaIdentifierIgnorable extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isIdentifierIgnorable((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaISOControl extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isISOControl((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaJavaIdentifierPart extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isJavaIdentifierPart((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaJavaIdentifierStart extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isJavaIdentifierStart((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaLetter extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isLetter((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaLetterOrDigit extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isLetterOrDigit((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaSpaceChar extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isSpaceChar((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaTitleCase extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isTitleCase((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaUnicodeIdentifierPart extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isUnicodeIdentifierPart((char) ch);
+                }
+            };
+        }
+    }
+
+    static class LazyJavaUnicodeIdentifierStart extends LazyCharClass {
+        protected AbstractCharClass computeValue() {
+            return new AbstractCharClass() {
+                public boolean contains(int ch) {
+                    return Character.isUnicodeIdentifierStart((char) ch);
+                }
+            };
+        }
+    }
 
     /**
      * character classes generated from 
@@ -350,7 +470,19 @@
                 { "javaLowerCase", new LazyJavaLowerCase() },
                 { "javaUpperCase", new LazyJavaUpperCase() },
                 { "javaWhitespace", new LazyJavaWhitespace() },
-                { "javaMirrored", new LazyJavaMirrored() }, 
+                { "javaMirrored", new LazyJavaMirrored() },
+                { "javaDefined", new LazyJavaDefined() },
+                { "javaDigit", new LazyJavaDigit() },
+                { "javaIdentifierIgnorable", new LazyJavaIdentifierIgnorable() },
+                { "javaISOControl", new LazyJavaISOControl() },
+                { "javaJavaIdentifierPart", new LazyJavaJavaIdentifierPart() },
+                { "javaJavaIdentifierStart", new LazyJavaJavaIdentifierStart() },
+                { "javaLetter", new LazyJavaLetter() },
+                { "javaLetterOrDigit", new LazyJavaLetterOrDigit() },
+                { "javaSpaceChar", new LazyJavaSpaceChar() },
+                { "javaTitleCase", new LazyJavaTitleCase() },
+                { "javaUnicodeIdentifierPart", new LazyJavaUnicodeIdentifierPart() },
+                { "javaUnicodeIdentifierStart", new LazyJavaUnicodeIdentifierStart() },
                 { "Space", space },
                 { "w", new LazyWord() },
                 { "W", new LazyNonWord() },

Modified: incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java?rev=418971&r1=418970&r2=418971&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
Tue Jul  4 03:45:40 2006
@@ -985,7 +985,7 @@
 	 * \p{javaLowerCase} \p{javaUpperCase} \p{javaWhitespace} \p{javaMirrored}
 	 */
 	public void testCompileCharacterClass() {
-		// Regression for HARMONY-606
+		// Regression for HARMONY-606, 696
 		Pattern pattern = Pattern.compile("\\p{javaLowerCase}");
 		assertNotNull(pattern);
 
@@ -997,6 +997,42 @@
 
 		pattern = Pattern.compile("\\p{javaMirrored}");
 		assertNotNull(pattern);
+        
+        pattern = Pattern.compile("\\p{javaDefined}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaDigit}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaIdentifierIgnorable}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaISOControl}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaJavaIdentifierPart}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaJavaIdentifierStart}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaLetter}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaLetterOrDigit}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaSpaceChar}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaTitleCase}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaUnicodeIdentifierPart}");
+        assertNotNull(pattern);
+
+        pattern = Pattern.compile("\\p{javaUnicodeIdentifierStart}");
+        assertNotNull(pattern);
 	}
 
 	public static void main(String[] args) {



Mime
View raw message