mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-16 23:42:45 +08:00
Rename EXEC_ERR_MSG to INVALID_PIPELINE_CMD_ERR_MSG
This error message was used for more than exec. No functional change here.
This commit is contained in:
parent
bb055c7c81
commit
247d4b2c8f
|
@ -1076,7 +1076,7 @@ struct populator_t {
|
|||
const auto &tok = peek_token(1);
|
||||
if (tok.keyword == parse_keyword_t::kw_and || tok.keyword == parse_keyword_t::kw_or) {
|
||||
const wchar_t *cmdname = (tok.keyword == parse_keyword_t::kw_and ? L"and" : L"or");
|
||||
parse_error(tok, parse_error_andor_in_pipeline, EXEC_ERR_MSG, cmdname);
|
||||
parse_error(tok, parse_error_andor_in_pipeline, INVALID_PIPELINE_CMD_ERR_MSG, cmdname);
|
||||
}
|
||||
node.accept(*this);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring
|
|||
if (skip_caret && this->text.empty()) return L"";
|
||||
break;
|
||||
case parse_error_andor_in_pipeline:
|
||||
append_format(result, EXEC_ERR_MSG,
|
||||
append_format(result, INVALID_PIPELINE_CMD_ERR_MSG,
|
||||
src.substr(this->source_start, this->source_length).c_str());
|
||||
return result;
|
||||
case parse_error_bare_variable_assignment: {
|
||||
|
|
|
@ -70,7 +70,7 @@ using parsed_source_ref_t = std::shared_ptr<const parsed_source_t>;
|
|||
parsed_source_ref_t parse_source(wcstring &&src, parse_tree_flags_t flags,
|
||||
parse_error_list_t *errors);
|
||||
|
||||
/// Error message for improper use of the exec builtin.
|
||||
#define EXEC_ERR_MSG _(L"The '%ls' command can not be used in a pipeline")
|
||||
/// Error message when a command may not be in a pipeline.
|
||||
#define INVALID_PIPELINE_CMD_ERR_MSG _(L"The '%ls' command can not be used in a pipeline")
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1108,7 +1108,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src,
|
|||
// Check that we don't try to pipe through exec.
|
||||
bool is_in_pipeline = (pipe_pos != pipeline_position_t::none);
|
||||
if (is_in_pipeline && decoration == statement_decoration_t::exec) {
|
||||
errored = append_syntax_error(parse_errors, source_start, EXEC_ERR_MSG, L"exec");
|
||||
errored =
|
||||
append_syntax_error(parse_errors, source_start, INVALID_PIPELINE_CMD_ERR_MSG, L"exec");
|
||||
}
|
||||
|
||||
// This is a somewhat stale check that 'and' and 'or' are not in pipelines, except at the
|
||||
|
@ -1119,8 +1120,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src,
|
|||
// commands.
|
||||
const wcstring &command = dst.command.source(buff_src, storage);
|
||||
if (command == L"and" || command == L"or") {
|
||||
errored =
|
||||
append_syntax_error(parse_errors, source_start, EXEC_ERR_MSG, command.c_str());
|
||||
errored = append_syntax_error(parse_errors, source_start, INVALID_PIPELINE_CMD_ERR_MSG,
|
||||
command.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1148,8 +1149,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src,
|
|||
|
||||
// Check that pipes are sound.
|
||||
if (!errored && parser_is_pipe_forbidden(command) && is_in_pipeline) {
|
||||
errored =
|
||||
append_syntax_error(parse_errors, source_start, EXEC_ERR_MSG, command.c_str());
|
||||
errored = append_syntax_error(parse_errors, source_start, INVALID_PIPELINE_CMD_ERR_MSG,
|
||||
command.c_str());
|
||||
}
|
||||
|
||||
// Check that we don't break or continue from outside a loop.
|
||||
|
|
Loading…
Reference in New Issue
Block a user