From 11856b51aabd2c3541665bd61850ef7e53d8f619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 26 Apr 2014 13:32:08 +0200 Subject: [PATCH] AST: Fixed handling of 'a=b(c**)+1' --- lib/tokenlist.cpp | 5 ++++- test/testtokenize.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 5ab9e55fd..df6a5614f 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -596,8 +596,11 @@ static void compileMulDiv(Token *&tok, std::stack &op, unsigned int dept compileDot(tok,op, depth); while (tok) { if (Token::Match(tok, "[*/%]")) { - if (Token::Match(tok, "* [,)]")) + if (Token::Match(tok, "* [*,)]")) { + while (tok->next() && tok->str() == "*") + tok = tok->next(); break; + } compileBinOp(tok, compileDot, op, depth); } else break; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 589685c6a..217abb5cb 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10345,6 +10345,7 @@ private: " `-f\n", testAst("x = ((a[i]).f)();", true)); ASSERT_EQUALS("abcde.++[.=", testAst("a = b.c[++(d.e)];")); + ASSERT_EQUALS("abc(1+=", testAst("a = b(c**)+1;")); // casts ASSERT_EQUALS("a1(2(+=",testAst("a=(t)1+(t)2;"));