Tokenizer:: Use 'link' instead of 'parens' variable.

This commit is contained in:
Edoardo Prezioso 2012-01-30 12:21:08 +01:00
parent 9df6088ddd
commit a93af0dba6
1 changed files with 8 additions and 14 deletions

View File

@ -1040,24 +1040,18 @@ void Tokenizer::simplifyTypedef()
// check for template
if (tok->strAt(offset) == "<") {
unsigned int level = 0;
unsigned int paren = 0;
typeEnd = tok->tokAt(offset + 1);
for (; typeEnd ; typeEnd = typeEnd->next()) {
if (typeEnd->str() == ">") {
if (!paren) {
if (!level)
break;
--level;
}
} else if (typeEnd->str() == "<") {
if (!paren)
++level;
} else if (typeEnd->str() == "(")
++paren;
else if (typeEnd->str() == ")") {
if (!paren)
if (!level)
break;
--paren;
--level;
} else if (typeEnd->str() == "<") {
++level;
} else if (typeEnd->str() == "(" || typeEnd->str() == "[")
typeEnd = typeEnd->link();
else if (typeEnd->str() == ")" || typeEnd->str() == "]") {
break;
}
}