ICU-1428 quick hack implememtation of paren matching...

X-SVN-Rev: 6696
This commit is contained in:
Eric Mader 2001-11-08 21:52:08 +00:00
parent d2a52c64c6
commit e6919d7596
2 changed files with 14 additions and 1 deletions

View File

@ -47,7 +47,10 @@ UBool ScriptRun::next()
UScriptCode sc = uscript_getScript(ch, &error);
if (sameScript(scriptCode, sc)) {
if (ch == ')' && parenSP >= 0 && parenStack[parenSP] != scriptCode) {
sc = parenStack[parenSP--];
break;
} else if (sameScript(scriptCode, sc)) {
if (scriptCode <= USCRIPT_INHERITED && sc > USCRIPT_INHERITED) {
scriptCode = sc;
}
@ -58,6 +61,12 @@ UBool ScriptRun::next()
scriptEnd -= 1;
}
for (int32_t i = scriptStart; i < scriptEnd; i += 1) {
if (charArray[i] == '(') {
parenStack[++parenSP] = scriptCode;
}
}
break;
}
}

View File

@ -58,6 +58,9 @@ private:
int32_t scriptStart;
int32_t scriptEnd;
UScriptCode scriptCode;
UScriptCode parenStack[128];
int32_t parenSP;
};
inline ScriptRun::ScriptRun()
@ -95,6 +98,7 @@ inline void ScriptRun::reset()
scriptStart = charStart;
scriptEnd = charStart;
scriptCode = USCRIPT_INVALID_CODE;
parenSP = -1;
}
inline void ScriptRun::reset(int32_t start, int32_t length)