Fixed #2118 (Invalid syntax error report.)
This commit is contained in:
parent
457fd822c0
commit
6200d4505a
|
@ -1876,7 +1876,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
for (const Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
// skip executing scopes..
|
||||
if (Token::Match(tok, ") const| {"))
|
||||
if (Token::Match(tok, ") const| {") || Token::simpleMatch(tok, ", {"))
|
||||
{
|
||||
while (tok->str() != "{")
|
||||
tok = tok->next();
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
TEST_CASE(tokenize9);
|
||||
TEST_CASE(tokenize10);
|
||||
TEST_CASE(tokenize11);
|
||||
TEST_CASE(tokenize12);
|
||||
|
||||
// don't freak out when the syntax is wrong
|
||||
TEST_CASE(wrong_syntax);
|
||||
|
@ -436,6 +437,16 @@ private:
|
|||
ASSERT_EQUALS("X * sizeof ( Y ( ) ) ;", tokenizeAndStringify("X * sizeof(Y());", false));
|
||||
}
|
||||
|
||||
// ticket #2118 - invalid syntax error
|
||||
void tokenize12()
|
||||
{
|
||||
tokenizeAndStringify("Q_GLOBAL_STATIC_WITH_INITIALIZER(Qt4NodeStaticData, qt4NodeStaticData, {\n"
|
||||
" for (unsigned i = 0 ; i < count; i++) {\n"
|
||||
" }\n"
|
||||
"});");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void wrong_syntax()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue