From 46470071f3f6e50a6fc26b360b81569191b45fbb Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 12 Jun 2015 18:12:54 -0400 Subject: [PATCH] Removed optional parameter from enable_ast(). --- example/calc3.cc | 2 +- peglib.h | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/example/calc3.cc b/example/calc3.cc index 6169345..1ead659 100644 --- a/example/calc3.cc +++ b/example/calc3.cc @@ -49,7 +49,7 @@ int main(int argc, const char** argv) " ~_ <- [ \t\r\n]* " ); - parser.enable_ast(); + parser.enable_ast(true); auto expr = argv[1]; shared_ptr ast; diff --git a/peglib.h b/peglib.h index c43da2a..2993d86 100644 --- a/peglib.h +++ b/peglib.h @@ -148,7 +148,13 @@ private: /* * Semantic values */ -struct SemanticValue { +struct SemanticValue +{ + any val; + const char* name; + const char* s; + size_t n; + SemanticValue() : s(nullptr), n(0) {} @@ -168,11 +174,6 @@ struct SemanticValue { std::string str() const { return std::string(s, n); } - - any val; - const char* name; - const char* s; - size_t n; }; struct SemanticValues : protected std::vector @@ -2057,7 +2058,7 @@ public: return *this; } - peg& enable_ast(bool optimize_nodes = true) { + peg& enable_ast(bool optimize_nodes) { ast_end(optimize_nodes); return *this; }