summaryrefslogtreecommitdiff
path: root/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'expr.cc')
-rw-r--r--expr.cc14
1 files changed, 12 insertions, 2 deletions
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