summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/common/rbbisetb.cpp
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2018-03-26 15:29:02 -0700
committerSteven R. Loomis <srloomis@us.ibm.com>2018-04-02 18:18:28 -0700
commit64211405dab824a570e52d000891c49415cc42b8 (patch)
tree4c196d0e2c19e083db1e124139dd4ba6272fd049 /deps/icu-small/source/common/rbbisetb.cpp
parent88773af540a36b23a47af0d6c4ce03b8cc3ef9aa (diff)
downloadandroid-node-v8-64211405dab824a570e52d000891c49415cc42b8.tar.gz
android-node-v8-64211405dab824a570e52d000891c49415cc42b8.tar.bz2
android-node-v8-64211405dab824a570e52d000891c49415cc42b8.zip
deps: ICU 61.1 bump
- Update to released ICU 61.1, including: - CLDR 33 (many new languages and data improvements) - Many small API additions, improvements, and bug fixes - note: 'icu::' namespace is no longer used by default (Necessated https://github.com/nodejs/node/pull/18667 ) PR-URL: https://github.com/nodejs/node/pull/19621 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/icu-small/source/common/rbbisetb.cpp')
-rw-r--r--deps/icu-small/source/common/rbbisetb.cpp55
1 files changed, 38 insertions, 17 deletions
diff --git a/deps/icu-small/source/common/rbbisetb.cpp b/deps/icu-small/source/common/rbbisetb.cpp
index c172da00df..4e7389b4af 100644
--- a/deps/icu-small/source/common/rbbisetb.cpp
+++ b/deps/icu-small/source/common/rbbisetb.cpp
@@ -91,7 +91,7 @@ RBBISetBuilder::~RBBISetBuilder()
// from the Unicode Sets.
//
//------------------------------------------------------------------------
-void RBBISetBuilder::build() {
+void RBBISetBuilder::buildRanges() {
RBBINode *usetNode;
RangeDescriptor *rlRange;
@@ -245,11 +245,16 @@ void RBBISetBuilder::build() {
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "rgroup")) {printRangeGroups();}
if (fRB->fDebugEnv && uprv_strstr(fRB->fDebugEnv, "esets")) {printSets();}
+}
+
+
+//
+// Build the Trie table for mapping UChar32 values to the corresponding
+// range group number.
+//
+void RBBISetBuilder::buildTrie() {
+ RangeDescriptor *rlRange;
- //
- // Build the Trie table for mapping UChar32 values to the corresponding
- // range group number
- //
fTrie = utrie2_open(0, // Initial value for all code points.
0, // Error value for out-of-range input.
fStatus);
@@ -265,6 +270,22 @@ void RBBISetBuilder::build() {
}
+void RBBISetBuilder::mergeCategories(int32_t left, int32_t right) {
+ U_ASSERT(left >= 1);
+ U_ASSERT(right > left);
+ for (RangeDescriptor *rd = fRangeList; rd != nullptr; rd = rd->fNext) {
+ int32_t rangeNum = rd->fNum & ~DICT_BIT;
+ int32_t rangeDict = rd->fNum & DICT_BIT;
+ if (rangeNum == right) {
+ rd->fNum = left | rangeDict;
+ } else if (rangeNum > right) {
+ rd->fNum--;
+ }
+ }
+ --fGroupCount;
+}
+
+
//-----------------------------------------------------------------------------------
//
// getTrieSize() Return the size that will be required to serialize the Trie.
@@ -446,7 +467,7 @@ void RBBISetBuilder::printRangeGroups() {
lastPrintedGroupNum = groupNum;
RBBIDebugPrintf("%2i ", groupNum);
- if (rlRange->fNum & 0x4000) { RBBIDebugPrintf(" <DICT> ");}
+ if (rlRange->fNum & DICT_BIT) { RBBIDebugPrintf(" <DICT> ");}
for (i=0; i<rlRange->fIncludesSets->size(); i++) {
RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i);
@@ -639,20 +660,20 @@ void RangeDescriptor::split(UChar32 where, UErrorCode &status) {
void RangeDescriptor::setDictionaryFlag() {
int i;
- for (i=0; i<this->fIncludesSets->size(); i++) {
- RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i);
- UnicodeString setName;
- RBBINode *setRef = usetNode->fParent;
- if (setRef != NULL) {
+ static const char16_t *dictionary = u"dictionary";
+ for (i=0; i<fIncludesSets->size(); i++) {
+ RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i);
+ RBBINode *setRef = usetNode->fParent;
+ if (setRef != nullptr) {
RBBINode *varRef = setRef->fParent;
- if (varRef != NULL && varRef->fType == RBBINode::varRef) {
- setName = varRef->fText;
+ if (varRef && varRef->fType == RBBINode::varRef) {
+ const UnicodeString *setName = &varRef->fText;
+ if (setName->compare(dictionary, -1) == 0) {
+ fNum |= RBBISetBuilder::DICT_BIT;
+ break;
+ }
}
}
- if (setName.compare(UNICODE_STRING("dictionary", 10)) == 0) { // TODO: no string literals.
- this->fNum |= 0x4000;
- break;
- }
}
}