diff options
author | John Wiegley <johnw@newartisans.com> | 2008-09-15 02:36:50 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-09-15 02:36:50 -0400 |
commit | 50ee03e3f0a44197722e6c3e85d1f60c48403576 (patch) | |
tree | 17e0c914e8493cb8028b5d02b64cf6f6f2b83b5e /src/parser.cc | |
parent | b73c31c7259ee12bf746f477c9c9919fe72d5394 (diff) | |
download | fork-ledger-50ee03e3f0a44197722e6c3e85d1f60c48403576.tar.gz fork-ledger-50ee03e3f0a44197722e6c3e85d1f60c48403576.tar.bz2 fork-ledger-50ee03e3f0a44197722e6c3e85d1f60c48403576.zip |
Fixed the way that nested caught exceptions are rethrown, and how value
expressions are displayed when errors are found in them.
Diffstat (limited to 'src/parser.cc')
-rw-r--r-- | src/parser.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/parser.cc b/src/parser.cc index eabcb845..0ee66bba 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -385,7 +385,8 @@ expr_t::parser_t::parse_value_expr(std::istream& in, } expr_t::ptr_op_t -expr_t::parser_t::parse(std::istream& in, const flags_t flags) +expr_t::parser_t::parse(std::istream& in, const flags_t flags, + const string * original_string) { try { ptr_op_t top_node = parse_value_expr(in, flags); @@ -399,11 +400,13 @@ expr_t::parser_t::parse(std::istream& in, const flags_t flags) return top_node; } catch (const std::exception& err) { - add_error_context("While parsing value expression:\n"); -#if 0 - add_error_context(line_context(str, in.tellg() - 1)); -#endif - throw err; + add_error_context("While parsing value expression:"); + if (original_string) { + istream_pos_type pos = in.tellg(); + pos -= 1; + add_error_context(line_context(*original_string, pos)); + } + throw; } } |