NodeFor
| 1621 | |
| 1622 | // NodeFor |
| 1623 | NodeFor::NodeFor(const token_vector &tokens, bool is_top, uint32_t line) |
| 1624 | : NodeParent(line) |
| 1625 | , m_is_top(is_top) |
| 1626 | , m_has_predicate(false) |
| 1627 | { |
| 1628 | TokenIterator tok(tokens); |
| 1629 | tok.match(token_type_t::FOR_TOKEN, "expected 'for'"); |
| 1630 | m_val = tok.match(token_type_t::KEY_PATH_TOKEN, "expected key path")->get_value(); |
| 1631 | tok.match(token_type_t::IN_TOKEN, "expected 'in'"); |
| 1632 | m_key = tok.match(token_type_t::KEY_PATH_TOKEN, "expected key path")->get_value(); |
| 1633 | if (tok->get_type() != token_type_t::END_TOKEN) |
| 1634 | { |
| 1635 | tok.match(token_type_t::IF_TOKEN, "expected 'if'"); |
| 1636 | while (tok->get_type() != token_type_t::END_TOKEN) |
| 1637 | { |
| 1638 | m_predicate_tokens.push_back(*tok.get()); |
| 1639 | ++tok; |
| 1640 | } |
| 1641 | m_has_predicate = true; |
| 1642 | } |
| 1643 | tok.match(token_type_t::END_TOKEN, "expected end of statement"); |
| 1644 | } |
| 1645 | |
| 1646 | NodeType NodeFor::gettype() |
| 1647 | { |