# HG changeset patch # User Jaroslav Tulach # Date 1381155441 -7200 # Node ID f14e9730d4e952d3513304d7eeb8a1c2ad699449 # Parent 7df5f83fff8d8c40bae1f3a9c12bc5e1261976fd ReExp builds on top of mini emul Character diff -r 7df5f83fff8d -r f14e9730d4e9 rt/emul/compact/src/main/java/java/util/regex/Pattern.java --- a/rt/emul/compact/src/main/java/java/util/regex/Pattern.java Mon Oct 07 16:14:56 2013 +0200 +++ b/rt/emul/compact/src/main/java/java/util/regex/Pattern.java Mon Oct 07 16:17:21 2013 +0200 @@ -25,10 +25,6 @@ package java.util.regex; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.text.CharacterIterator; -import java.text.Normalizer; import java.util.Locale; import java.util.Map; import java.util.ArrayList; @@ -1350,7 +1346,7 @@ int lastCodePoint = -1; // Convert pattern into normalizedD form - normalizedPattern = Normalizer.normalize(pattern, Normalizer.Form.NFD); + normalizedPattern = Normalizer.normalize(pattern, Normalizer.NFD); patternLength = normalizedPattern.length(); // Modify pattern to match canonical equivalences @@ -1541,7 +1537,7 @@ } private int getClass(int c) { - return sun.text.Normalizer.getCombiningClass(c); + return Normalizer.getCombiningClass(c); } /** @@ -1554,7 +1550,7 @@ private String composeOneStep(String input) { int len = countChars(input, 0, 2); String firstTwoCharacters = input.substring(0, len); - String result = Normalizer.normalize(firstTwoCharacters, Normalizer.Form.NFC); + String result = Normalizer.normalize(firstTwoCharacters, Normalizer.NFC); if (result.equals(firstTwoCharacters)) return null; @@ -2651,18 +2647,18 @@ // property construct \p{name=value} String value = name.substring(i + 1); name = name.substring(0, i).toLowerCase(Locale.ENGLISH); - if ("sc".equals(name) || "script".equals(name)) { + /* if ("sc".equals(name) || "script".equals(name)) { node = unicodeScriptPropertyFor(value); } else if ("blk".equals(name) || "block".equals(name)) { node = unicodeBlockPropertyFor(value); - } else if ("gc".equals(name) || "general_category".equals(name)) { + } else*/ if ("gc".equals(name) || "general_category".equals(name)) { node = charPropertyNodeFor(value); } else { throw error("Unknown Unicode property {name=<" + name + ">, " + "value=<" + value + ">}"); } } else { - if (name.startsWith("In")) { + /*if (name.startsWith("In")) { // \p{inBlockName} node = unicodeBlockPropertyFor(name.substring(2)); } else if (name.startsWith("Is")) { @@ -2675,7 +2671,7 @@ node = CharPropertyNames.charPropertyFor(name); if (node == null) node = unicodeScriptPropertyFor(name); - } else { + } else*/ { if (has(UNICODE_CHARACTER_CLASS)) { UnicodeProp uprop = UnicodeProp.forPOSIXName(name); if (uprop != null) @@ -2686,7 +2682,7 @@ } } if (maybeComplement) { - if (node instanceof Category || node instanceof Block) + if (node instanceof Category /*|| node instanceof Block*/) hasSupplementary = true; node = node.complement(); } @@ -2697,7 +2693,7 @@ /** * Returns a CharProperty matching all characters belong to * a UnicodeScript. - */ + * private CharProperty unicodeScriptPropertyFor(String name) { final Character.UnicodeScript script; try { @@ -2710,7 +2706,7 @@ /** * Returns a CharProperty matching all characters in a UnicodeBlock. - */ + * private CharProperty unicodeBlockPropertyFor(String name) { final Character.UnicodeBlock block; try { @@ -3775,7 +3771,7 @@ /** * Node class that matches a Unicode block. - */ + * static final class Block extends CharProperty { final Character.UnicodeBlock block; Block(Character.UnicodeBlock block) { @@ -3788,7 +3784,7 @@ /** * Node class that matches a Unicode script - */ + * static final class Script extends CharProperty { final Character.UnicodeScript script; Script(Character.UnicodeScript script) { @@ -5645,4 +5641,17 @@ return Character.isMirrored(ch);}}); } } + + private static final class Normalizer { + public static final int NFD = 1; + public static final int NFC = 2; + + static String normalize(String pattern, int NFD) { + return pattern; + } + + private static int getCombiningClass(int c) { + return 1; + } + } } diff -r 7df5f83fff8d -r f14e9730d4e9 rt/emul/compact/src/main/java/java/util/regex/PatternSyntaxException.java --- a/rt/emul/compact/src/main/java/java/util/regex/PatternSyntaxException.java Mon Oct 07 16:14:56 2013 +0200 +++ b/rt/emul/compact/src/main/java/java/util/regex/PatternSyntaxException.java Mon Oct 07 16:17:21 2013 +0200 @@ -25,9 +25,6 @@ package java.util.regex; -import sun.security.action.GetPropertyAction; - - /** * Unchecked exception thrown to indicate a syntax error in a * regular-expression pattern. @@ -93,9 +90,7 @@ return pattern; } - private static final String nl = - java.security.AccessController - .doPrivileged(new GetPropertyAction("line.separator")); + private static final String nl = System.lineSeparator(); /** * Returns a multi-line string containing the description of the syntax diff -r 7df5f83fff8d -r f14e9730d4e9 rt/emul/mini/src/main/java/java/lang/Character.java --- a/rt/emul/mini/src/main/java/java/lang/Character.java Mon Oct 07 16:14:56 2013 +0200 +++ b/rt/emul/mini/src/main/java/java/lang/Character.java Mon Oct 07 16:17:21 2013 +0200 @@ -572,6 +572,46 @@ */ public static final int MAX_CODE_POINT = 0X10FFFF; + public static boolean isAlphabetic(int ch) { + throw new UnsupportedOperationException("isAlphabetic: " + (char)ch); + } + + public static boolean isIdeographic(int ch) { + throw new UnsupportedOperationException("isIdeographic: " + (char)ch); + } + + public static boolean isLowerCase(int ch) { + throw new UnsupportedOperationException("isLowerCase: " + (char)ch); + } + + public static boolean isUpperCase(int ch) { + throw new UnsupportedOperationException("isUpperCase: " + (char)ch); + } + + public static boolean isMirrored(int ch) { + throw new UnsupportedOperationException("isMirrored: " + (char)ch); + } + + public static boolean isIdentifierIgnorable(int ch) { + throw new UnsupportedOperationException("isIdentifierIgnorable: " + (char)ch); + } + + public static boolean isUnicodeIdentifierPart(int ch) { + throw new UnsupportedOperationException("isUnicodeIdentifierPart: " + (char)ch); + } + + public static boolean isUnicodeIdentifierStart(int ch) { + throw new UnsupportedOperationException("isUnicodeIdentifierStart: " + (char)ch); + } + + public static char toUpperCase(int ch) { + throw new UnsupportedOperationException("toUpperCase: " + (char)ch); + } + + public static int toLowerCase(int ch) { + throw new UnsupportedOperationException("toLowerCase: " + (char)ch); + } + /** * Instances of this class represent particular subsets of the Unicode @@ -1892,8 +1932,8 @@ return fromCodeChars(codePoint).matches("\\w"); } - static int getType(int x) { - throw new UnsupportedOperationException(); + public static int getType(int x) { + throw new UnsupportedOperationException("getType: " + (char)x); } /**