diff --git a/peglib.h b/peglib.h index f495523..0951426 100644 --- a/peglib.h +++ b/peglib.h @@ -2022,14 +2022,14 @@ public: } } - peg& ast_node(const char* name, int type) { + peg& ast_node(const char* name, int type = -1) { (*this)[name] = [=](const SemanticValues& sv) { return std::make_shared(name, type, sv.map>()); }; return *this; } - peg& ast_list(const char* name, int type) { + peg& ast_node_optimizable(const char* name, int type = -1) { (*this)[name] = [=](const SemanticValues& sv) { if (sv.size() == 1) { std::shared_ptr ast = sv[0].get>(); @@ -2058,8 +2058,6 @@ public: std::shared_ptr ast = sv[0].get>(); return ast; } - //std::string msg = "AST handler for '" + name + "' is not defined..."; - //throw std::logic_error(msg); return std::make_shared(name.c_str(), -1, sv.map>()); }; }