xo-reader2: + DExpectExprSsm + use from DDefineSsm

This commit is contained in:
Roland Conybeare 2026-01-22 10:54:36 -05:00
commit 8b148285b1
15 changed files with 465 additions and 24 deletions

View file

@ -32,7 +32,16 @@ namespace xo {
bool allow_defs,
bool cxl_on_rightparen,
ParserStateMachine * p_psm);
static void start(DArena & parser_mm,
ParserStateMachine * p_psm);
/** @defgroup scm-expectexpr-access-methods access methods **/
///@{
bool allow_defs() const noexcept { return allow_defs_; }
bool cxl_on_rightbrace() const noexcept { return cxl_on_rightbrace_; }
///@}
/** @defgroup scm-expectexpr-ssm-facet syntaxstatemachine facet methods **/
///@{

View file

@ -0,0 +1,62 @@
/** @file IPrintable_DExpectExprSsm.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IPrintable_DExpectExprSsm.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IPrintable_DExpectExprSsm.json5]
**/
#pragma once
#include "Printable.hpp"
#include <xo/printable2/Printable.hpp>
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
#include "DExpectExprSsm.hpp"
namespace xo { namespace scm { class IPrintable_DExpectExprSsm; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::print::APrintable,
xo::scm::DExpectExprSsm>
{
using ImplType = xo::print::IPrintable_Xfer
<xo::scm::DExpectExprSsm,
xo::scm::IPrintable_DExpectExprSsm>;
};
}
}
namespace xo {
namespace scm {
/** @class IPrintable_DExpectExprSsm
**/
class IPrintable_DExpectExprSsm {
public:
/** @defgroup scm-printable-dexpectexprssm-type-traits **/
///@{
using ppindentinfo = xo::print::APrintable::ppindentinfo;
using Copaque = xo::print::APrintable::Copaque;
using Opaque = xo::print::APrintable::Opaque;
///@}
/** @defgroup scm-printable-dexpectexprssm-methods **/
///@{
// const methods
/** Pretty-printing support for this object.
See [xo-indentlog/xo/indentlog/pretty.hpp] **/
static bool pretty(const DExpectExprSsm & self, const ppindentinfo & ppii);
// non-const methods
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -0,0 +1,77 @@
/** @file ISyntaxStateMachine_DExpectExprSsm.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/ISyntaxStateMachine_DExpectExprSsm.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/ISyntaxStateMachine_DExpectExprSsm.json5]
**/
#pragma once
#include "SyntaxStateMachine.hpp"
#include "SyntaxStateMachine.hpp"
#include "ssm/ISyntaxStateMachine_Xfer.hpp"
#include "DExpectExprSsm.hpp"
namespace xo { namespace scm { class ISyntaxStateMachine_DExpectExprSsm; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::ASyntaxStateMachine,
xo::scm::DExpectExprSsm>
{
using ImplType = xo::scm::ISyntaxStateMachine_Xfer
<xo::scm::DExpectExprSsm,
xo::scm::ISyntaxStateMachine_DExpectExprSsm>;
};
}
}
namespace xo {
namespace scm {
/** @class ISyntaxStateMachine_DExpectExprSsm
**/
class ISyntaxStateMachine_DExpectExprSsm {
public:
/** @defgroup scm-syntaxstatemachine-dexpectexprssm-type-traits **/
///@{
using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr;
using Copaque = xo::scm::ASyntaxStateMachine::Copaque;
using Opaque = xo::scm::ASyntaxStateMachine::Opaque;
///@}
/** @defgroup scm-syntaxstatemachine-dexpectexprssm-methods **/
///@{
// const methods
/** identify a type of syntax state machine **/
static syntaxstatetype ssm_type(const DExpectExprSsm & self) noexcept;
/** text describing expected/allowed input to this ssm in current state **/
static std::string_view get_expect_str(const DExpectExprSsm & self) noexcept;
// non-const methods
/** operate state machine for incoming symbol-token @p tk **/
static void on_symbol_token(DExpectExprSsm & self, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for incoming define-keyword-token @p tk **/
static void on_def_token(DExpectExprSsm & self, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for incoming if-keyword-token @p tk **/
static void on_if_token(DExpectExprSsm & self, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for incoming colon-token @p tk **/
static void on_colon_token(DExpectExprSsm & self, const Token & tk, ParserStateMachine * p_psm);
/** update state machine for incoming singleassign-token @p tk **/
static void on_singleassign_token(DExpectExprSsm & self, const Token & tk, ParserStateMachine * p_psm);
/** update stat machine for incoming parsed symbol @p sym **/
static void on_parsed_symbol(DExpectExprSsm & self, std::string_view sym, ParserStateMachine * p_psm);
/** operate state machine for incoming type description @p td **/
static void on_parsed_typedescr(DExpectExprSsm & self, TypeDescr td, ParserStateMachine * p_psm);
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -27,6 +27,9 @@ namespace xo {
/** expecting a type. See @ref DExpectTypeSsm **/
expect_type,
/** expecting a rhs expression. See @ref DExpectExprSsm **/
expect_rhs_expression,
/** handle define-expression. See @ref DDefineSsm **/
defexpr,