summaryrefslogtreecommitdiff
path: root/src/op.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-03 18:11:59 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-03 18:11:59 -0400
commitf49dfce30209c1d2f1fbc1f348364ac53dbb2e4e (patch)
treed18e3461c4f70513caa7c0bcf22bcaac2c6e599d /src/op.cc
parent918f76b263592bcd52704fec17ae84eb06d4d0c2 (diff)
downloadfork-ledger-f49dfce30209c1d2f1fbc1f348364ac53dbb2e4e.tar.gz
fork-ledger-f49dfce30209c1d2f1fbc1f348364ac53dbb2e4e.tar.bz2
fork-ledger-f49dfce30209c1d2f1fbc1f348364ac53dbb2e4e.zip
Fixed the processing of O_NOT operations.
Diffstat (limited to 'src/op.cc')
-rw-r--r--src/op.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/op.cc b/src/op.cc
index e34be005..1e23d3fe 100644
--- a/src/op.cc
+++ b/src/op.cc
@@ -56,8 +56,8 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope)
return this;
ptr_op_t lhs(left()->compile(scope));
- ptr_op_t rhs(has_right() ? (kind == O_LOOKUP ?
- right() : right()->compile(scope)) :
+ ptr_op_t rhs(kind > UNARY_OPERATORS && has_right() ?
+ (kind == O_LOOKUP ? right() : right()->compile(scope)) :
ptr_op_t());
if (lhs == left() && (! rhs || rhs == right()))
@@ -264,14 +264,16 @@ bool expr_t::op_t::print(std::ostream& out, const context_t& context) const
break;
case O_NOT:
- out << "!";
+ out << "!(";
if (left() && left()->print(out, context))
found = true;
+ out << ")";
break;
case O_NEG:
- out << "-";
+ out << "-(";
if (left() && left()->print(out, context))
found = true;
+ out << ")";
break;
case O_ADD: