xo-reader: + parserstatemachine.push_exprstate(); simplify lambda_xs
This commit is contained in:
parent
b988bc6790
commit
fa9f4967f2
5 changed files with 17 additions and 14 deletions
|
|
@ -40,7 +40,7 @@ namespace xo {
|
|||
public:
|
||||
lambda_xs();
|
||||
|
||||
static void start(exprstatestack * p_stack, rp<Expression> * p_emit_expr);
|
||||
static void start(parserstatemachine * p_psm);
|
||||
|
||||
virtual void on_lambda_token(const token_type & tk,
|
||||
parserstatemachine * p_psm) override;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace xo {
|
|||
|
||||
std::unique_ptr<exprstate> pop_exprstate();
|
||||
exprstate & top_exprstate();
|
||||
void push_exprstate(std::unique_ptr<exprstate> x);
|
||||
|
||||
public:
|
||||
exprstatestack * p_stack_;
|
||||
|
|
|
|||
|
|
@ -41,13 +41,8 @@ namespace xo {
|
|||
|
||||
//constexpr const char * self_name = "exprstate::on_leftparen";
|
||||
|
||||
auto p_stack = p_psm->p_stack_;
|
||||
auto p_emit_expr = p_psm->p_emit_expr_;
|
||||
|
||||
/* push lparen_0 to remember to look for subsequent rightparen. */
|
||||
lambda_xs::start(p_stack, p_emit_expr);
|
||||
//p_psm->top_exprstate().on_lambda_token(tk, p_stack, p_emit_expr);
|
||||
//p_stack->push_exprstate(expect_expr_xs::expect_rhs_expression());
|
||||
lambda_xs::start(p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -17,14 +17,11 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
lambda_xs::start(exprstatestack * p_stack,
|
||||
rp<Expression> * p_emit_expr)
|
||||
lambda_xs::start(parserstatemachine * p_psm)
|
||||
{
|
||||
parserstatemachine psm(p_stack, p_emit_expr);
|
||||
|
||||
p_stack->push_exprstate(lambda_xs::make());
|
||||
p_stack->top_exprstate()
|
||||
.on_lambda_token(token_type::lambda(), &psm);
|
||||
p_psm->push_exprstate(lambda_xs::make());
|
||||
p_psm->top_exprstate()
|
||||
.on_lambda_token(token_type::lambda(), p_psm);
|
||||
}
|
||||
|
||||
lambda_xs::lambda_xs() : exprstate(exprstatetype::lambdaexpr) {}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,16 @@ namespace xo {
|
|||
parserstatemachine::pop_exprstate() {
|
||||
return p_stack_->pop_exprstate();
|
||||
}
|
||||
|
||||
exprstate &
|
||||
parserstatemachine::top_exprstate() {
|
||||
return p_stack_->top_exprstate();
|
||||
}
|
||||
|
||||
void
|
||||
parserstatemachine::push_exprstate(std::unique_ptr<exprstate> x) {
|
||||
p_stack_->push_exprstate(std::move(x));
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue