summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-08 23:40:42 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-09 02:06:06 -0500
commitc3535d06c89732a0ba4c13274702b0f48198ae79 (patch)
tree5a8153d4c627cc3c7eff687b50a59a1cc9c3d04a /src/textual.cc
parent523d4243e8c347cb7cbd1f68b03a5098ceb73b70 (diff)
downloadfork-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/textual.cc')
-rw-r--r--src/textual.cc34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/textual.cc b/src/textual.cc
index 8d4294a6..37c38e55 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -144,13 +144,13 @@ namespace {
const string& name);
};
- void parse_amount_expr(scope_t& scope,
- std::istream& in,
- amount_t& amount,
- post_t * post,
- uint_least8_t flags = 0)
+ void parse_amount_expr(scope_t& scope,
+ std::istream& in,
+ amount_t& amount,
+ post_t * post,
+ const parse_flags_t& flags = PARSE_DEFAULT)
{
- expr_t expr(in, flags | static_cast<uint_least8_t>(expr_t::PARSE_PARTIAL));
+ expr_t expr(in, flags.plus_flags(PARSE_PARTIAL));
DEBUG("textual.parse", "Parsed an amount expression");
@@ -506,8 +506,8 @@ void instance_t::automated_xact_directive(char * line)
}
std::auto_ptr<auto_xact_t> ae
- (new auto_xact_t(item_predicate(skip_ws(line + 1),
- keep_details_t(true, true, true))));
+ (new auto_xact_t(predicate_t(skip_ws(line + 1),
+ keep_details_t(true, true, true))));
reveal_context = false;
@@ -852,12 +852,10 @@ post_t * instance_t::parse_post(char * line,
ptristream stream(next, len - beg);
if (*next != '(') // indicates a value expression
- post->amount.parse(stream, amount_t::PARSE_NO_REDUCE);
+ post->amount.parse(stream, PARSE_NO_REDUCE);
else
parse_amount_expr(scope, stream, post->amount, post.get(),
- static_cast<uint_least8_t>(expr_t::PARSE_NO_REDUCE) |
- static_cast<uint_least8_t>(expr_t::PARSE_SINGLE) |
- static_cast<uint_least8_t>(expr_t::PARSE_NO_ASSIGN));
+ PARSE_NO_REDUCE | PARSE_SINGLE | PARSE_NO_ASSIGN);
if (! post->amount.is_null() && honor_strict && strict &&
post->amount.has_commodity() &&
@@ -900,12 +898,11 @@ post_t * instance_t::parse_post(char * line,
ptristream cstream(p, len - beg);
if (*p != '(') // indicates a value expression
- post->cost->parse(cstream, amount_t::PARSE_NO_MIGRATE);
+ post->cost->parse(cstream, PARSE_NO_MIGRATE);
else
parse_amount_expr(scope, cstream, *post->cost, post.get(),
- static_cast<uint_least8_t>(expr_t::PARSE_NO_MIGRATE) |
- static_cast<uint_least8_t>(expr_t::PARSE_SINGLE) |
- static_cast<uint_least8_t>(expr_t::PARSE_NO_ASSIGN));
+ PARSE_NO_MIGRATE | PARSE_SINGLE |
+ PARSE_NO_ASSIGN);
if (post->cost->sign() < 0)
throw parse_error(_("A posting's cost may not be negative"));
@@ -953,11 +950,10 @@ post_t * instance_t::parse_post(char * line,
ptristream stream(p, len - beg);
if (*p != '(') // indicates a value expression
- post->assigned_amount->parse(stream, amount_t::PARSE_NO_MIGRATE);
+ post->assigned_amount->parse(stream, PARSE_NO_MIGRATE);
else
parse_amount_expr(scope, stream, *post->assigned_amount, post.get(),
- static_cast<uint_least8_t>(expr_t::PARSE_SINGLE) |
- static_cast<uint_least8_t>(expr_t::PARSE_NO_MIGRATE));
+ PARSE_SINGLE | PARSE_NO_MIGRATE);
if (post->assigned_amount->is_null()) {
if (post->amount.is_null())