xo-reader: simplify expect_formal_xs, expect_symbol_xs
This commit is contained in:
parent
c8f166acc8
commit
96c0bea2f5
6 changed files with 10 additions and 14 deletions
|
|
@ -47,7 +47,7 @@ namespace xo {
|
|||
public:
|
||||
expect_formal_xs();
|
||||
|
||||
static void start(exprstatestack * p_stack);
|
||||
static void start(parserstatemachine * p_psm);
|
||||
|
||||
virtual void on_symbol(const std::string & symbol_name,
|
||||
parserstatemachine * p_psm) override;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace xo {
|
|||
|
||||
static std::unique_ptr<expect_symbol_xs> make();
|
||||
|
||||
static void start(exprstatestack * p_stack);
|
||||
static void start(parserstatemachine * p_psm);
|
||||
|
||||
virtual void on_symbol_token(const token_type & tk,
|
||||
parserstatemachine * p_psm) override;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace xo {
|
|||
if (this->defxs_type_ == defexprstatetype::def_0) {
|
||||
this->defxs_type_ = defexprstatetype::def_1;
|
||||
|
||||
expect_symbol_xs::start(p_psm->p_stack_);
|
||||
expect_symbol_xs::start(p_psm);
|
||||
} else {
|
||||
exprstate::on_def_token(tk, p_psm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,12 +52,10 @@ namespace xo {
|
|||
expect_formal_arglist_xs::on_leftparen_token(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
auto p_stack = p_psm->p_stack_;
|
||||
|
||||
if (farglxs_type_ == formalarglstatetype::argl_0) {
|
||||
this->farglxs_type_ = formalarglstatetype::argl_1a;
|
||||
/* TODO: refactor to have setup method on each exprstate */
|
||||
expect_formal_xs::start(p_stack);
|
||||
expect_formal_xs::start(p_psm);
|
||||
} else {
|
||||
exprstate::on_leftparen_token(tk, p_psm);
|
||||
}
|
||||
|
|
@ -79,11 +77,9 @@ namespace xo {
|
|||
expect_formal_arglist_xs::on_comma_token(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
auto p_stack = p_psm->p_stack_;
|
||||
|
||||
if (farglxs_type_ == formalarglstatetype::argl_1b) {
|
||||
this->farglxs_type_ = formalarglstatetype::argl_1a;
|
||||
expect_formal_xs::start(p_stack);
|
||||
expect_formal_xs::start(p_psm);
|
||||
} else {
|
||||
exprstate::on_comma_token(tk, p_psm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
expect_formal_xs::start(exprstatestack * p_stack) {
|
||||
p_stack->push_exprstate(expect_formal_xs::make());
|
||||
expect_formal_xs::start(parserstatemachine * p_psm) {
|
||||
p_psm->push_exprstate(expect_formal_xs::make());
|
||||
|
||||
expect_symbol_xs::start(p_stack);
|
||||
expect_symbol_xs::start(p_psm);
|
||||
}
|
||||
|
||||
expect_formal_xs::expect_formal_xs()
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
expect_symbol_xs::start(exprstatestack * p_stack)
|
||||
expect_symbol_xs::start(parserstatemachine * p_psm)
|
||||
{
|
||||
p_stack->push_exprstate(expect_symbol_xs::make());
|
||||
p_psm->push_exprstate(expect_symbol_xs::make());
|
||||
}
|
||||
|
||||
expect_symbol_xs::expect_symbol_xs()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue