xo-reader: + pretty-printing support [WIP]

This commit is contained in:
Roland Conybeare 2025-07-13 21:21:20 -05:00
commit 495d8cd44a
18 changed files with 84 additions and 21 deletions

View file

@ -61,6 +61,10 @@ int
main() {
using namespace replxx;
using namespace xo::scm;
using xo::ast::Expression;
using xo::print::ppconfig;
using xo::print::ppstate_standalone;
using xo::rp;
using namespace std;
using span_type = xo::scm::span<const char>;
@ -92,7 +96,10 @@ main() {
auto [expr, consumed, psz] = rdr.read_expr(input, eof);
if (expr) {
cout << expr << endl;
ppconfig ppc;
ppstate_standalone pps(&cout, 0, &ppc);
pps.prettyn(expr);
}
input = input.after_prefix(consumed);
@ -103,7 +110,10 @@ main() {
auto [expr, _1, _2] = rdr.read_expr(input, true /*eof*/);
if (expr) {
cout << expr << endl;
ppconfig ppc;
ppstate_standalone pps(&cout, 0, &ppc);
pps.prettyn<rp<Expression>>(rp<Expression>(expr));
}
rx.history_save("repl_history.txt");