diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-09 01:28:20 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-09 01:28:20 -0600 |
commit | c9f7195936090ecbe2d5b4ec88c196660ae24f81 (patch) | |
tree | 7bfbe9d00de44c0c79c460169ad324b6a17c6379 /src/textual.cc | |
parent | 9f81c798ee0854cab038714670123bff6676a5d5 (diff) | |
download | fork-ledger-c9f7195936090ecbe2d5b4ec88c196660ae24f81.tar.gz fork-ledger-c9f7195936090ecbe2d5b4ec88c196660ae24f81.tar.bz2 fork-ledger-c9f7195936090ecbe2d5b4ec88c196660ae24f81.zip |
Added the notion of "virtual costs"
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/textual.cc b/src/textual.cc index 66972fb3..a8cb844b 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1447,12 +1447,16 @@ post_t * instance_t::parse_post(char * line, // Parse the optional cost (@ PER-UNIT-COST, @@ TOTAL-COST) - if (*next == '@') { + if (*next == '@' || (*next == '(' && *(next + 1) == '@')) { DEBUG("textual.parse", "line " << context.linenum << ": " << "Found a price indicator"); - bool per_unit = true; + if (*next == '(') { + post->add_flags(POST_COST_VIRTUAL); + ++next; + } + bool per_unit = true; if (*++next == '@') { per_unit = false; post->add_flags(POST_COST_IN_FULL); @@ -1460,6 +1464,9 @@ post_t * instance_t::parse_post(char * line, << "And it's for a total price"); } + if (post->has_flags(POST_COST_VIRTUAL) && *(next + 1) == ')') + ++next; + beg = static_cast<std::streamsize>(++next - line); p = skip_ws(next); |