Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1808)

Unified Diff: icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/NumberParserImpl.java

Issue 339630043: ticket:13736 Change number parsing to require locale currency when using non-currency parse functio… (Closed) Base URL: svn+icussh://source.icu-project.org/repos/icu/trunk/
Patch Set: Porting to ICU4C and adding locale long name parsing as alternative to currency data parsing. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/NumberParserImpl.java
===================================================================
--- icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/NumberParserImpl.java (revision 41389)
+++ icu4j/main/classes/core/src/com/ibm/icu/impl/number/parse/NumberParserImpl.java (working copy)
@@ -49,6 +49,7 @@
factory.symbols = symbols;
factory.ignorables = ignorables;
factory.locale = locale;
+ factory.parseFlags = parseFlags;
ParsedPatternInfo patternInfo = PatternStringParser.parseToPatternInfo(pattern);
AffixMatcher.createMatchers(patternInfo, parser, factory, ignorables, parseFlags);
@@ -65,7 +66,7 @@
parser.addMatcher(InfinityMatcher.getInstance(symbols));
parser.addMatcher(PaddingMatcher.getInstance("@"));
parser.addMatcher(ScientificMatcher.getInstance(symbols, grouper));
- parser.addMatcher(CombinedCurrencyMatcher.getInstance(currency, symbols));
+ parser.addMatcher(CombinedCurrencyMatcher.getInstance(currency, symbols, parseFlags));
parser.addMatcher(new RequireNumberValidator());
parser.freeze();
@@ -175,6 +176,9 @@
if (parseCurrency || affixProvider.hasCurrencySign()) {
parseFlags |= ParsingUtils.PARSE_FLAG_MONETARY_SEPARATORS;
}
+ if (!parseCurrency) {
+ parseFlags |= ParsingUtils.PARSE_FLAG_NO_FOREIGN_CURRENCIES;
+ }
IgnorablesMatcher ignorables = isStrict ? IgnorablesMatcher.STRICT : IgnorablesMatcher.DEFAULT;
NumberParserImpl parser = new NumberParserImpl(parseFlags);
@@ -184,6 +188,7 @@
factory.symbols = symbols;
factory.ignorables = ignorables;
factory.locale = locale;
+ factory.parseFlags = parseFlags;
//////////////////////
/// AFFIX MATCHERS ///
@@ -197,7 +202,7 @@
////////////////////////
if (parseCurrency || affixProvider.hasCurrencySign()) {
- parser.addMatcher(CombinedCurrencyMatcher.getInstance(currency, symbols));
+ parser.addMatcher(CombinedCurrencyMatcher.getInstance(currency, symbols, parseFlags));
}
///////////////

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b