From c3535d06c89732a0ba4c13274702b0f48198ae79 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 8 Nov 2009 23:40:42 -0500 Subject: Redesigned the expr_t, predicate_t, query_t classes --- src/token.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/token.cc') 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 -- cgit v1.2.3