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
|
|
@ -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*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue