File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -363,10 +363,8 @@ static bool iscast(const Token *tok)
363363 return false ;
364364
365365 for (const Token *tok2 = tok->next (); tok2; tok2 = tok2->next ()) {
366- if (tok2->str () == " )" )
367- return (tok2->next () && !tok2->next ()->isOp ());
368366 if (!Token::Match (tok2, " %var%|*" ))
369- return false ;
367+ return Token::Match (tok2, " ) %any% " ) && (!tok2-> next ()-> isOp () && tok2-> next ()-> str () != " [ " ) ;
370368 }
371369
372370 return false ;
@@ -500,16 +498,26 @@ static void compileScope(Token *&tok, std::stack<Token*> &op)
500498 }
501499}
502500
503- static void compileDot (Token *&tok, std::stack<Token*> &op)
501+ static void compileParAndBrackets (Token *&tok, std::stack<Token*> &op)
504502{
505503 compileScope (tok,op);
506504 while (tok) {
507- if (tok->str () == " . " ) {
505+ if (tok->str () == " [ " ) {
508506 compileBinOp (tok, compileScope, op);
509507 } else break ;
510508 }
511509}
512510
511+ static void compileDot (Token *&tok, std::stack<Token*> &op)
512+ {
513+ compileParAndBrackets (tok,op);
514+ while (tok) {
515+ if (tok->str () == " ." ) {
516+ compileBinOp (tok, compileParAndBrackets, op);
517+ } else break ;
518+ }
519+ }
520+
513521static void compileMulDiv (Token *&tok, std::stack<Token*> &op)
514522{
515523 compileDot (tok,op);
Original file line number Diff line number Diff line change @@ -10008,10 +10008,6 @@ class TestTokenizer : public TestFixture {
1000810008
1000910009 ASSERT_EQUALS (" 'X''a'>" , testAst (" ('X' > 'a')" ));
1001010010 ASSERT_EQUALS (" 'X''a'>" , testAst (" (L'X' > L'a')" ));
10011-
10012- // ({..})
10013- ASSERT_EQUALS (" a{+d+" , testAst (" a+({b+c;})+d" ));
10014- ASSERT_EQUALS (" a{d*+" , testAst (" a+({b+c;})*d" ));
1001510011 }
1001610012
1001710013 void astpar () const { // parentheses
@@ -10023,11 +10019,18 @@ class TestTokenizer : public TestFixture {
1002310019 // casts
1002410020 ASSERT_EQUALS (" a1(2(+=" ,testAst (" a=(t)1+(t)2;" ));
1002510021 ASSERT_EQUALS (" a1(2+=" ,testAst (" a=(t)1+2;" ));
10022+
10023+ // ({..})
10024+ ASSERT_EQUALS (" a{+d+" , testAst (" a+({b+c;})+d" ));
10025+ ASSERT_EQUALS (" a{d*+" , testAst (" a+({b+c;})*d" ));
1002610026 }
1002710027
1002810028 void astbrackets () const { // []
1002910029 ASSERT_EQUALS (" a23+[4+" , testAst (" a[2+3]+4" ));
1003010030 ASSERT_EQUALS (" a1[0[" , testAst (" a[1][0]" ));
10031+ ASSERT_EQUALS (" ab0[=" , testAst (" a=(b)[0];" ));
10032+ ASSERT_EQUALS (" abc0[.=" , testAst (" a=b.c[0];" ));
10033+ ASSERT_EQUALS (" ab0[1[=" , testAst (" a=b[0][1];" ));
1003110034 }
1003210035
1003310036 void astunaryop () const { // unary operators
You can’t perform that action at this time.
0 commit comments