diff options
author | John Wiegley <johnw@newartisans.com> | 2008-08-02 17:07:04 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-08-02 17:07:04 -0400 |
commit | 7b3c8c03c56fa90f8e110ed14ce3af27fb49b458 (patch) | |
tree | 3c51d4b555e0cadf65003d359f249be0ac495864 /op.cc | |
parent | e52a6a9bd8e2bbf3a497696eed735eb00a8b9dde (diff) | |
download | fork-ledger-7b3c8c03c56fa90f8e110ed14ce3af27fb49b458.tar.gz fork-ledger-7b3c8c03c56fa90f8e110ed14ce3af27fb49b458.tar.bz2 fork-ledger-7b3c8c03c56fa90f8e110ed14ce3af27fb49b458.zip |
Changed the way that bare masks are parsed. There is still some coupling
here, albeit just through flag values. It needs to be changed, though.
Diffstat (limited to 'op.cc')
-rw-r--r-- | op.cc | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -647,6 +647,34 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope) } return this; + case MASK: { + ptr_op_t match = new op_t(op_t::O_MATCH); + match->set_right(this); + + // jww (2008-08-02): Coupling! + ptr_op_t ident = new op_t(op_t::IDENT); + switch (as_mask().flags()) { + case MASK_SHORT_ACCOUNT: + ident->set_ident("account_base"); + break; + case MASK_CODE: + ident->set_ident("code"); + break; + case MASK_PAYEE: + ident->set_ident("payee"); + break; + case MASK_NOTE: + ident->set_ident("note"); + break; + case MASK_ACCOUNT: + ident->set_ident("account"); + break; + } + match->set_left(ident->compile(scope)); + + return match; + } + default: break; } @@ -720,8 +748,8 @@ value_t expr_t::op_t::calc(scope_t& scope) } case O_MATCH: - assert(left()->is_mask()); - return left()->as_mask().match(right()->calc(scope).to_string()); + assert(right()->is_mask()); + return right()->as_mask().match(left()->calc(scope).to_string()); case INDEX: { const call_scope_t& args(downcast<const call_scope_t>(scope)); |