X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..b801cf366c7671a99bdcef84d1e9c0ec64b36723:/icuSources/i18n/regexst.cpp?ds=sidebyside diff --git a/icuSources/i18n/regexst.cpp b/icuSources/i18n/regexst.cpp index b8ad297d..a8cbf23f 100644 --- a/icuSources/i18n/regexst.cpp +++ b/icuSources/i18n/regexst.cpp @@ -1,7 +1,7 @@ // // regexst.h // -// Copyright (C) 2004-2010, International Business Machines Corporation and others. +// Copyright (C) 2004-2015, International Business Machines Corporation and others. // All Rights Reserved. // // This file contains class RegexStaticSets @@ -55,11 +55,6 @@ static const UChar gRuleSet_rule_char_pattern[] = { // \ { \ } \ ^ \ $ \ | \ \ \ . ] 0x5c, 0x7b,0x5c, 0x7d, 0x5c, 0x5e, 0x5c, 0x24, 0x5c, 0x7c, 0x5c, 0x5c, 0x5c, 0x2e, 0x5d, 0}; - -static const UChar gRuleSet_digit_char_pattern[] = { -// [ 0 - 9 ] - 0x5b, 0x30, 0x2d, 0x39, 0x5d, 0}; - // // Here are the backslash escape characters that ICU's unescape() function // will handle. @@ -79,8 +74,10 @@ static const UChar gIsWordPattern[] = { 0x5c, 0x70, 0x7b, 0x4d, 0x7d, // \ p { N d } Digit_Numeric 0x5c, 0x70, 0x7b, 0x4e, 0x64, 0x7d, -// \ p { P c } ] Connector_Punctuation - 0x5c, 0x70, 0x7b, 0x50, 0x63, 0x7d, 0x5d, 0}; +// \ p { P c } Connector_Punctuation + 0x5c, 0x70, 0x7b, 0x50, 0x63, 0x7d, +// \ u 2 0 0 c \ u 2 0 0 d ] + 0x5c, 0x75, 0x32, 0x30, 0x30, 0x63, 0x5c, 0x75, 0x32, 0x30, 0x30, 0x64, 0x5d, 0}; // @@ -142,6 +139,7 @@ static const UChar gGC_LVTPattern[] = { RegexStaticSets *RegexStaticSets::gStaticSets = NULL; +UInitOnce gStaticSetsInitOnce = U_INITONCE_INITIALIZER; RegexStaticSets::RegexStaticSets(UErrorCode *status) : @@ -210,23 +208,29 @@ fEmptyText(NULL) // Sets used while parsing rules, but not referenced from the parse state table fRuleSets[kRuleSet_rule_char-128] = UnicodeSet(UnicodeString(TRUE, gRuleSet_rule_char_pattern, -1), *status); - fRuleSets[kRuleSet_digit_char-128] = UnicodeSet(UnicodeString(TRUE, gRuleSet_digit_char_pattern, -1), *status); + fRuleSets[kRuleSet_digit_char-128].add((UChar)0x30, (UChar)0x39); // [0-9] + fRuleSets[kRuleSet_ascii_letter-128].add((UChar)0x41, (UChar)0x5A); // [A-Z] + fRuleSets[kRuleSet_ascii_letter-128].add((UChar)0x61, (UChar)0x7A); // [a-z] fRuleDigitsAlias = &fRuleSets[kRuleSet_digit_char-128]; - for (i=0; i<(int32_t)(sizeof(fRuleSets)/sizeof(fRuleSets[0])); i++) { + for (i=0; i