Fixed #1049 (Tokenizer: internal error for 'std::list<std::string[8]> w1, w2;')

This commit is contained in:
Daniel Marjamäki 2009-12-05 22:19:54 +01:00
parent da4d03f6c4
commit e66156ab5c
1 changed files with 14 additions and 5 deletions

View File

@ -3118,15 +3118,24 @@ void Tokenizer::simplifyVarDecl()
{ {
tok2->str(";"); tok2->str(";");
insertTokens(tok2, type0, typelen); insertTokens(tok2, type0, typelen);
std::list<Token *> link; std::stack<Token *> link1;
std::stack<Token *> link2;
while (((typelen--) > 0) && (0 != (tok2 = tok2->next()))) while (((typelen--) > 0) && (0 != (tok2 = tok2->next())))
{ {
if (tok2->str() == "(") if (tok2->str() == "(")
link.push_back(tok2); link1.push(tok2);
else if (tok2->str() == ")" && !link.empty()) else if (tok2->str() == ")" && !link1.empty())
{ {
Token::createMutualLinks(tok2, link.back()); Token::createMutualLinks(tok2, link1.top());
link.pop_back(); link1.pop();
}
else if (tok2->str() == "[")
link2.push(tok2);
else if (tok2->str() == "]" && !link2.empty())
{
Token::createMutualLinks(tok2, link2.top());
link2.pop();
} }
} }
} }