xo-reader2: + DFormalArgSsm printable facet

This commit is contained in:
Roland Conybeare 2026-01-28 18:04:08 -05:00
commit e7d4c4ae28
8 changed files with 135 additions and 19 deletions

View file

@ -150,6 +150,18 @@ xo_add_genfacetimpl(
OUTPUT_CPP_DIR src/reader2
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-reader2-facetimpl-printable-expectformalargssm
FACET_PKG xo_printable2
FACET Printable
REPR ExpectFormalArgSsm
INPUT idl/IPrintable_DExpectFormalArgSsm.json5
OUTPUT_HPP_DIR include/xo/reader2
OUTPUT_IMPL_SUBDIR ssm
OUTPUT_CPP_DIR src/reader2
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git

View file

@ -0,0 +1,13 @@
{
mode: "implementation",
includes: [ "<xo/printable2/Printable.hpp>",
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Printable.json5",
brief: "provide APrintable interface for DExpectFormalArgSsm",
using_doxygen: true,
repr: "DExpectFormalArgSsm",
doc: [ "implement APrintable for DExpectFormalArgSsm" ],
}

View file

@ -48,6 +48,7 @@ namespace xo {
public:
using TypeDescr = xo::reflect::TypeDescr;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
public:
DExpectFormalArgSsm();
@ -97,6 +98,13 @@ namespace xo {
ParserStateMachine * p_psm);
///@}
/** @defgroup scm-expectformalargssm-printable-facet printable facet methods **/
///@{
/** pretty-printing support **/
bool pretty(const ppindentinfo & ppii) const;
///@}
#ifdef NOT_YET
@ -117,8 +125,6 @@ namespace xo {
virtual void on_typedescr(TypeDescr td,
parserstatemachine * p_psm) override;
virtual void print(std::ostream & os) const override;
private:
static std::unique_ptr<expect_formal_xs> make();
#endif

View file

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

View file

@ -39,7 +39,7 @@ set(SELF_SRCS
DExpectFormalArgSsm.cpp
ISyntaxStateMachine_DExpectFormalArgSsm.cpp
# IPrintable_DExpectFormalArgSsm.cpp
IPrintable_DExpectFormalArgSsm.cpp
DExpectSymbolSsm.cpp
ISyntaxStateMachine_DExpectSymbolSsm.cpp

View file

@ -739,12 +739,10 @@ namespace xo {
assert(expr.data());
(void)expr;
return ppii.pps()->pretty_struct
(ppii,
"DDefineSsm",
refrtag("defstate", defstate_),
refrtag("def_expr", expr)
);
return ppii.pps()->pretty_struct(ppii,
"DDefineSsm",
refrtag("defstate", defstate_),
refrtag("def_expr", expr));
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -216,18 +216,15 @@ namespace xo {
exprstate::on_typedescr(td, p_psm);
}
}
void
expect_formal_xs::print(std::ostream & os) const {
os << "<expect_formal_xs"
<< xtag("type", formalxs_type_);
if (!result_.name().empty())
os << xtag("result.name", result_.name());
if (result_.td())
os << xtag("result.td", result_.td());
os << ">";
}
#endif
bool
DExpectFormalArgSsm::pretty(const ppindentinfo & ppii) const {
return ppii.pps()->pretty_struct
(ppii,
"DExpectFormalArgSsm");
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -0,0 +1,28 @@
/** @file IPrintable_DExpectFormalArgSsm.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IPrintable_DExpectFormalArgSsm.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IPrintable_DExpectFormalArgSsm.json5]
**/
#include "ssm/IPrintable_DExpectFormalArgSsm.hpp"
namespace xo {
namespace scm {
auto
IPrintable_DExpectFormalArgSsm::pretty(const DExpectFormalArgSsm & self, const ppindentinfo & ppii) -> bool
{
return self.pretty(ppii);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IPrintable_DExpectFormalArgSsm.cpp */