summaryrefslogtreecommitdiff
path: root/src/token.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-29 02:24:25 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-29 02:24:25 -0400
commit8b75b5cbfbb53e0bfa51c63dc96ade69617cd1db (patch)
treec10c7ea058d0491988078093ad27bac2f9ba240c /src/token.cc
parent5b388af6264b1bff5ff143db4120e4776d06c90c (diff)
downloadfork-ledger-8b75b5cbfbb53e0bfa51c63dc96ade69617cd1db.tar.gz
fork-ledger-8b75b5cbfbb53e0bfa51c63dc96ade69617cd1db.tar.bz2
fork-ledger-8b75b5cbfbb53e0bfa51c63dc96ade69617cd1db.zip
Revised the way that parsing flags get passed around.
Diffstat (limited to 'src/token.cc')
-rw-r--r--src/token.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/token.cc b/src/token.cc
index 964c65de..f2b43ffb 100644
--- a/src/token.cc
+++ b/src/token.cc
@@ -198,7 +198,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_PARSE_NO_MIGRATE);
+ temp.parse(in, amount_t::PARSE_NO_MIGRATE);
in.get(c);
if (c != '}')
expected('}', c);
@@ -343,15 +343,17 @@ 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::flags_t parse_flags = 0;
- if (pflags & EXPR_PARSE_NO_MIGRATE)
- parse_flags |= AMOUNT_PARSE_NO_MIGRATE;
- if (pflags & EXPR_PARSE_NO_REDUCE)
- parse_flags |= AMOUNT_PARSE_NO_REDUCE;
+ amount_t::parse_flags_t parse_flags;
+ parser_t::parse_flags_t pflags_copy(pflags);
+
+ 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);
try {
amount_t temp;
- if (! temp.parse(in, parse_flags | AMOUNT_PARSE_SOFT_FAIL)) {
+ if (! temp.parse(in, parse_flags.plus_flags(amount_t::PARSE_SOFT_FAIL))) {
// If the amount had no commodity, it must be an unambiguous
// variable reference