xo-reader2: simplify DSyntaxStateMachine w/ DExpectFormalArglistSsm
This commit is contained in:
parent
06f93bf86f
commit
3b1b4f03b5
2 changed files with 10 additions and 100 deletions
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "SyntaxStateMachine.hpp"
|
||||
#include "DSyntaxStateMachine.hpp"
|
||||
#include <xo/object2/DArray.hpp>
|
||||
#include <xo/arena/DArena.hpp>
|
||||
|
||||
|
|
@ -52,8 +52,9 @@ namespace xo {
|
|||
/** @class expect_formal_arglist
|
||||
* @brief parser state-machine for a formal parameter list
|
||||
**/
|
||||
class DExpectFormalArglistSsm {
|
||||
class DExpectFormalArglistSsm : public DSyntaxStateMachine<DExpectFormalArglistSsm> {
|
||||
public:
|
||||
using Super = DSyntaxStateMachine<DExpectFormalArglistSsm>;
|
||||
using DArena = xo::mm::DArena;
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
|
|
@ -71,6 +72,8 @@ namespace xo {
|
|||
/** @defgroup scm-expectformalarglistssm-methods general methods **/
|
||||
///@{
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DExpectFormalArglistSsm"; }
|
||||
|
||||
/** update state on incoming token @p tk, with overall parser state in @p p_psm **/
|
||||
void on_leftparen_token(const Token & tk,
|
||||
ParserStateMachine * p_psm);
|
||||
|
|
@ -99,18 +102,6 @@ namespace xo {
|
|||
void on_token(const Token & tk,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state on parsed symbol @p sym emitted by nested ssm,
|
||||
* with overall parser state in @p p_psm
|
||||
**/
|
||||
void on_parsed_symbol(std::string_view sym,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state on parsed typedescr @p td emitted by nested ssm,
|
||||
* with overall parser state in @p p_psm
|
||||
**/
|
||||
void on_parsed_typedescr(TypeDescr td,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state to consume parsed param (name,type) emitted by
|
||||
* nested ssm, with overall parser state in @p p_psm
|
||||
**/
|
||||
|
|
@ -118,31 +109,6 @@ namespace xo {
|
|||
TypeDescr param_type,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** consume formal params @p arglist from completed nested ssm,
|
||||
* with overall parser state in @p p_psm.
|
||||
**/
|
||||
void on_parsed_formal_arglist(DArray * arglist,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state on parsed expression emitted by nested ssm
|
||||
* with overall parser state in @p p_psm
|
||||
**/
|
||||
void on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state on parsed expression, along with following semicolon,
|
||||
* emitted by nested ssm with overall parser state in @p p_psm
|
||||
**/
|
||||
void on_parsed_expression_with_semicolon(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
#ifdef NOT_YET
|
||||
virtual void on_comma_token(const token_type & tk,
|
||||
parserstatemachine * p_psm) override;
|
||||
virtual void on_rightparen_token(const token_type & tk,
|
||||
parserstatemachine * p_psm) override;
|
||||
#endif
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-expectformalarglistssm-printable-facet printable facet methods **/
|
||||
///@{
|
||||
|
|
|
|||
|
|
@ -171,27 +171,7 @@ namespace xo {
|
|||
break;
|
||||
}
|
||||
|
||||
p_psm->illegal_input_on_token("DExpectFormalArglistSsm::on_token",
|
||||
tk,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
void
|
||||
DExpectFormalArglistSsm::on_parsed_symbol(std::string_view sym,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_input_on_symbol("DExpectFormalArglistSsm::on_parsed_symbol",
|
||||
sym,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
void
|
||||
DExpectFormalArglistSsm::on_parsed_typedescr(TypeDescr td,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_input_on_typedescr("DExpectFormalArglistSsm::on_parsed_typedescr",
|
||||
td,
|
||||
this->get_expect_str());
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -238,37 +218,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
p_psm->illegal_parsed_formal("DExpectFormalArglistSsm::on_parsed_formal",
|
||||
param_name,
|
||||
param_type,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
void
|
||||
DExpectFormalArglistSsm::on_parsed_formal_arglist(DArray * arglist,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_parsed_formal_arglist("DExpectFormalArglistSsm::on_parsed_formal_arglist",
|
||||
arglist,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
void
|
||||
DExpectFormalArglistSsm::on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_parsed_expression("DExpectFormalArglistSsm::on_parsed_expression",
|
||||
expr,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
void
|
||||
DExpectFormalArglistSsm::on_parsed_expression_with_semicolon(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_parsed_expression("DExpectFormalArglistSsm::on_parsed_expression_with_semicolon",
|
||||
expr,
|
||||
this->get_expect_str());
|
||||
Super::on_parsed_formal(param_name, param_type, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -282,9 +232,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
p_psm->illegal_input_on_token("DExpectFormalArglistSsm::on_token",
|
||||
tk,
|
||||
this->get_expect_str());
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -298,9 +246,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
p_psm->illegal_input_on_token("DExpectFormalArglistSsm::on_comma_token",
|
||||
tk,
|
||||
this->get_expect_str());
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -315,9 +261,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
p_psm->illegal_input_on_token("DExpectFormalArglistSsm::on_rightparen_token",
|
||||
tk,
|
||||
this->get_expect_str());
|
||||
Super::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue