xo-parser: simplify: drop expraction:: push_exs1, push_exs2

This commit is contained in:
Roland Conybeare 2024-08-01 10:52:41 +10:00
commit c7c6bc888a
2 changed files with 5 additions and 41 deletions

View file

@ -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 &

View file

@ -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 << "<expraction";
os << xtag("type", action_type_);
os << xtag("ir", expr_ir_);
os << xtag("push_exs1", push_exs1_);
os << xtag("push_exs2", push_exs2_);
os << ">";
}