| 326 | } |
| 327 | |
| 328 | void compiler_type::kill_expr(std::deque<token_base *> &tokens) |
| 329 | { |
| 330 | std::deque<token_base *> oldt, expr; |
| 331 | std::swap(tokens, oldt); |
| 332 | tokens.clear(); |
| 333 | for (auto &ptr : oldt) { |
| 334 | if (ptr->get_type() == token_types::action || ptr->get_type() == token_types::endline) { |
| 335 | if (!expr.empty()) { |
| 336 | tree_type<token_base *> tree; |
| 337 | gen_tree(tree, expr); |
| 338 | tokens.push_back(new token_expr(tree)); |
| 339 | expr.clear(); |
| 340 | } |
| 341 | tokens.push_back(ptr); |
| 342 | } |
| 343 | else |
| 344 | expr.push_back(ptr); |
| 345 | } |
| 346 | } |
| 347 | } // namespace cs |