xo-expression: + GeneralizedExpression pretty-printing [WIP]
This commit is contained in:
parent
55602c83cc
commit
0b0d8ffdc0
11 changed files with 204 additions and 1 deletions
|
|
@ -101,6 +101,7 @@ namespace xo {
|
|||
virtual void attach_envs(bp<Environment> p) override;
|
||||
|
||||
virtual void display(std::ostream & os) const override;
|
||||
virtual std::uint32_t pretty_print(ppstate * pps, bool upto) const override;
|
||||
|
||||
private:
|
||||
Apply(TypeDescr apply_valuetype,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
virtual void display(std::ostream & os) const override;
|
||||
virtual std::uint32_t pretty_print(ppstate * pps, bool upto) const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include "xo/refcnt/Refcounted.hpp"
|
||||
#include "xo/reflect/TypeDescr.hpp"
|
||||
#include "exprtype.hpp"
|
||||
//#include <cstdint>
|
||||
|
||||
namespace xo {
|
||||
namespace ast {
|
||||
|
|
@ -22,6 +21,7 @@ namespace xo {
|
|||
class GeneralizedExpression : public ref::Refcount {
|
||||
public:
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
using ppstate = xo::print::ppstate;
|
||||
|
||||
public:
|
||||
GeneralizedExpression(exprtype extype, TypeDescr valuetype)
|
||||
|
|
@ -34,6 +34,8 @@ namespace xo {
|
|||
virtual void display(std::ostream & os) const = 0;
|
||||
/** human-readable string representation **/
|
||||
virtual std::string display_string() const;
|
||||
/** pretty printing support. See [xo-indentlog/xo/indentlog/pretty.hpp] **/
|
||||
virtual std::uint32_t pretty_print(ppstate * pps, bool upto) const;
|
||||
|
||||
protected:
|
||||
/** useful when scaffolding expressions in a parser **/
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ namespace xo {
|
|||
virtual void attach_envs(bp<Environment> p) override;
|
||||
|
||||
virtual void display(std::ostream & os) const override;
|
||||
virtual std::uint32_t pretty_print(ppstate * pps, bool upto) const override;
|
||||
|
||||
protected:
|
||||
/** create type description for lambda with arguments @p argv
|
||||
|
|
|
|||
|
|
@ -103,6 +103,12 @@ namespace xo {
|
|||
};
|
||||
|
||||
} /*namespace ast*/
|
||||
|
||||
#ifndef ppdetail_atomic
|
||||
namespace print {
|
||||
PPDETAIL_ATOMIC(xo::ast::LocalEnv);
|
||||
}
|
||||
#endif
|
||||
} /*namespace xo*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ namespace xo {
|
|||
// ----- from GeneralizedExpression ----
|
||||
|
||||
virtual void display(std::ostream & os) const override;
|
||||
virtual std::uint32_t pretty_print(ppstate * pps, bool upto) const override;
|
||||
|
||||
private:
|
||||
/** sequence of expressions; evaluate in left-to-right order.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue