rt/emul/compact/src/main/java/java/util/regex/Pattern.java
changeset 1350 f14e9730d4e9
parent 1348 bca65655b36b
     1.1 --- a/rt/emul/compact/src/main/java/java/util/regex/Pattern.java	Mon Oct 07 16:13:27 2013 +0200
     1.2 +++ b/rt/emul/compact/src/main/java/java/util/regex/Pattern.java	Mon Oct 07 16:17:21 2013 +0200
     1.3 @@ -25,10 +25,6 @@
     1.4  
     1.5  package java.util.regex;
     1.6  
     1.7 -import java.security.AccessController;
     1.8 -import java.security.PrivilegedAction;
     1.9 -import java.text.CharacterIterator;
    1.10 -import java.text.Normalizer;
    1.11  import java.util.Locale;
    1.12  import java.util.Map;
    1.13  import java.util.ArrayList;
    1.14 @@ -1350,7 +1346,7 @@
    1.15          int lastCodePoint = -1;
    1.16  
    1.17          // Convert pattern into normalizedD form
    1.18 -        normalizedPattern = Normalizer.normalize(pattern, Normalizer.Form.NFD);
    1.19 +        normalizedPattern = Normalizer.normalize(pattern, Normalizer.NFD);
    1.20          patternLength = normalizedPattern.length();
    1.21  
    1.22          // Modify pattern to match canonical equivalences
    1.23 @@ -1541,7 +1537,7 @@
    1.24      }
    1.25  
    1.26      private int getClass(int c) {
    1.27 -        return sun.text.Normalizer.getCombiningClass(c);
    1.28 +        return Normalizer.getCombiningClass(c);
    1.29      }
    1.30  
    1.31      /**
    1.32 @@ -1554,7 +1550,7 @@
    1.33      private String composeOneStep(String input) {
    1.34          int len = countChars(input, 0, 2);
    1.35          String firstTwoCharacters = input.substring(0, len);
    1.36 -        String result = Normalizer.normalize(firstTwoCharacters, Normalizer.Form.NFC);
    1.37 +        String result = Normalizer.normalize(firstTwoCharacters, Normalizer.NFC);
    1.38  
    1.39          if (result.equals(firstTwoCharacters))
    1.40              return null;
    1.41 @@ -2651,18 +2647,18 @@
    1.42              // property construct \p{name=value}
    1.43              String value = name.substring(i + 1);
    1.44              name = name.substring(0, i).toLowerCase(Locale.ENGLISH);
    1.45 -            if ("sc".equals(name) || "script".equals(name)) {
    1.46 +    /*        if ("sc".equals(name) || "script".equals(name)) {
    1.47                  node = unicodeScriptPropertyFor(value);
    1.48              } else if ("blk".equals(name) || "block".equals(name)) {
    1.49                  node = unicodeBlockPropertyFor(value);
    1.50 -            } else if ("gc".equals(name) || "general_category".equals(name)) {
    1.51 +            } else*/ if ("gc".equals(name) || "general_category".equals(name)) {
    1.52                  node = charPropertyNodeFor(value);
    1.53              } else {
    1.54                  throw error("Unknown Unicode property {name=<" + name + ">, "
    1.55                               + "value=<" + value + ">}");
    1.56              }
    1.57          } else {
    1.58 -            if (name.startsWith("In")) {
    1.59 +            /*if (name.startsWith("In")) {
    1.60                  // \p{inBlockName}
    1.61                  node = unicodeBlockPropertyFor(name.substring(2));
    1.62              } else if (name.startsWith("Is")) {
    1.63 @@ -2675,7 +2671,7 @@
    1.64                      node = CharPropertyNames.charPropertyFor(name);
    1.65                  if (node == null)
    1.66                      node = unicodeScriptPropertyFor(name);
    1.67 -            } else {
    1.68 +            } else*/ {
    1.69                  if (has(UNICODE_CHARACTER_CLASS)) {
    1.70                      UnicodeProp uprop = UnicodeProp.forPOSIXName(name);
    1.71                      if (uprop != null)
    1.72 @@ -2686,7 +2682,7 @@
    1.73              }
    1.74          }
    1.75          if (maybeComplement) {
    1.76 -            if (node instanceof Category || node instanceof Block)
    1.77 +            if (node instanceof Category /*|| node instanceof Block*/)
    1.78                  hasSupplementary = true;
    1.79              node = node.complement();
    1.80          }
    1.81 @@ -2697,7 +2693,7 @@
    1.82      /**
    1.83       * Returns a CharProperty matching all characters belong to
    1.84       * a UnicodeScript.
    1.85 -     */
    1.86 +     *
    1.87      private CharProperty unicodeScriptPropertyFor(String name) {
    1.88          final Character.UnicodeScript script;
    1.89          try {
    1.90 @@ -2710,7 +2706,7 @@
    1.91  
    1.92      /**
    1.93       * Returns a CharProperty matching all characters in a UnicodeBlock.
    1.94 -     */
    1.95 +     *
    1.96      private CharProperty unicodeBlockPropertyFor(String name) {
    1.97          final Character.UnicodeBlock block;
    1.98          try {
    1.99 @@ -3775,7 +3771,7 @@
   1.100  
   1.101      /**
   1.102       * Node class that matches a Unicode block.
   1.103 -     */
   1.104 +     *
   1.105      static final class Block extends CharProperty {
   1.106          final Character.UnicodeBlock block;
   1.107          Block(Character.UnicodeBlock block) {
   1.108 @@ -3788,7 +3784,7 @@
   1.109  
   1.110      /**
   1.111       * Node class that matches a Unicode script
   1.112 -     */
   1.113 +     *
   1.114      static final class Script extends CharProperty {
   1.115          final Character.UnicodeScript script;
   1.116          Script(Character.UnicodeScript script) {
   1.117 @@ -5645,4 +5641,17 @@
   1.118                      return Character.isMirrored(ch);}});
   1.119          }
   1.120      }
   1.121 +    
   1.122 +    private static final class Normalizer {
   1.123 +        public static final int NFD = 1;
   1.124 +        public static final int NFC = 2;
   1.125 +
   1.126 +        static String normalize(String pattern, int NFD) {
   1.127 +            return pattern;
   1.128 +        }
   1.129 +
   1.130 +        private static int getCombiningClass(int c) {
   1.131 +            return 1;
   1.132 +        }
   1.133 +    }
   1.134  }