From c51704a2a10b25abf17e68ee498fbd30e8204fd0 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 20 Feb 2006 00:04:21 +0000 Subject: (parse): Do not balance automated entries: they are now balanced as part of the entry they match. (parse): Report the remainder of failed balances using `entry_balance'. This can give a much better idea of what went wrong, especially when values are being calculated. --- textual.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/textual.cc b/textual.cc index f3b0f9f6..5e397031 100644 --- a/textual.cc +++ b/textual.cc @@ -675,17 +675,12 @@ unsigned int textual_parser_t::parse(std::istream& in, auto_entry_t * ae = new auto_entry_t(skip_ws(line + 1)); if (parse_transactions(in, account_stack.front(), *ae, "automated")) { - if (ae->finalize()) { - journal->auto_entries.push_back(ae); - ae->src_idx = src_idx; - ae->beg_pos = beg_pos; - ae->beg_line = beg_line; - ae->end_pos = in.tellg(); - ae->end_line = linenum; - } else { - throw parse_error(path, linenum, - "Automated entry failed to balance"); - } + journal->auto_entries.push_back(ae); + ae->src_idx = src_idx; + ae->beg_pos = beg_pos; + ae->beg_line = beg_line; + ae->end_pos = in.tellg(); + ae->end_line = linenum; } break; } @@ -778,7 +773,12 @@ unsigned int textual_parser_t::parse(std::istream& in, } else { print_entry(std::cerr, *entry); delete entry; - throw parse_error(path, first_line, "Entry above does not balance"); + + std::string msgbuf; + std::ostringstream msg(msgbuf); + msg << "Entry above does not balance; remainder is: " + << entry_balance; + throw parse_error(path, first_line, msg.str()); } } else { throw parse_error(path, first_line, "Failed to parse entry"); -- cgit v1.2.3