From ce51b0ee98b85a8197a13a0665319b0050ebaa72 Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 28 May 2015 19:03:11 -0400 Subject: [PATCH] Updated ast methods. --- peglib.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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>()); }; }