ChangeLog 2006-02-02 Ito Kazumitsu <[EMAIL PROTECTED]>
* gnu/regexp/RETokenNamedProperty.java(getHandler): Check for a Unicode block if the name starts with "In". (UnicodeBlockHandler): New inner class.
Index: classpath/gnu/regexp/RETokenNamedProperty.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/regexp/RETokenNamedProperty.java,v retrieving revision 1.2 diff -u -r1.2 RETokenNamedProperty.java --- classpath/gnu/regexp/RETokenNamedProperty.java 1 Feb 2006 22:49:34 -0000 1.2 +++ classpath/gnu/regexp/RETokenNamedProperty.java 2 Feb 2006 16:28:58 -0000 @@ -148,7 +148,14 @@ return new POSIXHandler(name); } if (name.startsWith("In")) { - throw new REException("Unicode block is not supported yet", REException.REG_ESCAPE, 0); + try { + name = name.substring(2); + Character.UnicodeBlock block = Character.UnicodeBlock.forName(name); + return new UnicodeBlockHandler(block); + } + catch (IllegalArgumentException e) { + throw new REException("Invalid Unicode block name: " + name, REException.REG_ESCAPE, 0); + } } if (name.startsWith("Is")) { name = name.substring(2); @@ -275,4 +282,16 @@ return false; } } + + private static class UnicodeBlockHandler extends Handler { + public UnicodeBlockHandler(Character.UnicodeBlock block) { + this.block = block; + } + private Character.UnicodeBlock block; + public boolean includes(char c) { + Character.UnicodeBlock cblock = Character.UnicodeBlock.of(c); + return (cblock != null && cblock.equals(block)); + } + } + }