xo-reader2 xo-expression2: pprint for DDefineExpr + DVariable
This commit is contained in:
parent
ca2be0172a
commit
480294ae05
21 changed files with 455 additions and 8 deletions
|
|
@ -12,8 +12,12 @@ set(SELF_SRCS
|
|||
|
||||
IExpression_Any.cpp
|
||||
IExpression_DConstant.cpp
|
||||
|
||||
IExpression_DVariable.cpp
|
||||
IPrintable_DVariable.cpp
|
||||
|
||||
IExpression_DDefineExpr.cpp
|
||||
IPrintable_DDefineExpr.cpp
|
||||
|
||||
DLocalSymtab.cpp
|
||||
DGlobalSymtab.cpp
|
||||
|
|
|
|||
|
|
@ -4,9 +4,14 @@
|
|||
**/
|
||||
|
||||
#include "DDefineExpr.hpp"
|
||||
#include "detail/IPrintable_DVariable.hpp"
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::print::APrintable;
|
||||
using xo::facet::FacetRegistry;
|
||||
using xo::facet::typeseq;
|
||||
|
||||
namespace scm {
|
||||
|
|
@ -60,6 +65,30 @@ namespace xo {
|
|||
{
|
||||
lhs_var_->assign_valuetype(td);
|
||||
}
|
||||
|
||||
bool
|
||||
DDefineExpr::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
auto lhs = obj<APrintable,DVariable>(lhs_var_);
|
||||
auto rhs = FacetRegistry::instance().try_variant<APrintable,
|
||||
AExpression>(rhs_);
|
||||
|
||||
if (rhs_) {
|
||||
assert(rhs);
|
||||
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DDefineExpr",
|
||||
refrtag("lhs", lhs),
|
||||
refrtag("rhs", rhs));
|
||||
} else {
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DDefineExpr",
|
||||
refrtag("lhs", lhs));
|
||||
}
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,19 @@ namespace xo {
|
|||
typeref_.resolve(td);
|
||||
}
|
||||
|
||||
bool
|
||||
DVariable::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
auto name = (name_
|
||||
? std::string_view(*name_)
|
||||
: std::string_view(""));
|
||||
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DVariable",
|
||||
refrtag("name", name));
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
28
xo-expression2/src/expression2/IPrintable_DDefineExpr.cpp
Normal file
28
xo-expression2/src/expression2/IPrintable_DDefineExpr.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DDefineExpr.cpp
|
||||
*
|
||||
* 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_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DDefineExpr.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IPrintable_DDefineExpr.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DDefineExpr::pretty(const DDefineExpr & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DDefineExpr.cpp */
|
||||
28
xo-expression2/src/expression2/IPrintable_DVariable.cpp
Normal file
28
xo-expression2/src/expression2/IPrintable_DVariable.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DVariable.cpp
|
||||
*
|
||||
* 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_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DVariable.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IPrintable_DVariable.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DVariable::pretty(const DVariable & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DVariable.cpp */
|
||||
|
|
@ -8,6 +8,10 @@
|
|||
#include <xo/expression2/detail/IGCObject_DUniqueString.hpp>
|
||||
#include <xo/expression2/detail/IPrintable_DUniqueString.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IPrintable_DDefineExpr.hpp>
|
||||
|
||||
#include <xo/expression2/detail/IPrintable_DVariable.hpp>
|
||||
|
||||
#include <xo/gc/detail/AGCObject.hpp>
|
||||
#include <xo/printable2/detail/APrintable.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
|
@ -28,7 +32,15 @@ namespace xo {
|
|||
FacetRegistry::register_impl<AGCObject, DUniqueString>();
|
||||
FacetRegistry::register_impl<APrintable, DUniqueString>();
|
||||
|
||||
FacetRegistry::register_impl<APrintable, DDefineExpr>();
|
||||
|
||||
FacetRegistry::register_impl<APrintable, DVariable>();
|
||||
|
||||
log && log(xtag("DUniqueString.tseq", typeseq::id<DUniqueString>()));
|
||||
log && log(xtag("DDefineExpr.tseq", typeseq::id<DDefineExpr>()));
|
||||
log && log(xtag("DVariable.tseq", typeseq::id<DVariable>()));
|
||||
|
||||
log && log(xtag("AExpression.tqseq", typeseq::id<AExpression>()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue