xo-reader: refactor: simplify expect_formal_arglist_xs api
This commit is contained in:
parent
bd8f093a00
commit
5916ac874f
3 changed files with 11 additions and 2 deletions
|
|
@ -53,7 +53,7 @@ namespace xo {
|
||||||
public:
|
public:
|
||||||
expect_formal_arglist_xs();
|
expect_formal_arglist_xs();
|
||||||
|
|
||||||
static std::unique_ptr<expect_formal_arglist_xs> make();
|
static void start(exprstatestack * p_stack);
|
||||||
|
|
||||||
virtual void on_leftparen_token(const token_type & tk,
|
virtual void on_leftparen_token(const token_type & tk,
|
||||||
exprstatestack * p_stack,
|
exprstatestack * p_stack,
|
||||||
|
|
@ -69,6 +69,9 @@ namespace xo {
|
||||||
rp<Expression> * p_emit_expr) override;
|
rp<Expression> * p_emit_expr) override;
|
||||||
virtual void print(std::ostream & os) const override;
|
virtual void print(std::ostream & os) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::unique_ptr<expect_formal_arglist_xs> make();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** parsing state-machine state **/
|
/** parsing state-machine state **/
|
||||||
formalarglstatetype farglxs_type_ = formalarglstatetype::argl_0;
|
formalarglstatetype farglxs_type_ = formalarglstatetype::argl_0;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,12 @@ namespace xo {
|
||||||
(expect_formal_arglist_xs());
|
(expect_formal_arglist_xs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
expect_formal_arglist_xs::start(exprstatestack * p_stack)
|
||||||
|
{
|
||||||
|
p_stack->push_exprstate(expect_formal_arglist_xs::make());
|
||||||
|
}
|
||||||
|
|
||||||
expect_formal_arglist_xs::expect_formal_arglist_xs()
|
expect_formal_arglist_xs::expect_formal_arglist_xs()
|
||||||
: exprstate(exprstatetype::expect_formal_arglist),
|
: exprstate(exprstatetype::expect_formal_arglist),
|
||||||
farglxs_type_{formalarglstatetype::argl_0}
|
farglxs_type_{formalarglstatetype::argl_0}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace xo {
|
||||||
{
|
{
|
||||||
if (lmxs_type_ == lambdastatetype::lm_0) {
|
if (lmxs_type_ == lambdastatetype::lm_0) {
|
||||||
this->lmxs_type_ = lambdastatetype::lm_1;
|
this->lmxs_type_ = lambdastatetype::lm_1;
|
||||||
p_stack->push_exprstate(expect_formal_arglist_xs::make());
|
expect_formal_arglist_xs::start(p_stack);
|
||||||
} else {
|
} else {
|
||||||
exprstate::on_lambda_token(tk, p_stack, p_emit_expr);
|
exprstate::on_lambda_token(tk, p_stack, p_emit_expr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue