summaryrefslogtreecommitdiff
path: root/expr.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-08-01 03:44:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-08-01 03:44:22 -0400
commitea3b386062e62379c546239f2e95cb1e11c56d23 (patch)
treef200790541093b401b3a40af000a90daff7b6cb5 /expr.cc
parent8ed99e621daccdebfe4fd81d9b3744ed1cdb375f (diff)
downloadledger-ea3b386062e62379c546239f2e95cb1e11c56d23.tar.gz
ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.tar.bz2
ledger-ea3b386062e62379c546239f2e95cb1e11c56d23.zip
Added a new 'format' debugging command, which dissects the formatting
expression in its argument.
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