mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-23 00:26:23 +08:00
Remove usage of PCRE2_SUBSTITUTE_LITERAL
We don't need this flag and this ties us to a newer version of PCRE2 than we would like. Fixes #9061.
This commit is contained in:
parent
cbd0ec568c
commit
a9964cd6d0
@ -6817,12 +6817,6 @@ static void test_re_substitute() {
|
|||||||
do_test(res && *res == L"AA123qqqZZ AA123qqqZZ");
|
do_test(res && *res == L"AA123qqqZZ AA123qqqZZ");
|
||||||
do_test(repl_count == 2);
|
do_test(repl_count == 2);
|
||||||
|
|
||||||
sflags.literal = true;
|
|
||||||
res = re->substitute(subj, repl, sflags, 0, nullptr, &repl_count);
|
|
||||||
do_test(res && *res == L"AA$1qqqZZ AA$1qqqZZ");
|
|
||||||
do_test(repl_count == 2);
|
|
||||||
|
|
||||||
sflags.literal = false;
|
|
||||||
sflags.extended = true;
|
sflags.extended = true;
|
||||||
res = re->substitute(subj, L"\\x21", sflags, 0, nullptr, &repl_count); // \x21 = !
|
res = re->substitute(subj, L"\\x21", sflags, 0, nullptr, &repl_count); // \x21 = !
|
||||||
do_test(res && *res == L"AA!ZZ AA!ZZ");
|
do_test(res && *res == L"AA!ZZ AA!ZZ");
|
||||||
|
@ -237,7 +237,6 @@ maybe_t<wcstring> regex_t::substitute(const wcstring &subject, const wcstring &r
|
|||||||
uint32_t options = PCRE2_SUBSTITUTE_UNSET_EMPTY // don't error on unmatched
|
uint32_t options = PCRE2_SUBSTITUTE_UNSET_EMPTY // don't error on unmatched
|
||||||
| PCRE2_SUBSTITUTE_OVERFLOW_LENGTH // return required length on overflow
|
| PCRE2_SUBSTITUTE_OVERFLOW_LENGTH // return required length on overflow
|
||||||
| (flags.global ? PCRE2_SUBSTITUTE_GLOBAL : 0) // replace multiple
|
| (flags.global ? PCRE2_SUBSTITUTE_GLOBAL : 0) // replace multiple
|
||||||
| (flags.literal ? PCRE2_SUBSTITUTE_LITERAL : 0) // respect $1, etc.
|
|
||||||
| (flags.extended ? PCRE2_SUBSTITUTE_EXTENDED : 0) // backslash escapes
|
| (flags.extended ? PCRE2_SUBSTITUTE_EXTENDED : 0) // backslash escapes
|
||||||
;
|
;
|
||||||
size_t bufflen = stack_bufflen;
|
size_t bufflen = stack_bufflen;
|
||||||
|
1
src/re.h
1
src/re.h
@ -32,7 +32,6 @@ struct flags_t {
|
|||||||
/// Flags for substituting a regex.
|
/// Flags for substituting a regex.
|
||||||
struct sub_flags_t {
|
struct sub_flags_t {
|
||||||
bool global{}; // perform multiple substitutions?
|
bool global{}; // perform multiple substitutions?
|
||||||
bool literal{}; // $1 is literal, not a capture reference
|
|
||||||
bool extended{}; // apply PCRE2 extended backslash escapes?
|
bool extended{}; // apply PCRE2 extended backslash escapes?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user