From 5b24aac2660c27d27c9f3192821cd063fd07f9c0 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 15 Dec 2013 16:05:37 -0800 Subject: Initial work on backtrace support with new parser --- reader.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'reader.cpp') diff --git a/reader.cpp b/reader.cpp index 3eeae627..87c01464 100644 --- a/reader.cpp +++ b/reader.cpp @@ -2473,7 +2473,8 @@ void reader_run_command(parser_t &parser, const wcstring &cmd) int reader_shell_test(const wchar_t *b) { wcstring bstr = b; - int res = parser_t::principal_parser().detect_errors(bstr); + parse_error_list_t errors; + int res = parse_util_detect_errors(bstr, &errors); if (res & PARSER_TEST_ERROR) { @@ -2490,14 +2491,9 @@ int reader_shell_test(const wchar_t *b) tmp2, 0); - parse_error_list_t errors; - parser_t::principal_parser().detect_errors(bstr, &errors, L"fish"); - - if (! errors.empty()) - { - const wcstring sb = parse_errors_description(errors, b, L"fish"); - fwprintf(stderr, L"%ls", sb.c_str()); - } + wcstring sb; + parser_t::principal_parser().get_backtrace(bstr, errors, &sb); + fwprintf(stderr, L"%ls", sb.c_str()); } return res; } @@ -3908,13 +3904,14 @@ static int read_ni(int fd, const io_chain_t &io) } parse_error_list_t errors; - if (! parser.detect_errors(str, &errors, L"fish")) + if (! parse_util_detect_errors(str, &errors)) { parser.eval(str, io, TOP); } else { - const wcstring sb = parse_errors_description(errors, str); + wcstring sb; + parser.get_backtrace(str, errors, &sb); fwprintf(stderr, L"%ls", sb.c_str()); res = 1; } -- cgit v1.2.3