diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-03-21 17:13:33 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-03-21 17:13:33 -0700 |
commit | ad6367018b5d04bdba99f10ec3afcb3398fe880e (patch) | |
tree | fd54aaaf145a313bece854a321482323233b21fd /parse_util.cpp | |
parent | c71b1684020515f342f7dfd5e31324f84e2c6294 (diff) |
Excise use of parser_t's error() functionality. Thread a
parse_error_list_t through all of the expand functions, enabling them to
report errors more directly. Improve aspects of error reporting for
expansion failures.
Diffstat (limited to 'parse_util.cpp')
-rw-r--r-- | parse_util.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/parse_util.cpp b/parse_util.cpp index f1182ac2..d1f7a482 100644 --- a/parse_util.cpp +++ b/parse_util.cpp @@ -1152,10 +1152,7 @@ parser_test_error_bits_t parse_util_detect_errors_in_argument(const parse_node_t /* Our command substitution produced error offsets relative to its source. Tweak the offsets of the errors in the command substitution to account for both its offset within the string, and the offset of the node */ size_t error_offset = (paran_begin + 1 - arg_cpy) + node.source_start; - for (size_t i=0; i < subst_errors.size(); i++) - { - subst_errors.at(i).source_start += error_offset; - } + parse_error_offset_source_start(&subst_errors, error_offset); if (out_errors != NULL) { @@ -1301,8 +1298,9 @@ parser_test_error_bits_t parse_util_detect_errors(const wcstring &buff_src, pars if (node_tree.command_for_plain_statement(node, buff_src, &command)) { // Check that we can expand the command - if (! expand_one(command, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES | EXPAND_SKIP_JOBS)) + if (! expand_one(command, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES | EXPAND_SKIP_JOBS, NULL)) { + // TODO: leverage the resulting errors errored = append_syntax_error(&parse_errors, node, ILLEGAL_CMD_ERR_MSG, command.c_str()); } |