diff options
author | mcheshkov <mcheshkov@yandex-team.ru> | 2022-02-10 16:46:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:15 +0300 |
commit | e9d19cec64684c9c1e6b0c98297e5b895cf904fe (patch) | |
tree | 2768b1223e96a8a0610a93d18425d9647c1123c8 /contrib/libs/icu/common/rbbiscan.cpp | |
parent | 60040c91ffe701a84689b2c6310ff845e65cff42 (diff) | |
download | ydb-e9d19cec64684c9c1e6b0c98297e5b895cf904fe.tar.gz |
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/common/rbbiscan.cpp')
-rw-r--r-- | contrib/libs/icu/common/rbbiscan.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/contrib/libs/icu/common/rbbiscan.cpp b/contrib/libs/icu/common/rbbiscan.cpp index 4eb324b4b9..887192d3a9 100644 --- a/contrib/libs/icu/common/rbbiscan.cpp +++ b/contrib/libs/icu/common/rbbiscan.cpp @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // // file: rbbiscan.cpp @@ -47,7 +47,7 @@ // //------------------------------------------------------------------------------ static const UChar gRuleSet_rule_char_pattern[] = { - // Characters that may appear as literals in patterns without escaping or quoting. + // Characters that may appear as literals in patterns without escaping or quoting. // [ ^ [ \ p { Z } \ u 0 0 2 0 0x5b, 0x5e, 0x5b, 0x5c, 0x70, 0x7b, 0x5a, 0x7d, 0x5c, 0x75, 0x30, 0x30, 0x32, 0x30, // - \ u 0 0 7 f ] - [ \ p @@ -372,7 +372,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action) // (forward, reverse, safe_forward, safe_reverse) // OR this rule into the appropriate group of them. // - RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree); + RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree); if (*destRules != NULL) { // This is not the first rule encounted. @@ -380,7 +380,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action) // with the current rule expression (on the Node Stack) // with the resulting OR expression going to *destRules // - thisRule = fNodeStack[fNodeStackPtr]; + thisRule = fNodeStack[fNodeStackPtr]; RBBINode *prevRules = *destRules; RBBINode *orNode = pushNewNode(RBBINode::opOr); if (U_FAILURE(*fRB->fStatus)) { @@ -559,10 +559,10 @@ UBool RBBIRuleScanner::doParseActions(int32_t action) fRB->fDefaultTree = &fRB->fSafeRevTree; } else if (opt == UNICODE_STRING("lookAheadHardBreak", 18)) { fRB->fLookAheadHardBreak = TRUE; - } else if (opt == UNICODE_STRING("quoted_literals_only", 20)) { - fRuleSets[kRuleSet_rule_char-128].clear(); - } else if (opt == UNICODE_STRING("unquoted_literals", 17)) { - fRuleSets[kRuleSet_rule_char-128].applyPattern(UnicodeString(gRuleSet_rule_char_pattern), *fRB->fStatus); + } else if (opt == UNICODE_STRING("quoted_literals_only", 20)) { + fRuleSets[kRuleSet_rule_char-128].clear(); + } else if (opt == UNICODE_STRING("unquoted_literals", 17)) { + fRuleSets[kRuleSet_rule_char-128].applyPattern(UnicodeString(gRuleSet_rule_char_pattern), *fRB->fStatus); } else { error(U_BRK_UNRECOGNIZED_OPTION); } @@ -822,23 +822,23 @@ static const UChar chRParen = 0x29; //------------------------------------------------------------------------------ // -// stripRules Return a rules string without extra spaces. -// (Comments are removed separately, during rule parsing.) +// stripRules Return a rules string without extra spaces. +// (Comments are removed separately, during rule parsing.) // //------------------------------------------------------------------------------ UnicodeString RBBIRuleScanner::stripRules(const UnicodeString &rules) { UnicodeString strippedRules; - int32_t rulesLength = rules.length(); - bool skippingSpaces = false; - - for (int32_t idx=0; idx<rulesLength; idx = rules.moveIndex32(idx, 1)) { - UChar32 cp = rules.char32At(idx); - bool whiteSpace = u_hasBinaryProperty(cp, UCHAR_PATTERN_WHITE_SPACE); - if (skippingSpaces && whiteSpace) { - continue; + int32_t rulesLength = rules.length(); + bool skippingSpaces = false; + + for (int32_t idx=0; idx<rulesLength; idx = rules.moveIndex32(idx, 1)) { + UChar32 cp = rules.char32At(idx); + bool whiteSpace = u_hasBinaryProperty(cp, UCHAR_PATTERN_WHITE_SPACE); + if (skippingSpaces && whiteSpace) { + continue; } - strippedRules.append(cp); - skippingSpaces = whiteSpace; + strippedRules.append(cp); + skippingSpaces = whiteSpace; } return strippedRules; } @@ -939,7 +939,7 @@ void RBBIRuleScanner::nextChar(RBBIRuleChar &c) { // It will be treated as white-space, and serves to break up anything // that might otherwise incorrectly clump together with a comment in // the middle (a variable name, for example.) - int32_t commentStart = fScanIndex; + int32_t commentStart = fScanIndex; for (;;) { c.fChar = nextCharLL(); if (c.fChar == (UChar32)-1 || // EOF @@ -948,9 +948,9 @@ void RBBIRuleScanner::nextChar(RBBIRuleChar &c) { c.fChar == chNEL || c.fChar == chLS) {break;} } - for (int32_t i=commentStart; i<fNextIndex-1; ++i) { - fRB->fStrippedRules.setCharAt(i, u' '); - } + for (int32_t i=commentStart; i<fNextIndex-1; ++i) { + fRB->fStrippedRules.setCharAt(i, u' '); + } } if (c.fChar == (UChar32)-1) { return; @@ -1169,12 +1169,12 @@ RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) { if (U_FAILURE(*fRB->fStatus)) { return NULL; } - if (fNodeStackPtr >= kStackSize - 1) { - error(U_BRK_RULE_SYNTAX); + if (fNodeStackPtr >= kStackSize - 1) { + error(U_BRK_RULE_SYNTAX); RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow."); return NULL; } - fNodeStackPtr++; + fNodeStackPtr++; fNodeStack[fNodeStackPtr] = new RBBINode(t); if (fNodeStack[fNodeStackPtr] == NULL) { *fRB->fStatus = U_MEMORY_ALLOCATION_ERROR; @@ -1274,10 +1274,10 @@ void RBBIRuleScanner::scanSet() { } -int32_t RBBIRuleScanner::numRules() { - return fRuleNum; -} - +int32_t RBBIRuleScanner::numRules() { + return fRuleNum; +} + U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ |