| 166 | } |
| 167 | |
| 168 | void ast1() const { |
| 169 | const char code[] = "('Release|x64' == 'Release|x64');"; |
| 170 | |
| 171 | TokenList tokenlist(settingsDefault, Standards::Language::C); |
| 172 | ASSERT(tokenlist.createTokensFromString(code)); |
| 173 | // TODO: put this logic in TokenList |
| 174 | // generate links |
| 175 | { |
| 176 | std::stack<Token*> lpar; |
| 177 | for (Token* tok2 = tokenlist.front(); tok2; tok2 = tok2->next()) { |
| 178 | if (tok2->str() == "(") |
| 179 | lpar.push(tok2); |
| 180 | else if (tok2->str() == ")") { |
| 181 | if (lpar.empty()) |
| 182 | break; |
| 183 | Token::createMutualLinks(lpar.top(), tok2); |
| 184 | lpar.pop(); |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | tokenlist.createAst(); // do not crash |
| 189 | } |
| 190 | }; |
| 191 | |
| 192 | REGISTER_TEST(TestTokenList) |