UBool ScriptRun::next()
{
int32_t startSP = parenSP; // used to find the first new open character
UErrorCode error = U_ZERO_ERROR;
// if we've fallen off the end of the text, we're done if (scriptEnd >= charLimit) { returnfalse;
}
scriptCode = USCRIPT_COMMON;
for (scriptStart = scriptEnd; scriptEnd < charLimit; scriptEnd += 1) {
char16_t high = charArray[scriptEnd];
UChar32 ch = high;
// if the character is a high surrogate and it's not the last one // in the text, see if it's followed by a low surrogate if (high >= 0xD800 && high <= 0xDBFF && scriptEnd < charLimit - 1)
{
char16_t low = charArray[scriptEnd + 1];
// if it is followed by a low surrogate, // consume it and form the full character if (low >= 0xDC00 && low <= 0xDFFF) {
ch = (high - 0xD800) * 0x0400 + low - 0xDC00 + 0x10000;
scriptEnd += 1;
}
}
// Paired character handling: // // if it's an open character, push it onto the stack. // if it's a close character, find the matching open on the // stack, and use that script code. Any non-matching open // characters above it on the stack will be poped. if (pairIndex >= 0) { if ((pairIndex & 1) == 0) {
parenStack[++parenSP].pairIndex = pairIndex;
parenStack[parenSP].scriptCode = scriptCode;
} elseif (parenSP >= 0) {
int32_t pi = pairIndex & ~1;
if (sameScript(scriptCode, sc)) { if (scriptCode <= USCRIPT_INHERITED && sc > USCRIPT_INHERITED) {
scriptCode = sc;
// now that we have a final script code, fix any open // characters we pushed before we knew the script code. while (startSP < parenSP) {
parenStack[++startSP].scriptCode = scriptCode;
}
}
// if this character is a close paired character, // pop it from the stack if (pairIndex >= 0 && (pairIndex & 1) != 0 && parenSP >= 0) {
parenSP -= 1;
startSP -= 1;
}
} else { // if the run broke on a surrogate pair, // end it before the high surrogate if (ch >= 0x10000) {
scriptEnd -= 1;
}
break;
}
}
returntrue;
}
U_NAMESPACE_END
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.