diff options
-rw-r--r-- | parse.c | 7 | ||||
-rwxr-xr-x | tests.sh | 12 | ||||
-rw-r--r-- | tests/test_regextype_ed.out | 1 | ||||
-rw-r--r-- | tests/test_regextype_sed.out | 1 |
4 files changed, 20 insertions, 1 deletions
@@ -2323,7 +2323,10 @@ static struct expr *parse_regextype(struct parser_state *state, int arg1, int ar goto list_types; } - if (strcmp(type, "posix-basic") == 0) { + // See https://www.gnu.org/software/gnulib/manual/html_node/Predefined-Syntaxes.html + if (strcmp(type, "posix-basic") == 0 + || strcmp(type, "ed") == 0 + || strcmp(type, "sed") == 0) { state->regex_flags = 0; } else if (strcmp(type, "posix-extended") == 0) { state->regex_flags = REG_EXTENDED; @@ -2342,6 +2345,8 @@ list_types: cfprintf(cfile, "Supported types are:\n\n"); cfprintf(cfile, " ${bld}posix-basic${rs}: POSIX basic regular expressions (BRE)\n"); cfprintf(cfile, " ${bld}posix-extended${rs}: POSIX extended regular expressions (ERE)\n"); + cfprintf(cfile, " ${bld}ed${rs}: Like ${grn}ed${rs} (same as ${bld}posix-basic${rs})\n"); + cfprintf(cfile, " ${bld}sed${rs}: Like ${grn}sed${rs} (same as ${bld}posix-basic${rs})\n"); return NULL; } @@ -625,6 +625,8 @@ gnu_tests=( test_regextype_posix_basic test_regextype_posix_extended + test_regextype_ed + test_regextype_sed test_samefile test_samefile_symlink @@ -2040,6 +2042,16 @@ function test_regextype_posix_extended() { bfs_diff -regextype posix-extended -regex '\./(\()' } +function test_regextype_ed() { + cd weirdnames + bfs_diff -regextype ed -regex '\./\((\)' +} + +function test_regextype_sed() { + cd weirdnames + bfs_diff -regextype sed -regex '\./\((\)' +} + function test_d_path() { bfs_diff -d basic } diff --git a/tests/test_regextype_ed.out b/tests/test_regextype_ed.out new file mode 100644 index 0000000..0f0971e --- /dev/null +++ b/tests/test_regextype_ed.out @@ -0,0 +1 @@ +./( diff --git a/tests/test_regextype_sed.out b/tests/test_regextype_sed.out new file mode 100644 index 0000000..0f0971e --- /dev/null +++ b/tests/test_regextype_sed.out @@ -0,0 +1 @@ +./( |