xo-reader2 xo-expression2: pprint for DDefineExpr + DVariable

This commit is contained in:
Roland Conybeare 2026-01-20 15:06:58 -05:00
commit 480294ae05
21 changed files with 455 additions and 8 deletions

View file

@ -8,6 +8,7 @@
#include "Expression.hpp"
#include "DVariable.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/indentlog/print/pretty.hpp>
namespace xo {
namespace scm {
@ -21,6 +22,7 @@ namespace xo {
**/
class DDefineExpr {
public:
using ppindentinfo = xo::print::ppindentinfo;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -62,6 +64,12 @@ namespace xo {
void assign_valuetype(TypeDescr td) noexcept;
///@}
/** @defgroup scm-defineexpr-printable-facet **/
///@{
bool pretty(const ppindentinfo & ppii) const;
///@}
private:
/** @defgrouop scm-defineexpr-instance-vars **/

View file

@ -10,6 +10,7 @@
#include "TypeRef.hpp"
#include "exprtype.hpp"
#include <xo/reflect/TypeDescr.hpp>
#include <xo/indentlog/print/pretty.hpp>
namespace xo {
namespace scm {
@ -19,6 +20,7 @@ namespace xo {
**/
class DVariable {
public:
using ppindentinfo = xo::print::ppindentinfo;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -46,7 +48,7 @@ namespace xo {
void assign_name(const DUniqueString * name) { this->name_ = name; }
/** @defgroup scm-variable-expression-facet**/
/** @defgroup scm-variable-expression-facet **/
///@{
exprtype extype() const noexcept { return exprtype::variable; }
@ -55,6 +57,12 @@ namespace xo {
void assign_valuetype(TypeDescr td) noexcept;
///@}
/** @defgroup scm-variable-printable-facet **/
///@{
bool pretty(const ppindentinfo & ppii) const;
///@}
private:
/** symbol name **/

View file

@ -55,7 +55,7 @@ namespace xo {
static TypeDescr valuetype(const DVariable & self) noexcept;
// non-const methods
/** assing to valuetype member. Useful when scaffolding expressions **/
/** assign to valuetype member. Useful when scaffolding expressions **/
static void assign_valuetype(DVariable & self, TypeDescr td) noexcept;
///@}
};
@ -63,4 +63,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

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

View file

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