ICU-8491 remove UCharacterProperty.isRuleWhiteSpace(c)
X-SVN-Rev: 29890
This commit is contained in:
parent
d743bb693e
commit
1f6e7fb0a6
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -13,7 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.icu.impl.ICUResourceBundle;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
@ -1408,7 +1408,7 @@ final class CollationRuleParser
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(ch)) {
|
||||
if (!PatternProps.isWhiteSpace(ch)) {
|
||||
// Sets the strength for this entry
|
||||
switch (ch) {
|
||||
case 0x003D : // '='
|
||||
@ -1653,7 +1653,7 @@ final class CollationRuleParser
|
||||
m_current_ ++;
|
||||
ch = m_source_.charAt(m_current_);
|
||||
// skip whitespace between '|' and the character
|
||||
} while (UCharacterProperty.isRuleWhiteSpace(ch));
|
||||
} while (PatternProps.isWhiteSpace(ch));
|
||||
break;
|
||||
case 0x002D : // '-', indicates a range.
|
||||
if (newstrength != TOKEN_UNSET_) {
|
||||
@ -2068,7 +2068,7 @@ final class CollationRuleParser
|
||||
if (optionend - start > optionlength) {
|
||||
m_optionarg_ = start + optionlength;
|
||||
// start of the options, skip space
|
||||
while (m_optionarg_ < optionend && (UCharacter.isWhitespace(rules.charAt(m_optionarg_)) || UCharacterProperty.isRuleWhiteSpace(rules.charAt(m_optionarg_))))
|
||||
while (m_optionarg_ < optionend && PatternProps.isWhiteSpace(rules.charAt(m_optionarg_)))
|
||||
{ // eat whitespace
|
||||
m_optionarg_ ++;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2003-2010, International Business Machines
|
||||
* Copyright (c) 2003-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
@ -83,9 +83,8 @@ public class RuleCharacterIterator {
|
||||
|
||||
/**
|
||||
* Bitmask option to enable skipping of whitespace. If (options &
|
||||
* SKIP_WHITESPACE) != 0, then whitespace characters will be silently
|
||||
* skipped, as if they were not present in the input. Whitespace
|
||||
* characters are defined by UCharacterProperty.isRuleWhiteSpace().
|
||||
* SKIP_WHITESPACE) != 0, then Unicode Pattern_White_Space characters will be silently
|
||||
* skipped, as if they were not present in the input.
|
||||
*/
|
||||
public static final int SKIP_WHITESPACE = 4;
|
||||
|
||||
@ -156,7 +155,7 @@ public class RuleCharacterIterator {
|
||||
}
|
||||
|
||||
if ((options & SKIP_WHITESPACE) != 0 &&
|
||||
UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
PatternProps.isWhiteSpace(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -249,7 +248,7 @@ public class RuleCharacterIterator {
|
||||
if ((options & SKIP_WHITESPACE) != 0) {
|
||||
for (;;) {
|
||||
int a = _current();
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(a)) break;
|
||||
if (!PatternProps.isWhiteSpace(a)) break;
|
||||
_advance(UTF16.getCharCount(a));
|
||||
}
|
||||
}
|
||||
|
@ -729,21 +729,6 @@ public final class UCharacterProperty
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if the argument c is to be treated as a white space in ICU
|
||||
* rules. Usually ICU rule white spaces are ignored unless quoted.
|
||||
* Equivalent to test for Pattern_White_Space Unicode property.
|
||||
* Stable set of characters, won't change.
|
||||
* See UAX #31 Identifier and Pattern Syntax: http://www.unicode.org/reports/tr31/
|
||||
* @param c codepoint to check
|
||||
* @return true if c is a ICU white space
|
||||
* @deprecated use PatternProps.isWhiteSpace(c)
|
||||
*/
|
||||
public static boolean isRuleWhiteSpace(int c)
|
||||
{
|
||||
return PatternProps.isWhiteSpace(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the the maximum values for some enum/int properties.
|
||||
* @return maximum values for the integer properties.
|
||||
|
@ -1105,7 +1105,7 @@ public final class Utility {
|
||||
public static int skipWhitespace(String str, int pos) {
|
||||
while (pos < str.length()) {
|
||||
int c = Character.codePointAt(str, pos);
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (!PatternProps.isWhiteSpace(c)) {
|
||||
break;
|
||||
}
|
||||
pos += UTF16.getCharCount(c);
|
||||
@ -1122,14 +1122,14 @@ public final class Utility {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all rule white space from a string.
|
||||
* Remove all Pattern_White_Space from a string.
|
||||
*/
|
||||
public static String deleteRuleWhiteSpace(String str) {
|
||||
public static String deletePatternWhiteSpace(String str) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i=0; i<str.length(); ) {
|
||||
int ch = Character.codePointAt(str, i);
|
||||
i += UTF16.getCharCount(ch);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(ch)) {
|
||||
if (PatternProps.isWhiteSpace(ch)) {
|
||||
continue;
|
||||
}
|
||||
buf.appendCodePoint(ch);
|
||||
@ -1195,7 +1195,7 @@ public final class Utility {
|
||||
return -1;
|
||||
}
|
||||
c = rule.charAt(pos++);
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (!PatternProps.isWhiteSpace(c)) {
|
||||
return -1;
|
||||
}
|
||||
// FALL THROUGH to skipWhitespace
|
||||
@ -1230,7 +1230,7 @@ public final class Utility {
|
||||
* pattern. Characters are matched literally and case-sensitively
|
||||
* except for the following special characters:
|
||||
*
|
||||
* ~ zero or more uprv_isRuleWhiteSpace chars
|
||||
* ~ zero or more Pattern_White_Space chars
|
||||
*
|
||||
* If end of pattern is reached with all matches along the way,
|
||||
* pos is advanced to the first unparsed index and returned.
|
||||
@ -1259,7 +1259,7 @@ public final class Utility {
|
||||
|
||||
// parse \s*
|
||||
if (cpat == '~') {
|
||||
if (UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (PatternProps.isWhiteSpace(c)) {
|
||||
index += UTF16.getCharCount(c);
|
||||
continue;
|
||||
} else {
|
||||
@ -1346,15 +1346,13 @@ public final class Utility {
|
||||
* @param pos INPUT-OUPUT parameter. On INPUT, pos[0] is the
|
||||
* first character to examine. It must be less than str.length(),
|
||||
* and it must not point to a whitespace character. That is, must
|
||||
* have pos[0] < str.length() and
|
||||
* !UCharacterProperty.isRuleWhiteSpace(UTF16.charAt(str, pos[0])). On
|
||||
* have pos[0] < str.length(). On
|
||||
* OUTPUT, the position after the last parsed character.
|
||||
* @return the Unicode identifier, or null if there is no valid
|
||||
* identifier at pos[0].
|
||||
*/
|
||||
public static String parseUnicodeIdentifier(String str, int[] pos) {
|
||||
// assert(pos[0] < str.length());
|
||||
// assert(!UCharacterProperty.isRuleWhiteSpace(UTF16.charAt(str, pos[0])));
|
||||
StringBuilder buf = new StringBuilder();
|
||||
int p = pos[0];
|
||||
while (p < str.length()) {
|
||||
@ -1657,7 +1655,7 @@ public final class Utility {
|
||||
!((c >= 0x0030/*'0'*/ && c <= 0x0039/*'9'*/) ||
|
||||
(c >= 0x0041/*'A'*/ && c <= 0x005A/*'Z'*/) ||
|
||||
(c >= 0x0061/*'a'*/ && c <= 0x007A/*'z'*/))) ||
|
||||
UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
PatternProps.isWhiteSpace(c)) {
|
||||
quoteBuf.appendCodePoint(c);
|
||||
// Double ' within a quote
|
||||
if (c == APOSTROPHE) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -157,7 +157,7 @@ public class ResourceReader {
|
||||
/**
|
||||
* Read a line, ignoring blank lines and lines that start with
|
||||
* '#'.
|
||||
* @param trim if true then trim leading rule white space.
|
||||
* @param trim if true then trim leading Pattern_White_Space.
|
||||
*/
|
||||
public String readLineSkippingComments(boolean trim) throws IOException {
|
||||
for (;;) {
|
||||
@ -180,7 +180,7 @@ public class ResourceReader {
|
||||
|
||||
/**
|
||||
* Read a line, ignoring blank lines and lines that start with
|
||||
* '#'. Do not trim leading rule white space.
|
||||
* '#'. Do not trim leading Pattern_White_Space.
|
||||
*/
|
||||
public String readLineSkippingComments() throws IOException {
|
||||
return readLineSkippingComments(false);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2004-2008, International Business Machines
|
||||
* Copyright (c) 2004-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
@ -12,14 +12,14 @@ package com.ibm.icu.impl.data;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.text.UTF16;
|
||||
|
||||
/**
|
||||
* An iterator class that returns successive string tokens from some
|
||||
* source. String tokens are, in general, separated by rule white
|
||||
* space in the source test. Furthermore, they may be delimited by
|
||||
* source. String tokens are, in general, separated by Pattern_White_Space
|
||||
* in the source test. Furthermore, they may be delimited by
|
||||
* either single or double quotes (opening and closing quotes must
|
||||
* match). Escapes are processed using standard ICU unescaping.
|
||||
*/
|
||||
@ -94,7 +94,7 @@ public class TokenIterator {
|
||||
|
||||
/**
|
||||
* Read the next token from 'this.line' and append it to
|
||||
* 'this.buf'. Tokens are separated by rule white space. Tokens
|
||||
* 'this.buf'. Tokens are separated by Pattern_White_Space. Tokens
|
||||
* may also be delimited by double or single quotes. The closing
|
||||
* quote must match the opening quote. If a '#' is encountered,
|
||||
* the rest of the line is ignored, unless it is backslash-escaped
|
||||
@ -140,7 +140,7 @@ public class TokenIterator {
|
||||
UTF16.append(buf, c32);
|
||||
position = posref[0];
|
||||
} else if ((quote != 0 && c == quote) ||
|
||||
(quote == 0 && UCharacterProperty.isRuleWhiteSpace(c))) {
|
||||
(quote == 0 && PatternProps.isWhiteSpace(c))) {
|
||||
return ++position;
|
||||
} else if (quote == 0 && c == '#') {
|
||||
return position; // do NOT increment
|
||||
|
@ -23,7 +23,7 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ibm.icu.impl.ICUConfig;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.math.BigDecimal;
|
||||
@ -2539,9 +2539,9 @@ public class DecimalFormat extends NumberFormat {
|
||||
for (int i = 0; i < affix.length();) {
|
||||
int c = UTF16.charAt(affix, i);
|
||||
int len = UTF16.getCharCount(c);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (PatternProps.isWhiteSpace(c)) {
|
||||
// We may have a pattern like: \u200F and input text like: \u200F Note
|
||||
// that U+200F and U+0020 are RuleWhiteSpace but only U+0020 is
|
||||
// that U+200F and U+0020 are Pattern_White_Space but only U+0020 is
|
||||
// UWhiteSpace. So we have to first do a direct match of the run of RULE
|
||||
// whitespace in the pattern, then match any extra characters.
|
||||
boolean literalMatch = false;
|
||||
@ -2554,13 +2554,13 @@ public class DecimalFormat extends NumberFormat {
|
||||
}
|
||||
c = UTF16.charAt(affix, i);
|
||||
len = UTF16.getCharCount(c);
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (!PatternProps.isWhiteSpace(c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Advance over run in affix
|
||||
i = skipRuleWhiteSpace(affix, i);
|
||||
i = skipPatternWhiteSpace(affix, i);
|
||||
|
||||
// Advance over run in input text. Must see at least one white space char
|
||||
// in input, unless we've already matched some characters literally.
|
||||
@ -2586,12 +2586,12 @@ public class DecimalFormat extends NumberFormat {
|
||||
}
|
||||
|
||||
/**
|
||||
* Skips over a run of zero or more isRuleWhiteSpace() characters at pos in text.
|
||||
* Skips over a run of zero or more Pattern_White_Space characters at pos in text.
|
||||
*/
|
||||
private static int skipRuleWhiteSpace(String text, int pos) {
|
||||
private static int skipPatternWhiteSpace(String text, int pos) {
|
||||
while (pos < text.length()) {
|
||||
int c = UTF16.charAt(text, pos);
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (!PatternProps.isWhiteSpace(c)) {
|
||||
break;
|
||||
}
|
||||
pos += UTF16.getCharCount(c);
|
||||
@ -2707,8 +2707,8 @@ public class DecimalFormat extends NumberFormat {
|
||||
break;
|
||||
}
|
||||
pos = match(text, pos, c);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
i = skipRuleWhiteSpace(affixPat, i);
|
||||
if (PatternProps.isWhiteSpace(c)) {
|
||||
i = skipPatternWhiteSpace(affixPat, i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2717,18 +2717,18 @@ public class DecimalFormat extends NumberFormat {
|
||||
|
||||
/**
|
||||
* Matches a single character at text[pos] and return the index of the next character
|
||||
* upon success. Return -1 on failure. If isRuleWhiteSpace(ch) then match a run of
|
||||
* upon success. Return -1 on failure. If ch is a Pattern_White_Space then match a run of
|
||||
* white space in text.
|
||||
*/
|
||||
static final int match(String text, int pos, int ch) {
|
||||
if (pos >= text.length()) {
|
||||
return -1;
|
||||
}
|
||||
if (UCharacterProperty.isRuleWhiteSpace(ch)) {
|
||||
if (PatternProps.isWhiteSpace(ch)) {
|
||||
// Advance over run of white space in input text
|
||||
// Must see at least one white space char in input
|
||||
int s = pos;
|
||||
pos = skipRuleWhiteSpace(text, pos);
|
||||
pos = skipPatternWhiteSpace(text, pos);
|
||||
if (pos == s) {
|
||||
return -1;
|
||||
}
|
||||
@ -2747,8 +2747,8 @@ public class DecimalFormat extends NumberFormat {
|
||||
int ch = UTF16.charAt(str, i);
|
||||
i += UTF16.getCharCount(ch);
|
||||
pos = match(text, pos, ch);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(ch)) {
|
||||
i = skipRuleWhiteSpace(str, i);
|
||||
if (PatternProps.isWhiteSpace(ch)) {
|
||||
i = skipPatternWhiteSpace(str, i);
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -8,7 +8,7 @@ package com.ibm.icu.text;
|
||||
|
||||
import java.text.ParsePosition;
|
||||
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
|
||||
/**
|
||||
* A class representing a single rule in a RuleBasedNumberFormat. A rule
|
||||
@ -242,7 +242,7 @@ final class NFRule {
|
||||
// description
|
||||
descriptor = description.substring(0, p);
|
||||
++p;
|
||||
while (p < description.length() && UCharacterProperty.isRuleWhiteSpace(description.charAt(p)))
|
||||
while (p < description.length() && PatternProps.isWhiteSpace(description.charAt(p)))
|
||||
++p;
|
||||
description = description.substring(p);
|
||||
|
||||
@ -281,7 +281,7 @@ final class NFRule {
|
||||
else if (c == '/' || c == '>') {
|
||||
break;
|
||||
}
|
||||
else if (UCharacterProperty.isRuleWhiteSpace(c) || c == ',' || c == '.') {
|
||||
else if (PatternProps.isWhiteSpace(c) || c == ',' || c == '.') {
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Illegal character in rule descriptor");
|
||||
@ -309,7 +309,7 @@ final class NFRule {
|
||||
else if (c == '>') {
|
||||
break;
|
||||
}
|
||||
else if (UCharacterProperty.isRuleWhiteSpace(c) || c == ',' || c == '.') {
|
||||
else if (PatternProps.isWhiteSpace(c) || c == ',' || c == '.') {
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Illegal character is rule descriptor");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -10,7 +10,7 @@ import java.text.ParsePosition;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
|
||||
/**
|
||||
@ -97,8 +97,8 @@ final class NFRuleSet {
|
||||
throw new IllegalArgumentException("Rule set name doesn't end in colon");
|
||||
} else {
|
||||
name = description.substring(0, pos);
|
||||
while (pos < description.length() && UCharacterProperty.isRuleWhiteSpace(description.
|
||||
charAt(++pos))) {
|
||||
while (pos < description.length() && PatternProps.isWhiteSpace(description.
|
||||
charAt(++pos))) {
|
||||
}
|
||||
description = description.substring(pos);
|
||||
descriptions[index] = description;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -19,7 +19,7 @@ import java.util.Set;
|
||||
|
||||
import com.ibm.icu.impl.ICUDebug;
|
||||
import com.ibm.icu.impl.ICUResourceBundle;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.UResourceBundle;
|
||||
import com.ibm.icu.util.UResourceBundleIterator;
|
||||
@ -1448,7 +1448,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
||||
}
|
||||
int lpStart = lp + specialName.length();
|
||||
while (lpStart < lpEnd &&
|
||||
UCharacterProperty.isRuleWhiteSpace(description.charAt(lpStart))) {
|
||||
PatternProps.isWhiteSpace(description.charAt(lpStart))) {
|
||||
++lpStart;
|
||||
}
|
||||
|
||||
@ -1648,7 +1648,7 @@ public class RuleBasedNumberFormat extends NumberFormat {
|
||||
while (start != -1 && start < description.length()) {
|
||||
// seek to the first non-whitespace character...
|
||||
while (start < description.length()
|
||||
&& UCharacterProperty.isRuleWhiteSpace(description.charAt(start))) {
|
||||
&& PatternProps.isWhiteSpace(description.charAt(start))) {
|
||||
++start;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ import java.util.MissingResourceException;
|
||||
import com.ibm.icu.impl.CalendarData;
|
||||
import com.ibm.icu.impl.DateNumberFormat;
|
||||
import com.ibm.icu.impl.ICUCache;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.SimpleCache;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.ZoneMeta;
|
||||
import com.ibm.icu.impl.ZoneStringFormat.ZoneStringInfo;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
@ -1717,7 +1717,7 @@ public class SimpleDateFormat extends DateFormat {
|
||||
while (idx < plen) {
|
||||
|
||||
char pch = patl.charAt(idx);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(pch))
|
||||
if (PatternProps.isWhiteSpace(pch))
|
||||
idx++;
|
||||
else
|
||||
break;
|
||||
@ -1751,16 +1751,16 @@ public class SimpleDateFormat extends DateFormat {
|
||||
while (idx < plen && pos < tlen) {
|
||||
char pch = patl.charAt(idx);
|
||||
char ich = text.charAt(pos);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(pch)
|
||||
&& UCharacterProperty.isRuleWhiteSpace(ich)) {
|
||||
if (PatternProps.isWhiteSpace(pch)
|
||||
&& PatternProps.isWhiteSpace(ich)) {
|
||||
// White space characters found in both patten and input.
|
||||
// Skip contiguous white spaces.
|
||||
while ((idx + 1) < plen &&
|
||||
UCharacterProperty.isRuleWhiteSpace(patl.charAt(idx + 1))) {
|
||||
PatternProps.isWhiteSpace(patl.charAt(idx + 1))) {
|
||||
++idx;
|
||||
}
|
||||
while ((pos + 1) < tlen &&
|
||||
UCharacterProperty.isRuleWhiteSpace(text.charAt(pos + 1))) {
|
||||
PatternProps.isWhiteSpace(text.charAt(pos + 1))) {
|
||||
++pos;
|
||||
}
|
||||
} else if (pch != ich) {
|
||||
@ -2102,7 +2102,7 @@ public class SimpleDateFormat extends DateFormat {
|
||||
return -start;
|
||||
}
|
||||
int c = UTF16.charAt(text, start);
|
||||
if (!UCharacter.isUWhiteSpace(c) || !UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (!UCharacter.isUWhiteSpace(c) || !PatternProps.isWhiteSpace(c)) {
|
||||
break;
|
||||
}
|
||||
start += UTF16.getCharCount(c);
|
||||
|
@ -3325,7 +3325,7 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
if (p == UProperty.CANONICAL_COMBINING_CLASS ||
|
||||
p == UProperty.LEAD_CANONICAL_COMBINING_CLASS ||
|
||||
p == UProperty.TRAIL_CANONICAL_COMBINING_CLASS) {
|
||||
v = Integer.parseInt(Utility.deleteRuleWhiteSpace(valueAlias));
|
||||
v = Integer.parseInt(Utility.deletePatternWhiteSpace(valueAlias));
|
||||
// If the resultant set is empty then the numeric value
|
||||
// was invalid.
|
||||
//mustNotBeEmpty = true;
|
||||
@ -3341,7 +3341,7 @@ public class UnicodeSet extends UnicodeFilter implements Iterable<String>, Compa
|
||||
switch (p) {
|
||||
case UProperty.NUMERIC_VALUE:
|
||||
{
|
||||
double value = Double.parseDouble(Utility.deleteRuleWhiteSpace(valueAlias));
|
||||
double value = Double.parseDouble(Utility.deletePatternWhiteSpace(valueAlias));
|
||||
applyFilter(new NumericValueFilter(value), UCharacterProperty.SRC_CHAR);
|
||||
return this;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
*/
|
||||
package com.ibm.icu.text;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.UCharacterName;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
|
||||
@ -89,7 +89,7 @@ class NameUnicodeTransliterator extends Transliterator {
|
||||
|
||||
// Convert \s+ => SPACE. This assumes there are no
|
||||
// runs of >1 space characters in names.
|
||||
if (UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (PatternProps.isWhiteSpace(c)) {
|
||||
// Ignore leading whitespace
|
||||
if (name.length() > 0 &&
|
||||
name.charAt(name.length()-1) != SPACE) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1996-2010, International Business Machines Corporation and *
|
||||
* Copyright (C) 1996-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -15,8 +15,8 @@ import java.util.Map;
|
||||
* translations. Rule sets are stored in resource bundles indexed by
|
||||
* name. Rules within a rule set are separated by semicolons (';').
|
||||
* To include a literal semicolon, prefix it with a backslash ('\').
|
||||
* Whitespace, as defined by <code>UCharacterProperty.isRuleWhiteSpace()</code>,
|
||||
* is ignored. If the first non-blank character on a line is '#',
|
||||
* Unicode Pattern_White_Space is ignored.
|
||||
* If the first non-blank character on a line is '#',
|
||||
* the entire line is ignored as a comment. </p>
|
||||
*
|
||||
* <p>Each set of rules consists of two groups, one forward, and one
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2001-2010, International Business Machines
|
||||
* Copyright (c) 2001-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*/
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.icu.impl.IllegalIcuArgumentException;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.text.RuleBasedTransliterator.Data;
|
||||
@ -455,7 +455,7 @@ class TransliteratorParser {
|
||||
// Since all syntax characters are in the BMP, fetching
|
||||
// 16-bit code units suffices here.
|
||||
char c = rule.charAt(pos++);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (PatternProps.isWhiteSpace(c)) {
|
||||
continue;
|
||||
}
|
||||
// HALF_ENDERS is all chars that end a rule half: "<>=;"
|
||||
@ -930,7 +930,7 @@ class TransliteratorParser {
|
||||
int limit = rule.length();
|
||||
while (pos < limit) {
|
||||
char c = rule.charAt(pos++);
|
||||
if (UCharacterProperty.isRuleWhiteSpace(c)) {
|
||||
if (PatternProps.isWhiteSpace(c)) {
|
||||
continue;
|
||||
}
|
||||
// Skip lines starting with the comment character
|
||||
@ -962,7 +962,7 @@ class TransliteratorParser {
|
||||
rule.regionMatches(pos, ID_TOKEN, 0, ID_TOKEN_LEN)) {
|
||||
pos += ID_TOKEN_LEN;
|
||||
c = rule.charAt(pos);
|
||||
while (UCharacterProperty.isRuleWhiteSpace(c) && pos < limit) {
|
||||
while (PatternProps.isWhiteSpace(c) && pos < limit) {
|
||||
++pos;
|
||||
c = rule.charAt(pos);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import com.ibm.icu.impl.Norm2AllModes;
|
||||
import com.ibm.icu.impl.Normalizer2Impl;
|
||||
import com.ibm.icu.impl.PatternProps;
|
||||
import com.ibm.icu.impl.UCharacterName;
|
||||
import com.ibm.icu.impl.UCharacterProperty;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UCharacterCategory;
|
||||
@ -181,23 +180,23 @@ public final class UCharacterTest extends TestFmwk
|
||||
" and \\u" + hex(nonwhitespaces[i]));
|
||||
}
|
||||
|
||||
int rulewhitespace[] = {0x9, 0xd, 0x20, 0x85,
|
||||
int patternWhiteSpace[] = {0x9, 0xd, 0x20, 0x85,
|
||||
0x200e, 0x200f, 0x2028, 0x2029};
|
||||
int nonrulewhitespace[] = {0x8, 0xe, 0x21, 0x86, 0xa0, 0xa1,
|
||||
int nonPatternWhiteSpace[] = {0x8, 0xe, 0x21, 0x86, 0xa0, 0xa1,
|
||||
0x1680, 0x1681, 0x180e, 0x180f,
|
||||
0x1FFF, 0x2000, 0x200a, 0x200b,
|
||||
0x2010, 0x202f, 0x2030, 0x205f,
|
||||
0x2060, 0x3000, 0x3001};
|
||||
for (int i = 0; i < rulewhitespace.length; i ++) {
|
||||
if (!UCharacterProperty.isRuleWhiteSpace(rulewhitespace[i])) {
|
||||
errln("\\u" + Utility.hex(rulewhitespace[i], 4)
|
||||
+ " expected to be a rule white space");
|
||||
for (int i = 0; i < patternWhiteSpace.length; i ++) {
|
||||
if (!PatternProps.isWhiteSpace(patternWhiteSpace[i])) {
|
||||
errln("\\u" + Utility.hex(patternWhiteSpace[i], 4)
|
||||
+ " expected to be a Pattern_White_Space");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < nonrulewhitespace.length; i ++) {
|
||||
if (UCharacterProperty.isRuleWhiteSpace(nonrulewhitespace[i])) {
|
||||
errln("\\u" + Utility.hex(nonrulewhitespace[i], 4)
|
||||
+ " expected to be a non rule white space");
|
||||
for (int i = 0; i < nonPatternWhiteSpace.length; i ++) {
|
||||
if (PatternProps.isWhiteSpace(nonPatternWhiteSpace[i])) {
|
||||
errln("\\u" + Utility.hex(nonPatternWhiteSpace[i], 4)
|
||||
+ " expected to be a non-Pattern_White_Space");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1327,13 +1327,13 @@ public class UnicodeSetTest extends TestFmwk {
|
||||
|
||||
public void TestEscapePattern() {
|
||||
// The following pattern must contain at least one range "c-d"
|
||||
// for which isRuleWhiteSpace(c) or isRuleWhiteSpace(d) is true.
|
||||
// where c or d is a Pattern_White_Space.
|
||||
String pattern =
|
||||
"[\\uFEFF \\u200E-\\u20FF \\uFFF9-\\uFFFC \\U0001D173-\\U0001D17A \\U000F0000-\\U000FFFFD ]";
|
||||
String exp =
|
||||
"[\\u200E-\\u20FF\\uFEFF\\uFFF9-\\uFFFC\\U0001D173-\\U0001D17A\\U000F0000-\\U000FFFFD]";
|
||||
// We test this with two passes; in the second pass we
|
||||
// pre-unescape the pattern. Since U+200E is rule whitespace,
|
||||
// pre-unescape the pattern. Since U+200E is Pattern_White_Space,
|
||||
// this fails -- which is what we expect.
|
||||
for (int pass=1; pass<=2; ++pass) {
|
||||
String pat = pattern;
|
||||
|
@ -3421,9 +3421,9 @@ public class TransliteratorTest extends TestFmwk {
|
||||
|
||||
|
||||
/**
|
||||
* Test handling of rule whitespace, for both RBT and UnicodeSet.
|
||||
* Test handling of Pattern_White_Space, for both RBT and UnicodeSet.
|
||||
*/
|
||||
public void TestRuleWhitespace() {
|
||||
public void TestPatternWhitespace() {
|
||||
// Rules
|
||||
String r = "a > \u200E b;";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user