xo-reader2: allow formals w/out explicit type

This commit is contained in:
Roland Conybeare 2026-02-17 16:48:20 -05:00
commit 27c5f66e74
39 changed files with 307 additions and 32 deletions

View file

@ -97,6 +97,10 @@ namespace xo {
case tokentype::tk_colon:
this->on_colon_token(tk, p_psm);
return;
case tokentype::tk_rightparen:
this->on_rightparen_token(tk, p_psm);
return;
// all the not-yet-handled cases
case tokentype::tk_leftparen:
case tokentype::tk_lambda:
@ -110,7 +114,6 @@ namespace xo {
case tokentype::tk_bool:
case tokentype::tk_semicolon:
case tokentype::tk_invalid:
case tokentype::tk_rightparen:
case tokentype::tk_leftbracket:
case tokentype::tk_rightbracket:
case tokentype::tk_leftbrace:
@ -159,6 +162,24 @@ namespace xo {
Super::on_token(tk, p_psm);
}
void
DExpectFormalArgSsm::on_rightparen_token(const Token & tk,
ParserStateMachine * p_psm)
{
if (fstate_ == formalstatetype::formal_1) {
// formal with no type annotation
assert(name_);
p_psm->pop_ssm();
p_psm->on_parsed_formal_with_token(name_, nullptr, tk);
return;
}
Super::on_token(tk, p_psm);
}
void
DExpectFormalArgSsm::on_parsed_symbol(std::string_view sym,
ParserStateMachine * p_psm)