summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-03-03 16:28:20 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-03-03 16:28:20 -0400
commitc305db937c761e75adbc0cd33bc56a8593ab0caf (patch)
treeaefa9c4034f16de02c6bf43b2f2d298b0ea17560
parente2c30cf6e4e8c0d38f129e3e209954bf1bfbe602 (diff)
downloadfork-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.cc10
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);
}
}