xo-reader2 xo-expression2: + DSequenceSsm ++ utest

This commit is contained in:
Roland Conybeare 2026-01-31 18:28:25 -05:00
commit 15f779d2f8
64 changed files with 514 additions and 154 deletions

View file

@ -6,7 +6,7 @@
#pragma once
#include "DSyntaxStateMachine.hpp"
//#include "exprstate.hpp"
#include <xo/expression2/DSequenceExpr.hpp>
namespace xo {
namespace scm { class Sequence; }
@ -15,21 +15,29 @@ namespace xo {
namespace scm {
class DSequenceSsm : public DSyntaxStateMachine<DSequenceSsm> {
public:
using Sequence = xo::scm::Sequence;
using Lambda = xo::scm::Lambda;
//using Sequence = xo::scm::Sequence;
//using Lambda = xo::scm::Lambda;
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
public:
const char * ssm_classname() const noexcept { return "DSequenceSsm"; }
static const char * ssm_classname() { return "DSequenceSsm"; }
#ifdef NOT_YET
/** start parsing a sequence-expr.
* input begins with first expression in the sequence.
**/
static void start(parserstatemachine * p_psm);
static void start(ParserStateMachine * p_psm);
/** named ctor idiom **/
static std::unique_ptr<sequence_xs> make();
/** create instance using memory from @p parser_mm **/
static obj<ASyntaxStateMachine,DSequenceSsm> make(DArena & parser_mm,
obj<AAllocator> expr_mm);
/** create instance using memory from @p parser_mm **/
static DSequenceSsm * _make(DArena & parser_mm,
obj<AAllocator> expr_mm);
#ifdef NOT_YET
virtual void on_expr(bp<Expression> expr,
parserstatemachine * p_psm) override;
virtual void on_expr_with_semicolon(bp<Expression> expr,
@ -37,18 +45,34 @@ namespace xo {
virtual void on_rightbrace_token(const token_type & tk,
parserstatemachine * p_psm) override;
virtual void print(std::ostream & os) const override;
virtual bool pretty_print(const xo::print::ppindentinfo & ppii) const override;
#endif
private:
DSequenceSsm();
/** @defgroup scm-sequencessm-syntaxstatemachine-facet ssm facet **/
///@{
/** indentifies this state machine **/
syntaxstatetype ssm_type() const noexcept;
/** mnemonic for syntax sequence ssm expects given current state **/
std::string_view get_expect_str() const noexcept;
///@}
/** @defgroup scm-sequencessm-printable-facet printable facet **/
///@{
/** pretty printing support **/
bool pretty(const ppindentinfo & ppii) const;
///@}
private:
/** will build SequenceExpr from in-order contents of this array **/
DArray * expr_v_;
//std::vector<rp<Expression>> expr_v_;
explicit DSequenceSsm(DSequenceExpr * seq_expr);
private:
/** scaffold sequence-expression here.
* This will eventually be the output of this ssm
**/
DSequenceExpr * seq_expr_ = nullptr;
};
} /*namespace scm*/
} /*namespace xo*/