xo-reader: refactor: mv defexpr on_rightparen(), on_f64() -> define_xs

This commit is contained in:
Roland Conybeare 2024-08-08 14:37:56 -04:00
commit 3a0a455b2c
3 changed files with 45 additions and 0 deletions

View file

@ -44,6 +44,11 @@ namespace xo {
virtual void on_singleassign(exprstatestack * p_stack) override;
virtual void on_leftparen(exprstatestack * p_stack,
rp<Expression> * /*p_emit_expr*/) override;
virtual void on_rightparen(exprstatestack * p_stack,
rp<Expression> * /*p_emit_expr*/) override;
virtual void on_f64(const token_type & tk,
exprstatestack * p_stack,
rp<Expression> * /*p_emit_expr*/) override;
private:
/**

View file

@ -128,6 +128,7 @@ namespace xo {
* forward instructions to parent parser
**/
void on_input(const token_type & tk, exprstatestack * p_stack, rp<Expression> * p_emit_expr);
/** update exprstate in response to a successfully-parsed subexpression **/
virtual void on_expr(ref::brw<Expression> expr,
exprstatestack * p_stack,

View file

@ -520,6 +520,45 @@ namespace xo {
assert(false); /* inserting this during refactor...? */
}
void
define_xs::on_rightparen(exprstatestack * /*p_stack*/,
rp<Expression> * /*p_emit_expr*/)
{
constexpr bool c_debug_flag = true;
scope log(XO_DEBUG(c_debug_flag));
constexpr const char * self_name = "exprstate::on_rightparen";
if (!this->admits_rightparen())
{
throw std::runtime_error(tostr(self_name,
": unexpected rightparen ')' for parsing state",
xtag("state", *this)));
}
assert(false); /* inserting this during refactor..? */
}
void
define_xs::on_f64(const token_type & /*tk*/,
exprstatestack * /*p_stack*/,
rp<Expression> * /*p_emit_expr*/)
{
constexpr bool c_debug_flag = true;
scope log(XO_DEBUG(c_debug_flag));
constexpr const char * self_name = "exprstate::on_f64";
if (!this->admits_f64())
{
throw std::runtime_error(tostr(self_name,
": unexpected floating-point literal for parsing state",
xtag("state", *this)));
}
assert(false);
}
} /*namespace scm*/
} /*namespace xo*/