| 1759 | } |
| 1760 | |
| 1761 | bool NodeIf::is_true(data_map &data) |
| 1762 | { |
| 1763 | try |
| 1764 | { |
| 1765 | TokenIterator it(m_expr); |
| 1766 | if (m_if_type == NODE_TYPE_IF) |
| 1767 | { |
| 1768 | it.match(token_type_t::IF_TOKEN, "expected 'if' keyword"); |
| 1769 | } |
| 1770 | else if (m_if_type == NODE_TYPE_ELIF) |
| 1771 | { |
| 1772 | it.match(token_type_t::ELIF_TOKEN, "expected 'elif' keyword"); |
| 1773 | } |
| 1774 | else if (m_if_type == NODE_TYPE_ELSE) |
| 1775 | { |
| 1776 | it.match(token_type_t::ELSE_TOKEN, "expected 'else' keyword"); |
| 1777 | it.match(token_type_t::END_TOKEN, "expected end of statement"); |
| 1778 | return true; |
| 1779 | } |
| 1780 | ExprParser parser(it, data); |
| 1781 | data_ptr d = parser.parse_expr(); |
| 1782 | it.match(token_type_t::END_TOKEN, "expected end of statement"); |
| 1783 | |
| 1784 | return !d->empty(); |
| 1785 | } |
| 1786 | catch (TemplateException &e) |
| 1787 | { |
| 1788 | e.set_line_if_missing(get_line()); |
| 1789 | throw e; |
| 1790 | } |
| 1791 | } |
| 1792 | |
| 1793 | bool NodeIf::is_else() |
| 1794 | { |
nothing calls this directly
no test coverage detected