xo-reader: + on_expr_with_semicolon() [wip, utest not passing]
This commit is contained in:
parent
ac4ee7d6b8
commit
bc30b34bc2
11 changed files with 88 additions and 2 deletions
|
|
@ -88,6 +88,13 @@ namespace xo {
|
|||
}
|
||||
|
||||
exprstate::on_expr(expr, p_psm);
|
||||
void
|
||||
define_xs::on_expr_with_semicolon(ref::brw<Expression> expr,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
this->on_expr(expr, p_psm);
|
||||
/* semicolon is allowed to terminate def expr */
|
||||
this->on_semicolon_token(token_type::semicolon(), p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -195,6 +195,21 @@ namespace xo {
|
|||
p_psm->top_exprstate().on_expr(expr, p_psm);
|
||||
} /*on_expr*/
|
||||
|
||||
void
|
||||
expect_expr_xs::on_expr_with_semicolon(ref::brw<Expression> expr,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
|
||||
log && log(xtag("exstype", this->exs_type_),
|
||||
xtag("expr", expr.promote()));
|
||||
|
||||
std::unique_ptr<exprstate> self = p_psm->pop_exprstate();
|
||||
|
||||
p_psm->on_expr_with_semicolon(expr);
|
||||
} /*on_expr_with_semicolon*/
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
|
|
@ -387,6 +387,19 @@ namespace xo {
|
|||
assert(false);
|
||||
} /*on_expr*/
|
||||
|
||||
void
|
||||
exprstate::on_expr_with_semicolon(ref::brw<Expression> expr,
|
||||
parserstatemachine * /*p_psm*/)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
|
||||
log && log(xtag("exstype", this->exs_type_),
|
||||
xtag("expr", expr));
|
||||
|
||||
assert(false);
|
||||
} /*on_expr_with_semicolon*/
|
||||
|
||||
void
|
||||
exprstate::on_symbol(const std::string & symbol_name,
|
||||
parserstatemachine * /*p_psm*/)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,14 @@ namespace xo {
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
lambda_xs::on_expr_with_semicolon(ref::brw<Expression> expr,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
this->on_expr(expr, p_psm);
|
||||
this->on_semicolon_token(token_type::semicolon(), p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
lambda_xs::on_semicolon_token(const token_type & tk,
|
||||
parserstatemachine * p_psm)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,32 @@ namespace xo {
|
|||
p_env_stack_->pop_envframe();
|
||||
}
|
||||
|
||||
void
|
||||
parserstatemachine::on_expr(ref::brw<Expression> x)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
|
||||
log && log(xtag("x", x),
|
||||
xtag("psm", *this));
|
||||
|
||||
this->p_stack_
|
||||
->top_exprstate().on_expr(x, this);
|
||||
}
|
||||
|
||||
void
|
||||
parserstatemachine::on_expr_with_semicolon(ref::brw<Expression> x)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
|
||||
log && log(xtag("x", x),
|
||||
xtag("psm", *this));
|
||||
|
||||
this->p_stack_
|
||||
->top_exprstate().on_expr_with_semicolon(x, this);
|
||||
}
|
||||
|
||||
void
|
||||
parserstatemachine::on_symbol(const std::string & x)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
progress_xs::on_semicolon_token(const token_type & tk,
|
||||
progress_xs::on_semicolon_token(const token_type & /*tk*/,
|
||||
parserstatemachine * p_psm)
|
||||
{
|
||||
/* note: implementation parllels .on_rightparen_token() */
|
||||
|
|
@ -227,7 +227,7 @@ namespace xo {
|
|||
|
||||
std::unique_ptr<exprstate> self = p_psm->pop_exprstate();
|
||||
|
||||
p_psm->top_exprstate().on_expr(expr, p_psm);
|
||||
p_psm->on_expr_with_semicolon(expr);
|
||||
|
||||
/* control here on input like:
|
||||
* (1.234;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue