xo-expression: + GeneralizedExpression pretty-printing [WIP]

This commit is contained in:
Roland Conybeare 2025-07-13 21:20:19 -05:00
commit 0b0d8ffdc0
11 changed files with 204 additions and 1 deletions

View file

@ -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 **/