diff --git a/include/xo/reader/define_xs.hpp b/include/xo/reader/define_xs.hpp index f1e0e2c7..de1fb44d 100644 --- a/include/xo/reader/define_xs.hpp +++ b/include/xo/reader/define_xs.hpp @@ -44,6 +44,11 @@ namespace xo { virtual void on_singleassign(exprstatestack * p_stack) override; virtual void on_leftparen(exprstatestack * p_stack, rp * /*p_emit_expr*/) override; + virtual void on_rightparen(exprstatestack * p_stack, + rp * /*p_emit_expr*/) override; + virtual void on_f64(const token_type & tk, + exprstatestack * p_stack, + rp * /*p_emit_expr*/) override; private: /** diff --git a/include/xo/reader/exprstate.hpp b/include/xo/reader/exprstate.hpp index 461ecddf..75a955ce 100644 --- a/include/xo/reader/exprstate.hpp +++ b/include/xo/reader/exprstate.hpp @@ -128,6 +128,7 @@ namespace xo { * forward instructions to parent parser **/ void on_input(const token_type & tk, exprstatestack * p_stack, rp * p_emit_expr); + /** update exprstate in response to a successfully-parsed subexpression **/ virtual void on_expr(ref::brw expr, exprstatestack * p_stack, diff --git a/src/reader/define_xs.cpp b/src/reader/define_xs.cpp index 4c5b3cb4..f5859c23 100644 --- a/src/reader/define_xs.cpp +++ b/src/reader/define_xs.cpp @@ -520,6 +520,45 @@ namespace xo { assert(false); /* inserting this during refactor...? */ } + + void + define_xs::on_rightparen(exprstatestack * /*p_stack*/, + rp * /*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 * /*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*/