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 /parser.cc | |
parent | e52a6a9bd8e2bbf3a497696eed735eb00a8b9dde (diff) | |
download | ledger-7b3c8c03c56fa90f8e110ed14ce3af27fb49b458.tar.gz ledger-7b3c8c03c56fa90f8e110ed14ce3af27fb49b458.tar.bz2 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 'parser.cc')
-rw-r--r-- | parser.cc | 42 |
1 files changed, 4 insertions, 38 deletions
@@ -47,42 +47,11 @@ expr_t::parser_t::parse_value_term(std::istream& in, node->set_value(tok.value); break; - case token_t::MASK: { - // A /mask/ is just a shorthand for calling match(). - node = new op_t(op_t::O_MATCH); - - ptr_op_t mask = new op_t(op_t::MASK); - mask->set_mask(tok.value.as_string()); - - ptr_op_t ident = new op_t(op_t::IDENT); - - node->set_left(mask); - node->set_right(ident); - - switch (tok.flags()) { - case TOKEN_SHORT_ACCOUNT_MASK: - ident->set_ident("account_base"); - break; - case TOKEN_CODE_MASK: - ident->set_ident("code"); - break; -#if 0 - case TOKEN_COMMODITY_MASK: - ident->set_ident("commodity"); - break; -#endif - case TOKEN_PAYEE_MASK: - ident->set_ident("payee"); - break; - case TOKEN_NOTE_MASK: - ident->set_ident("note"); - break; - case TOKEN_ACCOUNT_MASK: - ident->set_ident("account"); - break; - } + case token_t::MASK: + node = new op_t(op_t::MASK); + node->set_mask(tok.value.as_string()); + node->as_mask_lval().add_flags(tok.flags()); break; - } case token_t::IDENT: { #if 0 @@ -296,9 +265,6 @@ expr_t::parser_t::parse_logic_expr(std::istream& in, break; case token_t::MATCH: kind = op_t::O_MATCH; - assert(node->kind == op_t::O_MATCH); - node = node->left(); - assert(node->kind == op_t::MASK); break; case token_t::LESS: kind = op_t::O_LT; |