xo-reader2: DefineSsm handles colon token after lhs var
example: def foo : f64 = 3.14;
This commit is contained in:
parent
021625d562
commit
0d8d928def
4 changed files with 34 additions and 2 deletions
|
|
@ -477,7 +477,7 @@ namespace xo {
|
|||
DDefineSsm::on_def_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (this->defstate_ == defexprstatetype::def_0) {
|
||||
if (defstate_ == defexprstatetype::def_0) {
|
||||
this->defstate_ = defexprstatetype::def_1;
|
||||
|
||||
DExpectSymbolSsm::start(p_psm->parser_alloc(), p_psm);
|
||||
|
|
@ -502,6 +502,13 @@ namespace xo {
|
|||
DDefineSsm::on_colon_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
if (defstate_ == defexprstatetype::def_2) {
|
||||
this->defstate_ = defexprstatetype::def_3;
|
||||
|
||||
// expect_type_xs::start(p_psm);
|
||||
return;
|
||||
}
|
||||
|
||||
p_psm->illegal_input_on_token("DDefineSsm::on_colon_token",
|
||||
tk,
|
||||
this->get_expect_str());
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ namespace xo {
|
|||
this->on_if_token(tk);
|
||||
break;
|
||||
|
||||
case tokentype::tk_colon:
|
||||
this->on_colon_token(tk);
|
||||
break;
|
||||
|
||||
// all the not-yet handled cases
|
||||
case tokentype::tk_invalid:
|
||||
case tokentype::tk_bool:
|
||||
|
|
@ -157,7 +161,6 @@ namespace xo {
|
|||
case tokentype::tk_greatequal:
|
||||
case tokentype::tk_dot:
|
||||
case tokentype::tk_comma:
|
||||
case tokentype::tk_colon:
|
||||
case tokentype::tk_doublecolon:
|
||||
case tokentype::tk_semicolon:
|
||||
case tokentype::tk_singleassign:
|
||||
|
|
@ -208,6 +211,14 @@ namespace xo {
|
|||
stack_->top().on_if_token(tk, this);
|
||||
}
|
||||
|
||||
void
|
||||
ParserStateMachine::on_colon_token(const Token & tk)
|
||||
{
|
||||
scope log(XO_DEBUG(debug_flag_), xtag("tk", tk));
|
||||
|
||||
stack_->top().on_colon_token(tk, this);
|
||||
}
|
||||
|
||||
void
|
||||
ParserStateMachine::capture_error(std::string_view ssm_name,
|
||||
const DString * errmsg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue