Tokenizer::simplifyQuestionMark: use links instead of indentation level number.
This commit is contained in:
parent
6e164ae7ed
commit
b6763313c5
|
@ -4646,21 +4646,16 @@ bool Tokenizer::simplifyQuestionMark()
|
||||||
|
|
||||||
// Find the ":" token..
|
// Find the ":" token..
|
||||||
Token *semicolon = 0;
|
Token *semicolon = 0;
|
||||||
{
|
|
||||||
unsigned int parlevel = 0;
|
|
||||||
for (Token *tok2 = tok; tok2; tok2 = tok2->next()) {
|
for (Token *tok2 = tok; tok2; tok2 = tok2->next()) {
|
||||||
if (tok2->str() == "(")
|
if (tok2->str() == "(" || tok2->str() == "[")
|
||||||
++parlevel;
|
tok2 = tok2->link();
|
||||||
else if (tok2->str() == ")") {
|
else if (tok2->str() == ")" || tok2->str() == "]")
|
||||||
if (parlevel == 0)
|
|
||||||
break;
|
break;
|
||||||
--parlevel;
|
else if (tok2->str() == ":") {
|
||||||
} else if (parlevel == 0 && tok2->str() == ":") {
|
|
||||||
semicolon = tok2;
|
semicolon = tok2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!semicolon || !semicolon->next())
|
if (!semicolon || !semicolon->next())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue