Skip to content

Commit 44e019d

Browse files
Update tokenize.cpp
1 parent 4517bc7 commit 44e019d

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

lib/tokenize.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9145,14 +9145,18 @@ void Tokenizer::findGarbageCode() const
91459145
}
91469146
if (!tok2->next() || tok2->isControlFlowKeyword() || Token::Match(tok2, "typedef|static|."))
91479147
syntaxError(tok);
9148-
if (Token::Match(tok2, "%name% %name%") && tok2->str() == tok2->strAt(1)) {
9149-
if (Token::simpleMatch(tok2->tokAt(2), ";"))
9150-
continue;
9151-
if (tok2->isStandardType() && tok2->str() == "long")
9152-
continue;
9153-
if (Token::Match(tok2->tokAt(-1), "enum|struct|union") || (isCPP() && Token::Match(tok2->tokAt(-1), "class|::")))
9154-
continue;
9155-
syntaxError(tok2);
9148+
if (Token::Match(tok2, "%name% %name%")) {
9149+
if (Token::Match(tok2->tokAt(2), "%name%") && !(tok2->isKeyword() || tok2->tokAt(1)->isKeyword() || tok2->tokAt(2)->isKeyword())
9150+
syntaxError(tok2);
9151+
if (tok2->str() == tok2->strAt(1)) {
9152+
if (Token::simpleMatch(tok2->tokAt(2), ";"))
9153+
continue;
9154+
if (tok2->isStandardType() && tok2->str() == "long")
9155+
continue;
9156+
if (Token::Match(tok2->tokAt(-1), "enum|struct|union") || (isCPP() && Token::Match(tok2->tokAt(-1), "class|::")))
9157+
continue;
9158+
syntaxError(tok2);
9159+
}
91569160
}
91579161
}
91589162
}

0 commit comments

Comments
 (0)