Skip to content

Commit 19f0488

Browse files
Update tokenize.cpp
1 parent b0bbcff commit 19f0488

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/tokenize.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8830,17 +8830,17 @@ void Tokenizer::findGarbageCode() const
88308830
continue;
88318831
// count number of semicolons
88328832
int semicolons = 0, colons = 0;
8833-
const Token* const startTok = tok;
8834-
tok = tok->linkAt(1)->previous(); // find ")" of the for-loop
8835-
// walk backwards until we find the beginning (startTok) of the for() again
8836-
for (; tok != startTok; tok = tok->previous()) {
8833+
const Token* const endTok = tok->linkAt(1);
8834+
for (tok = tok->tokAt(2); tok != endTok; tok = tok->next()) {
8835+
if (const Token* lam = findLambdaEndTokenWithoutAST(tok)) {
8836+
tok = lam;
8837+
continue;
8838+
}
88378839
if (tok->str() == ";") { // do the counting
88388840
semicolons++;
88398841
} else if (tok->str() == ":") {
8840-
if (tok->strAt(-1) == ",")
8841-
syntaxError(tok);
88428842
colons++;
8843-
} else if (tok->str() == ")") { // skip pairs of ( )
8843+
} else if (tok->str() == "(") { // skip pairs of ( )
88448844
tok = tok->link();
88458845
}
88468846
}

0 commit comments

Comments
 (0)