From c7c6bc888af142012a99e572ac6f6af5f3a9409c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 1 Aug 2024 10:52:41 +1000 Subject: [PATCH] xo-parser: simplify: drop expraction:: push_exs1, push_exs2 --- include/xo/parser/parser.hpp | 21 ++------------------- src/parser/parser.cpp | 25 +++---------------------- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/include/xo/parser/parser.hpp b/include/xo/parser/parser.hpp index 8e878099..838b4cec 100644 --- a/include/xo/parser/parser.hpp +++ b/include/xo/parser/parser.hpp @@ -135,24 +135,16 @@ namespace xo { public: expraction() = default; expraction(expractiontype action_type, - const exprir & expr_ir, - exprstatetype push_exs1, - exprstatetype push_exs2) - : action_type_{action_type}, expr_ir_{expr_ir}, - push_exs1_{push_exs1}, push_exs2_{push_exs2} + const exprir & expr_ir) + : action_type_{action_type}, expr_ir_{expr_ir} {} static expraction keep(); static expraction emit(const exprir & ir); -#ifdef OBSOLETE - static expraction push2(exprstatetype s1, exprstatetype s2); -#endif static expraction pop(const exprir & ir); expractiontype action_type() const { return action_type_; } const exprir & expr_ir() const { return expr_ir_; } - exprstatetype push_exs1() const { return push_exs1_; } - exprstatetype push_exs2() const { return push_exs2_; } void print(std::ostream & os) const; @@ -169,15 +161,6 @@ namespace xo { * intermediate representation (pass to enclosing stack state) **/ exprir expr_ir_; - /** with action_type push1 or push2, - * parser will push exprstate with this type - **/ - exprstatetype push_exs1_ = exprstatetype::invalid; - /** with action_type push2, - * parser will push exprstate with this type - * (after pushing exprstate built from push_exs1_) - **/ - exprstatetype push_exs2_ = exprstatetype::invalid; }; inline std::ostream & diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index c01cda37..ea5c372a 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -101,36 +101,19 @@ namespace xo { expraction expraction::keep() { return expraction(expractiontype::keep, - exprir(), - exprstatetype::invalid /*not used*/, - exprstatetype::invalid /*not used*/); + exprir()); } expraction expraction::emit(const exprir & ir) { return expraction(expractiontype::emit, - ir, - exprstatetype::invalid /*not used*/, - exprstatetype::invalid /*not used*/); + ir); } -#ifdef OBSOLETE - expraction - expraction::push2(exprstatetype s1, - exprstatetype s2) { - return expraction(expractiontype::push2, - exprir(), - s1, - s2); - } -#endif - expraction expraction::pop(const exprir & ir) { return expraction(expractiontype::pop, - ir, - exprstatetype::invalid /*not used*/, - exprstatetype::invalid /*not used*/); + ir); } void @@ -138,8 +121,6 @@ namespace xo { os << ""; }