xo-reader: simplify paren handling for expressions

This commit is contained in:
Roland Conybeare 2024-08-09 20:33:28 -04:00
commit 6b9503ef76
4 changed files with 21 additions and 45 deletions

View file

@ -4,6 +4,7 @@
*/
#include "expect_expr_xs.hpp"
#include "paren_xs.hpp"
#include "progress_xs.hpp"
#include "xo/expression/Constant.hpp"
@ -22,6 +23,21 @@ namespace xo {
: exprstate(exprstatetype::expect_rhs_expression)
{}
void
expect_expr_xs::on_leftparen_token(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_leftparen";
/* push lparen_0 to remember to look for subsequent rightparen. */
p_stack->push_exprstate(paren_xs::lparen_0());
p_stack->push_exprstate(expect_expr_xs::expect_rhs_expression());
}
void
expect_expr_xs::on_f64_token(const token_type & tk,
exprstatestack * p_stack,