xo-reader: parserstatemachine -> consolidate on_formal_arglist()

This commit is contained in:
Roland Conybeare 2024-08-19 11:43:20 -04:00
commit 29932f9a3d
5 changed files with 15 additions and 12 deletions

View file

@ -94,13 +94,11 @@ namespace xo {
parserstatemachine * p_psm)
{
auto p_stack = p_psm->p_stack_;
auto p_emit_expr = p_psm->p_emit_expr_;
if (farglxs_type_ == formalarglstatetype::argl_1b) {
std::unique_ptr<exprstate> self = p_stack->pop_exprstate();
p_stack->top_exprstate().on_formal_arglist(this->argl_,
p_stack, p_emit_expr);
p_stack->top_exprstate().on_formal_arglist(this->argl_, p_psm);
} else {
exprstate::on_rightparen_token(tk, p_psm);
}

View file

@ -125,14 +125,15 @@ namespace xo {
void
exprstate::on_formal_arglist(const std::vector<rp<Variable>> & argl,
exprstatestack * p_stack,
rp<Expression> * /*p_emit_expr*/)
parserstatemachine * p_psm)
{
/* returning type description to something that wants it */
constexpr bool c_debug_flag = true;
scope log(XO_DEBUG(c_debug_flag));
auto p_stack = p_psm->p_stack_;
log && log(xtag("exstype",
p_stack->top_exprstate().exs_type()));

View file

@ -44,15 +44,16 @@ namespace xo {
void
lambda_xs::on_formal_arglist(const std::vector<rp<Variable>> & argl,
exprstatestack * p_stack,
rp<Expression> * p_emit_expr)
parserstatemachine * p_psm)
{
auto p_stack = p_psm->p_stack_;
if (lmxs_type_ == lambdastatetype::lm_1) {
this->lmxs_type_ = lambdastatetype::lm_2;
this->argl_ = argl;
expect_expr_xs::start(p_stack);
} else {
exprstate::on_formal_arglist(argl, p_stack, p_emit_expr);
exprstate::on_formal_arglist(argl, p_psm);
}
}