| 479 | }; |
| 480 | |
| 481 | void |
| 482 | compiler_type::process_token_buff(std::deque<token_base *> &tokens, std::deque<std::deque<token_base *>> &ast) |
| 483 | { |
| 484 | std::deque<token_base *> oldt, expr; |
| 485 | std::swap(tokens, oldt); |
| 486 | tokens.clear(); |
| 487 | for (auto &ptr : oldt) { |
| 488 | if (ptr->get_type() == token_types::signal && |
| 489 | static_cast<token_signal *>(ptr)->get_signal() == signal_types::endline_) |
| 490 | ptr = new token_endline(ptr->get_line_num()); |
| 491 | if (ptr->get_type() == token_types::action || ptr->get_type() == token_types::endline) { |
| 492 | if (!expr.empty()) { |
| 493 | translator.match_grammar(context, expr); |
| 494 | for (auto &it : expr) |
| 495 | tokens.push_back(it); |
| 496 | expr.clear(); |
| 497 | } |
| 498 | tokens.push_back(ptr); |
| 499 | } |
| 500 | else |
| 501 | expr.push_back(ptr); |
| 502 | } |
| 503 | std::deque<token_base *> tmp; |
| 504 | for (auto &ptr : tokens) { |
| 505 | tmp.push_back(ptr); |
| 506 | if (ptr != nullptr && ptr->get_type() == token_types::endline) { |
| 507 | if (tmp.size() > 1) |
| 508 | ast.push_back(tmp); |
| 509 | tmp.clear(); |
| 510 | } |
| 511 | } |
| 512 | if (tmp.size() > 1) |
| 513 | ast.push_back(tmp); |
| 514 | } |
| 515 | |
| 516 | void compiler_type::translate_into_tokens(const std::deque<char> &char_buff, std::deque<token_base *> &tokens, |
| 517 | charset encoding) |
nothing calls this directly
no test coverage detected