From 94e2bf7a1172e9772a60e33444591515704d1ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 25 Nov 2013 04:07:44 +0100 Subject: [PATCH] AST: Handle ({..}) --- lib/tokenlist.cpp | 3 +++ test/testtokenize.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index c572fd2df..b2dd8f01b 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -478,6 +478,9 @@ static void compileTerm(Token *& tok, std::stack &op) op.pop(); } op.push(unaryop); + } else if (Token::Match(tok,"( {")) { + op.push(tok->next()); + tok = tok->link()->next(); } else { // Parenthesized sub-expression tok = tok->next(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 0cddf01fb..8310f5d57 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -10008,6 +10008,10 @@ private: ASSERT_EQUALS("'X''a'>", testAst("('X' > 'a')")); ASSERT_EQUALS("'X''a'>", testAst("(L'X' > L'a')")); + + // ({..}) + ASSERT_EQUALS("a{+d+", testAst("a+({b+c;})+d")); + ASSERT_EQUALS("a{d*+", testAst("a+({b+c;})*d")); } void astpar() const { // parentheses