if (n.charAt(ci) != ' ')  buffer.append((char)n.charAt(ci));
if (n.charAt(ci) != ' ')  buffer.append(n.charAt(ci));
     static protected RangeToken getRange(String name, boolean positive) {        if (Token.categories.size() == 0) {            synchronized (Token.categories) {                Token[] ranges = new Token[Token.categoryNames.length];                for (int i = 0;  i < ranges.length;  i ++) {                    ranges[i] = Token.createRange();                }                int type;                for (int i = 0;  i < 0x10000;  i ++) {                    type = Character.getType((char)i);                    if (type == Character.START_PUNCTUATION ||                         type == Character.END_PUNCTUATION) {                        //build table of Pi values                        if (i == 0x00AB || i == 0x2018 || i == 0x201B || i == 0x201C ||                            i == 0x201F || i == 0x2039) {                            type = CHAR_INIT_QUOTE;                        }                        //build table of Pf values                        if (i == 0x00BB || i == 0x2019 || i == 0x201D || i == 0x203A ) {                            type = CHAR_FINAL_QUOTE;                        }                    }                    ranges[type].addRange(i, i);                    switch (type) {                      case Character.UPPERCASE_LETTER:                      case Character.LOWERCASE_LETTER:                      case Character.TITLECASE_LETTER:                      case Character.MODIFIER_LETTER:                      case Character.OTHER_LETTER:                        type = CHAR_LETTER;                        break;                      case Character.NON_SPACING_MARK:                      case Character.COMBINING_SPACING_MARK:                      case Character.ENCLOSING_MARK:                        type = CHAR_MARK;                        break;                      case Character.DECIMAL_DIGIT_NUMBER:                      case Character.LETTER_NUMBER:                      case Character.OTHER_NUMBER:                        type = CHAR_NUMBER;                        break;                      case Character.SPACE_SEPARATOR:                      case Character.LINE_SEPARATOR:                      case Character.PARAGRAPH_SEPARATOR:                        type = CHAR_SEPARATOR;                        break;                      case Character.CONTROL:                      case Character.FORMAT:                      case Character.SURROGATE:                      case Character.PRIVATE_USE:                      case Character.UNASSIGNED:                        type = CHAR_OTHER;                        break;                      case Character.CONNECTOR_PUNCTUATION:                      case Character.DASH_PUNCTUATION:                      case Character.START_PUNCTUATION:                      case Character.END_PUNCTUATION:                      case CHAR_INIT_QUOTE:                      case CHAR_FINAL_QUOTE:                      case Character.OTHER_PUNCTUATION:                        type = CHAR_PUNCTUATION;                        break;                      case Character.MATH_SYMBOL:                      case Character.CURRENCY_SYMBOL:                      case Character.MODIFIER_SYMBOL:                      case Character.OTHER_SYMBOL:                        type = CHAR_SYMBOL;                        break;                      default:                        throw new RuntimeException("org.apache.xerces.utils.regex.Token#getRange(): Unknown Unicode category: "+type);                    }                    ranges[type].addRange(i, i);                } // for all characters                ranges[Character.UNASSIGNED].addRange(0x10000, Token.UTF16_MAX);                for (int i = 0;  i < ranges.length;  i ++) {                    if (Token.categoryNames[i] != null) {                        if (i == Character.UNASSIGNED) { // Unassigned                            ranges[i].addRange(0x10000, Token.UTF16_MAX);                        }                        Token.categories.put(Token.categoryNames[i], ranges[i]);                        Token.categories2.put(Token.categoryNames[i],                                              Token.complementRanges(ranges[i]));                    }                }                //REVISIT: do we really need to support block names as in Unicode 3.1                //         or we can just create all the names in IsBLOCKNAME format (XML Schema REC)?                //                StringBuffer buffer = new StringBuffer(50);                int location = 0;                for (int i = 0;  i < Token.blockNames.length;  i ++) {                    Token r1 = Token.createRange();                    location = i*2;                    int rstart = Token.blockRanges.charAt(location);                    int rend = Token.blockRanges.charAt(location+1);                    String n = Token.blockNames[i];                    //DEBUGING                    //System.out.println(n+" " +Integer.toHexString(rstart)                    //                     +"-"+ Integer.toHexString(rend));                    r1.addRange(rstart, rend);                    if (n.equals("Specials"))                        r1.addRange(0xfff0, 0xfffd);                    if (n.equals("Private Use")) {                        r1.addRange(0xF0000,0xFFFFD);                        r1.addRange(0x100000,0x10FFFD);                    }                    Token.categories.put(n, r1);                    Token.categories2.put(n, Token.complementRanges(r1));                    buffer.setLength(0);                                        buffer.append("Is");                    if (n.indexOf(' ') >= 0) {                        for (int ci = 0;  ci < n.length();  ci ++)                            if (n.charAt(ci) != ' ')  buffer.append((char)n.charAt(ci));                    }                    else {                        buffer.append(n);                    }                    Token.setAlias(buffer.toString(), n, true);                }                // REVISIT: remove this code later                 // the following does not match the XML Schema definition                // for Regular Expressions                                 /*                // TR#18 1.2                Token.setAlias("ASSIGNED", "Cn", false);                Token.setAlias("UNASSIGNED", "Cn", true);                Token all = Token.createRange();                all.addRange(0, Token.UTF16_MAX);                Token.categories.put("ALL", all);                Token.categories2.put("ALL", Token.complementRanges(all));                */                                /*                Token isalpha = Token.createRange();                isalpha.mergeRanges(ranges[Character.UPPERCASE_LETTER]); // Lu                isalpha.mergeRanges(ranges[Character.LOWERCASE_LETTER]); // Ll                isalpha.mergeRanges(ranges[Character.OTHER_LETTER]); // Lo                Token.categories.put("IsAlpha", isalpha);                Token.categories2.put("IsAlpha", Token.complementRanges(isalpha));                                Token isalnum = Token.createRange();                isalnum.mergeRanges(isalpha);   // Lu Ll Lo                isalnum.mergeRanges(ranges[Character.DECIMAL_DIGIT_NUMBER]); // Nd                Token.categories.put("IsAlnum", isalnum);                Token.categories2.put("IsAlnum", Token.complementRanges(isalnum));                Token isspace = Token.createRange();                isspace.mergeRanges(Token.token_spaces);                isspace.mergeRanges(ranges[CHAR_SEPARATOR]); // Z                Token.categories.put("IsSpace", isspace);                Token.categories2.put("IsSpace", Token.complementRanges(isspace));                Token isword = Token.createRange();                isword.mergeRanges(isalnum);     // Lu Ll Lo Nd                isword.addRange('_', '_');                Token.categories.put("IsWord", isword);                Token.categories2.put("IsWord", Token.complementRanges(isword));                Token isascii = Token.createRange();                isascii.addRange(0, 127);                Token.categories.put("IsASCII", isascii);                Token.categories2.put("IsASCII", Token.complementRanges(isascii));                Token isnotgraph = Token.createRange();                isnotgraph.mergeRanges(ranges[CHAR_OTHER]);                isnotgraph.addRange(' ', ' ');                Token.categories.put("IsGraph", Token.complementRanges(isnotgraph));                Token.categories2.put("IsGraph", isnotgraph);                Token isxdigit = Token.createRange();                isxdigit.addRange('0', '9');                isxdigit.addRange('A', 'F');                isxdigit.addRange('a', 'f');                Token.categories.put("IsXDigit", Token.complementRanges(isxdigit));                Token.categories2.put("IsXDigit", isxdigit);                                Token.setAlias("IsDigit", "Nd", true);                Token.setAlias("IsUpper", "Lu", true);                Token.setAlias("IsLower", "Ll", true);                Token.setAlias("IsCntrl", "C", true);                Token.setAlias("IsPrint", "C", false);                Token.setAlias("IsPunct", "P", true);                Token.setAlias("alpha", "IsAlpha", true);                Token.setAlias("alnum", "IsAlnum", true);                Token.setAlias("ascii", "IsASCII", true);                Token.setAlias("cntrl", "IsCntrl", true);                Token.setAlias("digit", "IsDigit", true);                Token.setAlias("graph", "IsGraph", true);                Token.setAlias("lower", "IsLower", true);                Token.setAlias("print", "IsPrint", true);                Token.setAlias("punct", "IsPunct", true);                Token.setAlias("space", "IsSpace", true);                Token.setAlias("upper", "IsUpper", true);                Token.setAlias("word", "IsWord", true); // Perl extension                Token.setAlias("xdigit", "IsXDigit", true);                 */            } // synchronized        } // if null        RangeToken tok = positive ? (RangeToken)Token.categories.get(name)            : (RangeToken)Token.categories2.get(name);        if (tok == null) System.out.println("xxxxx" + name);        return tok;    }