diff options
author | John Wiegley <johnw@newartisans.com> | 2009-03-03 16:28:20 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-03-03 16:28:20 -0400 |
commit | c305db937c761e75adbc0cd33bc56a8593ab0caf (patch) | |
tree | aefa9c4034f16de02c6bf43b2f2d298b0ea17560 | |
parent | e2c30cf6e4e8c0d38f129e3e209954bf1bfbe602 (diff) | |
download | fork-ledger-c305db937c761e75adbc0cd33bc56a8593ab0caf.tar.gz fork-ledger-c305db937c761e75adbc0cd33bc56a8593ab0caf.tar.bz2 fork-ledger-c305db937c761e75adbc0cd33bc56a8593ab0caf.zip |
If a posting has an integer amount, convert it
-rw-r--r-- | src/textual.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/textual.cc b/src/textual.cc index 4d90fad4..901c5759 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -157,10 +157,14 @@ namespace { bind_scope_t bound_scope(session_scope, *post); value_t result(expr.calc(bound_scope)); - if (! result.is_amount()) - throw_(parse_error, _("Postings may only specify simple amounts")); + if (result.is_long()) { + amount = result.to_amount(); + } else { + if (! result.is_amount()) + throw_(parse_error, _("Postings may only specify simple amounts")); - amount = result.as_amount(); + amount = result.as_amount(); + } DEBUG("textual.parse", "The posting amount is " << amount); } } |