xo-reader: refactor: mv on_singleassign def-expr -> define_xs
This commit is contained in:
parent
149536b182
commit
5c14ff9884
3 changed files with 29 additions and 10 deletions
|
|
@ -41,6 +41,7 @@ namespace xo {
|
||||||
virtual void on_colon(exprstatestack * p_stack) override;
|
virtual void on_colon(exprstatestack * p_stack) override;
|
||||||
virtual void on_semicolon(exprstatestack * p_stack,
|
virtual void on_semicolon(exprstatestack * p_stack,
|
||||||
rp<Expression> * /*p_emit_expr*/) override;
|
rp<Expression> * /*p_emit_expr*/) override;
|
||||||
|
virtual void on_singleassign(exprstatestack * p_stack) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -475,6 +475,32 @@ namespace xo {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
define_xs::on_singleassign(exprstatestack * p_stack)
|
||||||
|
{
|
||||||
|
constexpr bool c_debug_flag = true;
|
||||||
|
scope log(XO_DEBUG(c_debug_flag));
|
||||||
|
|
||||||
|
constexpr const char * self_name = "exprstate::on_singleassign";
|
||||||
|
|
||||||
|
if (!this->admits_singleassign())
|
||||||
|
{
|
||||||
|
throw std::runtime_error(tostr(self_name,
|
||||||
|
": unexpected equals for parsing state",
|
||||||
|
xtag("state", *this)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((this->exs_type_ == exprstatetype::def_1)
|
||||||
|
|| (this->exs_type_ == exprstatetype::def_3))
|
||||||
|
{
|
||||||
|
this->exs_type_ = exprstatetype::def_4;
|
||||||
|
|
||||||
|
p_stack->push_exprstate(exprstate::expect_rhs_expression());
|
||||||
|
} else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
} /*namespace scm*/
|
} /*namespace scm*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -658,7 +658,7 @@ namespace xo {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
exprstate::on_singleassign(exprstatestack * p_stack) {
|
exprstate::on_singleassign(exprstatestack * /*p_stack*/) {
|
||||||
constexpr bool c_debug_flag = true;
|
constexpr bool c_debug_flag = true;
|
||||||
scope log(XO_DEBUG(c_debug_flag));
|
scope log(XO_DEBUG(c_debug_flag));
|
||||||
|
|
||||||
|
|
@ -671,15 +671,7 @@ namespace xo {
|
||||||
xtag("state", *this)));
|
xtag("state", *this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((this->exs_type_ == exprstatetype::def_1)
|
assert(false);
|
||||||
|| (this->exs_type_ == exprstatetype::def_3))
|
|
||||||
{
|
|
||||||
this->exs_type_ = exprstatetype::def_4;
|
|
||||||
|
|
||||||
p_stack->push_exprstate(exprstate::expect_rhs_expression());
|
|
||||||
} else {
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue