Fixed #9286 (FP: syntax error: { .abc.a = 1)
This commit is contained in:
parent
26dfee58f8
commit
ef47d3d304
|
@ -9358,11 +9358,11 @@ void Tokenizer::findGarbageCode() const
|
||||||
if (Token::simpleMatch(tok, ".") &&
|
if (Token::simpleMatch(tok, ".") &&
|
||||||
!Token::simpleMatch(tok->previous(), ".") &&
|
!Token::simpleMatch(tok->previous(), ".") &&
|
||||||
!Token::simpleMatch(tok->next(), ".") &&
|
!Token::simpleMatch(tok->next(), ".") &&
|
||||||
!Token::Match(tok->previous(), "{|, . %name% =") &&
|
!Token::Match(tok->previous(), "{|, . %name% [=.]") &&
|
||||||
!Token::Match(tok->previous(), ", . %name%")) {
|
!Token::Match(tok->previous(), ", . %name%")) {
|
||||||
if (!Token::Match(tok->previous(), ")|]|>|}|%name%"))
|
if (!Token::Match(tok->previous(), "%name%|)|]|>|}"))
|
||||||
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
||||||
if (!Token::Match(tok->next(), "template|operator|*|~|%name%"))
|
if (!Token::Match(tok->next(), "%name%|*|~"))
|
||||||
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7700,6 +7700,7 @@ private:
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("void f() { switch (a) int b; }"));
|
ASSERT_NO_THROW(tokenizeAndStringify("void f() { switch (a) int b; }"));
|
||||||
|
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("S s = { .x=2, .y[0]=3 };"));
|
ASSERT_NO_THROW(tokenizeAndStringify("S s = { .x=2, .y[0]=3 };"));
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify("S s = { .ab.a=2, .ab.b=3 };"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue