diff options
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/textual.cc b/src/textual.cc index ccd87ca0..4549581b 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1671,25 +1671,27 @@ post_t * instance_t::parse_post(char * line, break; } - amount_t tot = amt - diff; - DEBUG("post.assign", "line " << context.linenum << ": " << "diff = " << diff); DEBUG("textual.parse", "line " << context.linenum << ": " << "POST assign: diff = " << diff); - if (! diff.is_zero()) { - if (! post->amount.is_null()) { - diff -= post->amount; - if (! no_assertions && ! diff.is_zero()) - throw_(parse_error, - _f("Balance assertion off by %1% (expected to see %2%)") - % diff % tot); - } else { + if (post->amount.is_null()) { + // balance assignment + if (! diff.is_zero()) { post->amount = diff; DEBUG("textual.parse", "line " << context.linenum << ": " << "Overwrite null posting"); } + } else { + // balance assertion + diff -= post->amount; + if (! no_assertions && ! diff.is_zero()) { + amount_t tot = amt - diff; + throw_(parse_error, + _f("Balance assertion off by %1% (expected to see %2%)") + % diff % tot); + } } if (stream.eof()) |