MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / is_true

Method is_true

erpcgen/src/cpptemplate/cpptempl.cpp:1761–1791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1759}
1760
1761bool 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
1793bool NodeIf::is_else()
1794{

Callers

nothing calls this directly

Calls 4

matchMethod · 0.80
parse_exprMethod · 0.80
set_line_if_missingMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected