fix tokenizer bug where 'class B : private ::A { };' was tokenized to 'class B : private: : A { } ;'
This commit is contained in:
parent
bd03768415
commit
e30852200e
|
@ -2148,7 +2148,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
tok->deleteNext();
|
||||
}
|
||||
|
||||
else if ((c1 == 'p' || c1 == '_') && tok->next()->str() == ":")
|
||||
else if ((c1 == 'p' || c1 == '_') && tok->next()->str() == ":" && tok->strAt(2) != ":")
|
||||
{
|
||||
if (tok->str() == "private" || tok->str() == "protected" || tok->str() == "public" || tok->str() == "__published")
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ private:
|
|||
TEST_CASE(tokenize14); // tokenize "0X10" => 16
|
||||
TEST_CASE(tokenize15); // tokenize ".123"
|
||||
TEST_CASE(tokenize16); // #2612 - segfault for "<><<"
|
||||
TEST_CASE(tokenize17); // #2759
|
||||
|
||||
// don't freak out when the syntax is wrong
|
||||
TEST_CASE(wrong_syntax);
|
||||
|
@ -541,6 +542,11 @@ private:
|
|||
tokenizeAndStringify("<><<");
|
||||
}
|
||||
|
||||
void tokenize17() // #2759
|
||||
{
|
||||
ASSERT_EQUALS("class B : private :: A { } ;", tokenizeAndStringify("class B : private ::A { };"));
|
||||
}
|
||||
|
||||
void wrong_syntax()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue