Add simplification of the consecutive braces before the end of 'tokenize()' function.
This commit is contained in:
parent
5cbfbe31c1
commit
ed6a0e14c4
|
@ -2500,6 +2500,16 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
tok->next()->deleteNext();
|
||||
}
|
||||
|
||||
// Remove redundant consecutive braces, i.e. '.. { { .. } } ..' -> '.. { .. } ..'.
|
||||
for (Token *tok = _tokens; tok; ) {
|
||||
if (Token::simpleMatch(tok, "{ {") && Token::simpleMatch(tok->next()->link(), "} }")) {
|
||||
//remove internal parentheses
|
||||
tok->next()->link()->deleteThis();
|
||||
tok->deleteNext();
|
||||
} else
|
||||
tok = tok->next();
|
||||
}
|
||||
|
||||
return validate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -4329,9 +4339,7 @@ bool Tokenizer::simplifyTokenList()
|
|||
simplifyFlowControl();
|
||||
|
||||
// Remove redundant consecutive braces, i.e. '.. { { .. } } ..' -> '.. { .. } ..'.
|
||||
{
|
||||
Token *tok = _tokens;
|
||||
while (tok) {
|
||||
for (Token *tok = _tokens; tok; ) {
|
||||
if (Token::simpleMatch(tok, "{ {") && Token::simpleMatch(tok->next()->link(), "} }")) {
|
||||
//remove internal parentheses
|
||||
tok->next()->link()->deleteThis();
|
||||
|
@ -4339,7 +4347,6 @@ bool Tokenizer::simplifyTokenList()
|
|||
} else
|
||||
tok = tok->next();
|
||||
}
|
||||
}
|
||||
|
||||
if (!validate())
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue