From ea3b386062e62379c546239f2e95cb1e11c56d23 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 1 Aug 2008 03:44:22 -0400 Subject: Added a new 'format' debugging command, which dissects the formatting expression in its argument. --- expr.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'expr.cc') diff --git a/expr.cc b/expr.cc index 9e961ca0..263df13d 100644 --- a/expr.cc +++ b/expr.cc @@ -32,6 +32,7 @@ #include "expr.h" #include "parser.h" #include "op.h" +#include "scope.h" // jww (2008-08-01): not necessary namespace ledger { @@ -153,8 +154,10 @@ value_t expr_t::eval(const string& _expr, scope_t& scope) void expr_t::print(std::ostream& out, scope_t& scope) const { - op_t::print_context_t context(scope); - ptr->print(out, context); + if (ptr) { + op_t::print_context_t context(scope); + ptr->print(out, context); + } } void expr_t::dump(std::ostream& out) const @@ -187,4 +190,11 @@ void expr_t::shutdown() parser.reset(); } +std::ostream& operator<<(std::ostream& out, const expr_t& expr) { + // jww (2008-08-01): shouldn't be necessary + symbol_scope_t scope; + expr.print(out, scope); + return out; +} + } // namespace ledger -- cgit v1.2.3