xo-reader2: + DExpectFormalArglistSsm starts DExpectFormalArgSsm

This commit is contained in:
Roland Conybeare 2026-01-28 18:31:10 -05:00
commit 089bd9fcbb
7 changed files with 39 additions and 22 deletions

View file

@ -54,8 +54,12 @@ namespace xo {
DExpectFormalArgSsm(); DExpectFormalArgSsm();
/** create empty instance using memory from @p mm **/ /** create empty instance using memory from @p mm **/
DExpectFormalArgSsm * _make(DArena & mm); static obj<ASyntaxStateMachine,DExpectFormalArgSsm> make(DArena & mm);
/** create empty instance using memory from @p mm **/
static DExpectFormalArgSsm * _make(DArena & mm);
/** puah instance of this ssm onto @p p_psm **/
static void start(ParserStateMachine * p_psm); static void start(ParserStateMachine * p_psm);
/** @defgroup scm-expectformalargssm-ssm-facet syntaxstatemachine facet methods **/ /** @defgroup scm-expectformalargssm-ssm-facet syntaxstatemachine facet methods **/

View file

@ -38,8 +38,7 @@ namespace xo {
* to the state machine on top of the stack * to the state machine on top of the stack
* as of when this start() method invoked * as of when this start() method invoked
**/ **/
static void start(DArena & parser_mm, static void start(ParserStateMachine * p_psm);
ParserStateMachine * p_psm);
/** update state for this syntax on incoming token @p tk, /** update state for this syntax on incoming token @p tk,
* with overall parser state in @p p_psm * with overall parser state in @p p_psm

View file

@ -597,7 +597,7 @@ namespace xo {
if (defstate_ == defexprstatetype::def_0) { if (defstate_ == defexprstatetype::def_0) {
this->defstate_ = defexprstatetype::def_1; this->defstate_ = defexprstatetype::def_1;
DExpectSymbolSsm::start(p_psm->parser_alloc(), p_psm); DExpectSymbolSsm::start(p_psm);
return; return;
} }

View file

@ -4,12 +4,14 @@
**/ **/
#include "DExpectFormalArgSsm.hpp" #include "DExpectFormalArgSsm.hpp"
#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp"
#include "DExpectSymbolSsm.hpp"
#include "ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp"
#ifdef NOT_YET #ifdef NOT_YET
#include "expect_symbol_xs.hpp"
#include "expect_type_xs.hpp" #include "expect_type_xs.hpp"
#include "parserstatemachine.hpp" //#include "parserstatemachine.hpp"
#include "exprstatestack.hpp" //#include "exprstatestack.hpp"
#include "xo/expression/Variable.hpp" #include "xo/expression/Variable.hpp"
#endif #endif
@ -38,6 +40,12 @@ namespace xo {
DExpectFormalArgSsm::DExpectFormalArgSsm() = default; DExpectFormalArgSsm::DExpectFormalArgSsm() = default;
obj<ASyntaxStateMachine,DExpectFormalArgSsm>
DExpectFormalArgSsm::make(DArena & mm)
{
return obj<ASyntaxStateMachine,DExpectFormalArgSsm>(_make(mm));
}
DExpectFormalArgSsm * DExpectFormalArgSsm *
DExpectFormalArgSsm::_make(DArena & mm) DExpectFormalArgSsm::_make(DArena & mm)
{ {
@ -46,6 +54,14 @@ namespace xo {
return new (mem) DExpectFormalArgSsm(); return new (mem) DExpectFormalArgSsm();
} }
void
DExpectFormalArgSsm::start(ParserStateMachine * p_psm)
{
p_psm->push_ssm(DExpectFormalArgSsm::make(p_psm->parser_alloc()));
DExpectSymbolSsm::start(p_psm);
}
syntaxstatetype syntaxstatetype
DExpectFormalArgSsm::ssm_type() const noexcept { DExpectFormalArgSsm::ssm_type() const noexcept {
return syntaxstatetype::expect_formal_arg; return syntaxstatetype::expect_formal_arg;
@ -161,14 +177,8 @@ namespace xo {
expr, expr,
this->get_expect_str()); this->get_expect_str());
} }
#ifdef NOT_YET #ifdef NOT_YET
void
DExpectFormalSsm::start(ParserStateMachine * p_psm) {
p_psm->push_exprstate(expect_formal_xs::make());
expect_symbol_xs::start(p_psm);
}
expect_formal_xs::expect_formal_xs() expect_formal_xs::expect_formal_xs()
: exprstate(exprstatetype::expect_formal) : exprstate(exprstatetype::expect_formal)
{} {}

View file

@ -5,6 +5,8 @@
#include "DExpectFormalArglistSsm.hpp" #include "DExpectFormalArglistSsm.hpp"
#include "ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp" #include "ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp"
#include "DExpectFormalArgSsm.hpp"
#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp"
#include <xo/printable2/Printable.hpp> #include <xo/printable2/Printable.hpp>
#include <xo/alloc2/arena/IAllocator_DArena.hpp> #include <xo/alloc2/arena/IAllocator_DArena.hpp>
#include <xo/facet/FacetRegistry.hpp> #include <xo/facet/FacetRegistry.hpp>
@ -213,14 +215,10 @@ namespace xo {
DExpectFormalArglistSsm::on_leftparen_token(const Token & tk, DExpectFormalArglistSsm::on_leftparen_token(const Token & tk,
ParserStateMachine * p_psm) ParserStateMachine * p_psm)
{ {
scope log(XO_DEBUG(true));
if (fastate_ == formalarglstatetype::argl_0) { if (fastate_ == formalarglstatetype::argl_0) {
this->fastate_ = formalarglstatetype::argl_1a; this->fastate_ = formalarglstatetype::argl_1a;
log && log("STUB: DExpectFormalArglistSsm::on_leftparen_token -> DExpectFormalSsm::start()"); DExpectFormalArgSsm::start(p_psm);
//DExpectFormalSsm::start(p_psm);
return; return;
} }

View file

@ -29,11 +29,10 @@ namespace xo {
} }
void void
DExpectSymbolSsm::start(DArena & parser_alloc, DExpectSymbolSsm::start(ParserStateMachine * p_psm)
ParserStateMachine * p_psm)
{ {
DExpectSymbolSsm * sym_ssm DExpectSymbolSsm * sym_ssm
= DExpectSymbolSsm::make(parser_alloc); = DExpectSymbolSsm::make(p_psm->parser_alloc());
// note: // note:
// relying on [ISyntaxStateMachine_DExpectedSymbolSsm.hpp] // relying on [ISyntaxStateMachine_DExpectedSymbolSsm.hpp]

View file

@ -20,6 +20,9 @@
#include <xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp> #include <xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp>
#include <xo/reader2/ssm/IPrintable_DExpectFormalArglistSsm.hpp> #include <xo/reader2/ssm/IPrintable_DExpectFormalArglistSsm.hpp>
#include <xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp>
#include <xo/reader2/ssm/IPrintable_DExpectFormalArgSsm.hpp>
#include <xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp> #include <xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp>
#include <xo/reader2/ssm/IPrintable_DExpectSymbolSsm.hpp> #include <xo/reader2/ssm/IPrintable_DExpectSymbolSsm.hpp>
@ -63,6 +66,9 @@ namespace xo {
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectFormalArglistSsm>(); FacetRegistry::register_impl<ASyntaxStateMachine, DExpectFormalArglistSsm>();
FacetRegistry::register_impl<APrintable, DExpectFormalArglistSsm>(); FacetRegistry::register_impl<APrintable, DExpectFormalArglistSsm>();
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectFormalArgSsm>();
FacetRegistry::register_impl<APrintable, DExpectFormalArgSsm>();
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectSymbolSsm>(); FacetRegistry::register_impl<ASyntaxStateMachine, DExpectSymbolSsm>();
FacetRegistry::register_impl<APrintable, DExpectSymbolSsm>(); FacetRegistry::register_impl<APrintable, DExpectSymbolSsm>();
@ -80,6 +86,7 @@ namespace xo {
log && log(xtag("DLambdaSsm.tseq", typeseq::id<DLambdaSsm>())); log && log(xtag("DLambdaSsm.tseq", typeseq::id<DLambdaSsm>()));
log && log(xtag("DIfElseSsm.tseq", typeseq::id<DIfElseSsm>())); log && log(xtag("DIfElseSsm.tseq", typeseq::id<DIfElseSsm>()));
log && log(xtag("DExpectFormalArglistSsm.tseq", typeseq::id<DExpectFormalArglistSsm>())); log && log(xtag("DExpectFormalArglistSsm.tseq", typeseq::id<DExpectFormalArglistSsm>()));
log && log(xtag("DExpectFormalArgSsm.tseq", typeseq::id<DExpectFormalArgSsm>()));
log && log(xtag("DExpectSymbolSsm.tseq", typeseq::id<DExpectSymbolSsm>())); log && log(xtag("DExpectSymbolSsm.tseq", typeseq::id<DExpectSymbolSsm>()));
log && log(xtag("DExpectTypeSsm.tseq", typeseq::id<DExpectTypeSsm>())); log && log(xtag("DExpectTypeSsm.tseq", typeseq::id<DExpectTypeSsm>()));
log && log(xtag("DExpectExprSsm.tseq", typeseq::id<DExpectExprSsm>())); log && log(xtag("DExpectExprSsm.tseq", typeseq::id<DExpectExprSsm>()));