Adapt %var%|%num% changes with Tokenizer, part 1.
This commit is contained in:
parent
9d0a295b85
commit
2b4215ea7a
|
@ -2108,10 +2108,7 @@ bool Tokenizer::hasEnumsWithTypedef()
|
||||||
void Tokenizer::concatenateDoubleSharp()
|
void Tokenizer::concatenateDoubleSharp()
|
||||||
{
|
{
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
// TODO: pattern should be "%var%|%num% ## %var%|%num%"
|
while (Token::Match(tok, "%num%|%var% ## %num%|%var%")) {
|
||||||
while (Token::Match(tok, "%any% ## %any%") &&
|
|
||||||
(tok->isName() || tok->isNumber()) &&
|
|
||||||
(tok->tokAt(2)->isName() || tok->tokAt(2)->isNumber())) {
|
|
||||||
tok->str(tok->str() + tok->strAt(2));
|
tok->str(tok->str() + tok->strAt(2));
|
||||||
tok->deleteNext(2);
|
tok->deleteNext(2);
|
||||||
}
|
}
|
||||||
|
@ -2180,8 +2177,7 @@ void Tokenizer::simplifyRoundCurlyParenthesis()
|
||||||
tok->linkAt(2)->previous()->deleteNext(3);
|
tok->linkAt(2)->previous()->deleteNext(3);
|
||||||
tok->deleteNext(2);
|
tok->deleteNext(2);
|
||||||
}
|
}
|
||||||
if (Token::Match(tok, "( { %any% ; } )") &&
|
if (Token::Match(tok, "( { %bool%|%char%|%num%|%str%|%var% ; } )")) {
|
||||||
(tok->tokAt(2)->isNumber() || tok->tokAt(2)->isName())) {
|
|
||||||
tok->deleteNext();
|
tok->deleteNext();
|
||||||
tok->deleteThis();
|
tok->deleteThis();
|
||||||
tok->deleteNext(3);
|
tok->deleteNext(3);
|
||||||
|
@ -3259,8 +3255,7 @@ bool Tokenizer::simplifyTokenList()
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
if (!Token::Match(tok, "%var%") && !tok->isNumber()
|
if (!Token::Match(tok, "%var%") && !tok->isNumber()
|
||||||
&& !Token::Match(tok, "]|)")
|
&& !Token::Match(tok, "]|)")
|
||||||
&& (Token::Match(tok->next(), "* ( %var% + %num% )") ||
|
&& (Token::Match(tok->next(), "* ( %var% + %num%|%var% )"))) {
|
||||||
Token::Match(tok->next(), "* ( %var% + %var% )"))) {
|
|
||||||
// remove '* ('
|
// remove '* ('
|
||||||
tok->deleteNext(2);
|
tok->deleteNext(2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue