diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-08 23:40:42 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-09 02:06:06 -0500 |
commit | c3535d06c89732a0ba4c13274702b0f48198ae79 (patch) | |
tree | 5a8153d4c627cc3c7eff687b50a59a1cc9c3d04a /src/token.cc | |
parent | 523d4243e8c347cb7cbd1f68b03a5098ceb73b70 (diff) | |
download | fork-ledger-c3535d06c89732a0ba4c13274702b0f48198ae79.tar.gz fork-ledger-c3535d06c89732a0ba4c13274702b0f48198ae79.tar.bz2 fork-ledger-c3535d06c89732a0ba4c13274702b0f48198ae79.zip |
Redesigned the expr_t, predicate_t, query_t classes
Diffstat (limited to 'src/token.cc')
-rw-r--r-- | src/token.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/token.cc b/src/token.cc index fde6a0e3..3df072a7 100644 --- a/src/token.cc +++ b/src/token.cc @@ -138,7 +138,7 @@ void expr_t::token_t::parse_ident(std::istream& in) value.set_string(buf); } -void expr_t::token_t::next(std::istream& in, const uint_least8_t pflags) +void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags) { if (in.eof()) { kind = TOK_EOF; @@ -232,7 +232,7 @@ void expr_t::token_t::next(std::istream& in, const uint_least8_t pflags) case '{': { in.get(c); amount_t temp; - temp.parse(in, amount_t::PARSE_NO_MIGRATE); + temp.parse(in, PARSE_NO_MIGRATE); in.get(c); if (c != '}') expected('}', c); @@ -298,7 +298,7 @@ void expr_t::token_t::next(std::istream& in, const uint_least8_t pflags) case '/': { in.get(c); - if (pflags & PARSE_OP_CONTEXT) { // operator context + if (pflags.has_flags(PARSE_OP_CONTEXT)) { // operator context kind = SLASH; } else { // terminal context // Read in the regexp @@ -399,17 +399,16 @@ void expr_t::token_t::next(std::istream& in, const uint_least8_t pflags) // When in relaxed parsing mode, we want to migrate commodity flags // so that any precision specified by the user updates the current // maximum displayed precision. - amount_t::parse_flags_t parse_flags; - parser_t::parse_flags_t pflags_copy(pflags); + parse_flags_t parse_flags; - if (pflags_copy.has_flags(PARSE_NO_MIGRATE)) - parse_flags.add_flags(amount_t::PARSE_NO_MIGRATE); - if (pflags_copy.has_flags(PARSE_NO_REDUCE)) - parse_flags.add_flags(amount_t::PARSE_NO_REDUCE); + if (pflags.has_flags(PARSE_NO_MIGRATE)) + parse_flags.add_flags(PARSE_NO_MIGRATE); + if (pflags.has_flags(PARSE_NO_REDUCE)) + parse_flags.add_flags(PARSE_NO_REDUCE); try { amount_t temp; - if (! temp.parse(in, parse_flags.plus_flags(amount_t::PARSE_SOFT_FAIL))) { + if (! temp.parse(in, parse_flags.plus_flags(PARSE_SOFT_FAIL))) { // If the amount had no commodity, it must be an unambiguous // variable reference |