From c305db937c761e75adbc0cd33bc56a8593ab0caf Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 3 Mar 2009 16:28:20 -0400 Subject: If a posting has an integer amount, convert it --- src/textual.cc | 10 +++++++--- 1 file 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); } } -- cgit v1.2.3