mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
parse_util: Remove locate_cmdsubst
We have *3* functions to find command substitutions, this is the most awkward.
This commit is contained in:
parent
58177ba091
commit
c1fe5be0ce
2 changed files with 1 additions and 16 deletions
|
@ -177,11 +177,6 @@ static int parse_util_locate_brackets_of_type(const wchar_t *in, wchar_t **begin
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_util_locate_cmdsubst(const wchar_t *in, wchar_t **begin, wchar_t **end,
|
|
||||||
bool accept_incomplete) {
|
|
||||||
return parse_util_locate_brackets_of_type(in, begin, end, accept_incomplete, L'(', L')');
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_util_locate_slice(const wchar_t *in, wchar_t **begin, wchar_t **end,
|
int parse_util_locate_slice(const wchar_t *in, wchar_t **begin, wchar_t **end,
|
||||||
bool accept_incomplete) {
|
bool accept_incomplete) {
|
||||||
return parse_util_locate_brackets_of_type(in, begin, end, accept_incomplete, L'[', L']');
|
return parse_util_locate_brackets_of_type(in, begin, end, accept_incomplete, L'[', L']');
|
||||||
|
@ -254,7 +249,7 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
|
||||||
const wchar_t *pos = buff;
|
const wchar_t *pos = buff;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
wchar_t *begin = nullptr, *end = nullptr;
|
wchar_t *begin = nullptr, *end = nullptr;
|
||||||
if (parse_util_locate_cmdsubst(pos, &begin, &end, true) <= 0) {
|
if (parse_util_locate_brackets_of_type(pos, &begin, &end, true, L'(', L')') <= 0) {
|
||||||
// No subshell found, all done.
|
// No subshell found, all done.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,6 @@ namespace ast {
|
||||||
struct argument_t;
|
struct argument_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the beginning and end of the first subshell in the specified string.
|
|
||||||
///
|
|
||||||
/// \param in the string to search for subshells
|
|
||||||
/// \param begin the starting parenthesis of the subshell
|
|
||||||
/// \param end the ending parenthesis of the subshell
|
|
||||||
/// \param accept_incomplete whether to permit missing closing parenthesis
|
|
||||||
/// \return -1 on syntax error, 0 if no subshells exist and 1 on success
|
|
||||||
int parse_util_locate_cmdsubst(const wchar_t *in, wchar_t **begin, wchar_t **end,
|
|
||||||
bool accept_incomplete);
|
|
||||||
|
|
||||||
/// Same as parse_util_locate_cmdsubst, but handles square brackets [ ].
|
/// Same as parse_util_locate_cmdsubst, but handles square brackets [ ].
|
||||||
int parse_util_locate_slice(const wchar_t *in, wchar_t **begin, wchar_t **end,
|
int parse_util_locate_slice(const wchar_t *in, wchar_t **begin, wchar_t **end,
|
||||||
bool accept_incomplete);
|
bool accept_incomplete);
|
||||||
|
|
Loading…
Reference in a new issue