mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 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,6 +47,7 @@
|
|||
//
|
||||
//------------------------------------------------------------------------------
|
||||
static const UChar gRuleSet_rule_char_pattern[] = {
|
||||
// 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
|
||||
|
|
@ -371,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->fReverseTree : fRB->fDefaultTree);
|
||||
RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree);
|
||||
|
||||
if (*destRules != NULL) {
|
||||
// This is not the first rule encounted.
|
||||
|
|
@ -379,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
|
||||
//
|
||||
RBBINode *thisRule = fNodeStack[fNodeStackPtr];
|
||||
thisRule = fNodeStack[fNodeStackPtr];
|
||||
RBBINode *prevRules = *destRules;
|
||||
RBBINode *orNode = pushNewNode(RBBINode::opOr);
|
||||
if (U_FAILURE(*fRB->fStatus)) {
|
||||
|
|
@ -558,6 +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 {
|
||||
error(U_BRK_UNRECOGNIZED_OPTION);
|
||||
}
|
||||
|
|
@ -817,27 +822,24 @@ static const UChar chRParen = 0x29;
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// stripRules Return a rules string without unnecessary
|
||||
// characters.
|
||||
// stripRules Return a rules string without extra spaces.
|
||||
// (Comments are removed separately, during rule parsing.)
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
UnicodeString RBBIRuleScanner::stripRules(const UnicodeString &rules) {
|
||||
UnicodeString strippedRules;
|
||||
int rulesLength = rules.length();
|
||||
for (int idx = 0; idx < rulesLength; ) {
|
||||
UChar ch = rules[idx++];
|
||||
if (ch == chPound) {
|
||||
while (idx < rulesLength
|
||||
&& ch != chCR && ch != chLF && ch != chNEL)
|
||||
{
|
||||
ch = rules[idx++];
|
||||
}
|
||||
}
|
||||
if (!u_isISOControl(ch)) {
|
||||
strippedRules.append(ch);
|
||||
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 = strippedRules.unescape();
|
||||
return strippedRules;
|
||||
}
|
||||
|
||||
|
|
@ -937,6 +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;
|
||||
for (;;) {
|
||||
c.fChar = nextCharLL();
|
||||
if (c.fChar == (UChar32)-1 || // EOF
|
||||
|
|
@ -945,6 +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' ');
|
||||
}
|
||||
}
|
||||
if (c.fChar == (UChar32)-1) {
|
||||
return;
|
||||
|
|
@ -1116,22 +1122,6 @@ void RBBIRuleScanner::parse() {
|
|||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// If there were NO user specified reverse rules, set up the equivalent of ".*;"
|
||||
//
|
||||
if (fRB->fReverseTree == NULL) {
|
||||
fRB->fReverseTree = pushNewNode(RBBINode::opStar);
|
||||
RBBINode *operand = pushNewNode(RBBINode::setRef);
|
||||
if (U_FAILURE(*fRB->fStatus)) {
|
||||
return;
|
||||
}
|
||||
findSetFor(UnicodeString(TRUE, kAny, 3), operand);
|
||||
fRB->fReverseTree->fLeftChild = operand;
|
||||
operand->fParent = fRB->fReverseTree;
|
||||
fNodeStackPtr -= 2;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Parsing of the input RBBI rules is complete.
|
||||
// We now have a parse tree for the rule expressions
|
||||
|
|
@ -1179,13 +1169,12 @@ RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) {
|
|||
if (U_FAILURE(*fRB->fStatus)) {
|
||||
return NULL;
|
||||
}
|
||||
fNodeStackPtr++;
|
||||
if (fNodeStackPtr >= kStackSize) {
|
||||
error(U_BRK_INTERNAL_ERROR);
|
||||
if (fNodeStackPtr >= kStackSize - 1) {
|
||||
error(U_BRK_RULE_SYNTAX);
|
||||
RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow.");
|
||||
*fRB->fStatus = U_BRK_INTERNAL_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
fNodeStackPtr++;
|
||||
fNodeStack[fNodeStackPtr] = new RBBINode(t);
|
||||
if (fNodeStack[fNodeStackPtr] == NULL) {
|
||||
*fRB->fStatus = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue