aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-12-15 16:05:37 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-12-15 16:05:37 -0800
commit5b24aac2660c27d27c9f3192821cd063fd07f9c0 (patch)
treeff5e7d4b94c6c02d0c719eb317c73617a7f1b791 /reader.cpp
parent5cf59de6763a0000fdc87f0101ca78bd137dffcc (diff)
Initial work on backtrace support with new parser
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp19
1 files changed, 8 insertions, 11 deletions
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;
}