summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-28 01:11:23 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:27 -0400
commit935f849c7d1e076d994b7ec337ae82b2838ba6f9 (patch)
tree2685c9a9136a5ecef3fac8d69bcfda7d42f20e41
parenta597b0fb5e00220085ab5d5e1421fd9e41d9080e (diff)
downloadfork-ledger-935f849c7d1e076d994b7ec337ae82b2838ba6f9.tar.gz
fork-ledger-935f849c7d1e076d994b7ec337ae82b2838ba6f9.tar.bz2
fork-ledger-935f849c7d1e076d994b7ec337ae82b2838ba6f9.zip
(parse_transaction): Assign the entry to an xact while parsing it so
that the 'd' variable is available to value expressions within a transaction amount or cost.
-rw-r--r--textual.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/textual.cc b/textual.cc
index d5dbe3d7..258157c3 100644
--- a/textual.cc
+++ b/textual.cc
@@ -171,10 +171,13 @@ value_expr_t * parse_amount(const char * text, amount_t& amt,
return expr;
}
-transaction_t * parse_transaction(char * line, account_t * account)
+transaction_t * parse_transaction(char * line, account_t * account,
+ entry_t * entry = NULL)
{
// The account will be determined later...
std::auto_ptr<transaction_t> xact(new transaction_t(NULL));
+ if (entry)
+ xact->entry = entry;
// The call to `next_element' will skip past the account name, and
// return a pointer to the beginning of the amount. Once we know
@@ -455,7 +458,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
break;
}
- if (transaction_t * xact = parse_transaction(line, master)) {
+ if (transaction_t * xact = parse_transaction(line, master, curr.get())) {
if (state != transaction_t::UNCLEARED &&
xact->state == transaction_t::UNCLEARED)
xact->state = state;