Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
/* Regular expression tests.
|
2020-01-01 08:14:33 +08:00
|
|
|
Copyright (C) 2003-2020 Free Software Foundation, Inc.
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-10 07:18:22 +08:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 13:40:42 +08:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <mcheck.h>
|
|
|
|
#include <regex.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <locale.h>
|
|
|
|
|
2003-11-21 17:20:45 +08:00
|
|
|
#define BRE RE_SYNTAX_POSIX_BASIC
|
|
|
|
#define ERE RE_SYNTAX_POSIX_EXTENDED
|
|
|
|
|
|
|
|
static struct test_s
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
{
|
|
|
|
int syntax;
|
|
|
|
const char *pattern;
|
|
|
|
const char *string;
|
|
|
|
int start, res;
|
|
|
|
} tests[] = {
|
2003-11-21 17:20:45 +08:00
|
|
|
{BRE, "\\<A", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\<A", "CBAA", 2, -1},
|
|
|
|
{BRE, "A\\>", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\bA", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\bA", "CBAA", 2, -1},
|
|
|
|
{BRE, "A\\b", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\<A", "AA", 0, 0},
|
|
|
|
{BRE, "\\<A", "C-AA", 2, 2},
|
|
|
|
{BRE, "A\\>", "CAA-", 1, 2},
|
|
|
|
{BRE, "A\\>", "CAA", 1, 2},
|
|
|
|
{BRE, "\\bA", "AA", 0, 0},
|
|
|
|
{BRE, "\\bA", "C-AA", 2, 2},
|
|
|
|
{BRE, "A\\b", "CAA-", 1, 2},
|
|
|
|
{BRE, "A\\b", "CAA", 1, 2},
|
2003-11-22 06:43:47 +08:00
|
|
|
{BRE, "\\<[A]", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\<[A]", "CBAA", 2, -1},
|
|
|
|
{BRE, "[A]\\>", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\b[A]", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\b[A]", "CBAA", 2, -1},
|
|
|
|
{BRE, "[A]\\b", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\<[A]", "AA", 0, 0},
|
|
|
|
{BRE, "\\<[A]", "C-AA", 2, 2},
|
|
|
|
{BRE, "[A]\\>", "CAA-", 1, 2},
|
|
|
|
{BRE, "[A]\\>", "CAA", 1, 2},
|
|
|
|
{BRE, "\\b[A]", "AA", 0, 0},
|
|
|
|
{BRE, "\\b[A]", "C-AA", 2, 2},
|
|
|
|
{BRE, "[A]\\b", "CAA-", 1, 2},
|
|
|
|
{BRE, "[A]\\b", "CAA", 1, 2},
|
2003-11-21 17:20:45 +08:00
|
|
|
{ERE, "\\b(A|!|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\b(A|!|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "DA!C", 0, 2},
|
|
|
|
{ERE, "\\b(A|!|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "D,B", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DAAD", 0, 1},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DABD", 0, 1},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "AD", 0, 0},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "C!", 0, 0},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "D,B", 0, 2},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DA?A", 0, 3},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "BBC", 0, 0},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DA", 0, -1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "A!=\\", 0, 1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "/!=A", 0, 1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "A=A", 0, 1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "==!=", 0, 2},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "==C~", 0, 3},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "=~=", 0, -1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "~!", 0, -1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "~=~", 0, -1},
|
|
|
|
{ERE, "(\\b|A.)[ABC]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\b|A.)[ABC]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[ABC]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "B!A=", 0, 2},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "B~C", 0, 1},
|
|
|
|
{ERE, ".\\b.", "AA~", 0, 1},
|
|
|
|
{ERE, ".\\b.", "=A=", 0, 0},
|
|
|
|
{ERE, ".\\b.", "==", 0, -1},
|
|
|
|
{ERE, ".\\b.", "ABA", 0, -1},
|
2003-11-25 03:30:51 +08:00
|
|
|
{ERE, "[^k]\\b[^k]", "AA~", 0, 1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "=A=", 0, 0},
|
|
|
|
{ERE, "[^k]\\b[^k]", "Ak~kA~", 0, 4},
|
|
|
|
{ERE, "[^k]\\b[^k]", "==", 0, -1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "Ak~", 0, -1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "k=k", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "AA~", 0, 1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "=A=", 0, 0},
|
|
|
|
{ERE, "[^C]\\b[^C]", "AC~CA~", 0, 4},
|
|
|
|
{ERE, "[^C]\\b[^C]", "==", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "AC~", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "C=C", 0, -1},
|
2003-11-21 17:20:45 +08:00
|
|
|
{ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\<(A|!|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "DA!C", 0, -1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "D,B", 0, -1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DAAD", 0, 1},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DABD", 0, 1},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "AD", 0, 0},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "C!", 0, 0},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "D,B", 0, 2},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DA?A", 0, 3},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "BBC", 0, 0},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DA", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "A!=\\", 0, 1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "/!=A", 0, 1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "==!=", 0, 2},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "==C~", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "A=A", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "=~=", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "~!", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "~=~", 0, -1},
|
|
|
|
{ERE, "(\\<|A.)[ABC]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|A.)[ABC]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[ABC]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "B!A=", 0, 2},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "B~C", 0, 2},
|
|
|
|
{ERE, ".\\<.", "=A=", 0, 0},
|
|
|
|
{ERE, ".\\<.", "AA~", 0, -1},
|
|
|
|
{ERE, ".\\<.", "==", 0, -1},
|
|
|
|
{ERE, ".\\<.", "ABA", 0, -1},
|
2003-11-25 03:30:51 +08:00
|
|
|
{ERE, "[^k]\\<[^k]", "=k=A=", 0, 2},
|
|
|
|
{ERE, "[^k]\\<[^k]", "kk~", 0, -1},
|
|
|
|
{ERE, "[^k]\\<[^k]", "==", 0, -1},
|
|
|
|
{ERE, "[^k]\\<[^k]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^k]\\<[^k]", "=k=", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "=C=A=", 0, 2},
|
|
|
|
{ERE, "[^C]\\<[^C]", "CC~", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "==", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "=C=", 0, -1},
|
2003-11-21 17:20:45 +08:00
|
|
|
{ERE, ".\\B.", "ABA", 0, 0},
|
|
|
|
{ERE, ".\\B.", "=BDC", 0, 1},
|
2003-11-25 03:30:51 +08:00
|
|
|
{ERE, "[^k]\\B[^k]", "kkkABA", 0, 3},
|
|
|
|
{ERE, "[^k]\\B[^k]", "kBk", 0, -1},
|
|
|
|
{ERE, "[^C]\\B[^C]", "CCCABA", 0, 3},
|
|
|
|
{ERE, "[^C]\\B[^C]", "CBC", 0, -1},
|
2005-01-27 03:56:03 +08:00
|
|
|
{ERE, ".(\\b|\\B).", "=~AB", 0, 0},
|
2003-11-21 17:20:45 +08:00
|
|
|
{ERE, ".(\\b|\\B).", "A=C", 0, 0},
|
|
|
|
{ERE, ".(\\b|\\B).", "ABC", 0, 0},
|
2005-01-27 03:56:03 +08:00
|
|
|
{ERE, ".(\\b|\\B).", "=~\\!", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 0},
|
2003-11-25 03:30:51 +08:00
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
|
2005-01-27 03:56:03 +08:00
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 0},
|
2003-11-25 03:30:51 +08:00
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
|
2005-01-27 03:56:03 +08:00
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, 0},
|
2003-11-22 06:43:47 +08:00
|
|
|
{ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "DA!C", 0, 2},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "D,B", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DAAD", 0, 1},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DABD", 0, 1},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "AD", 0, 0},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "C!", 0, 0},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "D,B", 0, 2},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DA?A", 0, 3},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "BBC", 0, 0},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DA", 0, -1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "A!=\\", 0, 1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "/!=A", 0, 1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "A=A", 0, 1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "==!=", 0, 2},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "==C~", 0, 3},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "=~=", 0, -1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "~!", 0, -1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "~=~", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "DA!C", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "D,B", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DAAD", 0, 1},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DABD", 0, 1},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "AD", 0, 0},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "C!", 0, 0},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "D,B", 0, 2},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DA?A", 0, 3},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "BBC", 0, 0},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DA", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "A!=\\", 0, 1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "/!=A", 0, 1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "==!=", 0, 2},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "==C~", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "A=A", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "=~=", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "~!", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "~=~", 0, -1},
|
|
|
|
{ERE, "(\\<|[A].)[ABC]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|[A].)[ABC]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[ABC]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "B!A=", 0, 2},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "B~C", 0, 2},
|
2003-12-22 14:52:35 +08:00
|
|
|
{ERE, "^[^A]*\\bB", "==B", 0, 0},
|
|
|
|
{ERE, "^[^A]*\\bB", "CBD!=B", 0, 0},
|
|
|
|
{ERE, "[^A]*\\bB", "==B", 2, 2}
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2003-11-21 17:20:45 +08:00
|
|
|
do_one_test (const struct test_s *test, const char *fail)
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
{
|
2003-11-21 17:20:45 +08:00
|
|
|
int res;
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
const char *err;
|
2003-11-21 17:20:45 +08:00
|
|
|
struct re_pattern_buffer regbuf;
|
|
|
|
|
|
|
|
re_set_syntax (test->syntax);
|
|
|
|
memset (®buf, '\0', sizeof (regbuf));
|
|
|
|
err = re_compile_pattern (test->pattern, strlen (test->pattern),
|
|
|
|
®buf);
|
|
|
|
if (err != NULL)
|
|
|
|
{
|
|
|
|
printf ("%sre_compile_pattern \"%s\" failed: %s\n", fail, test->pattern,
|
|
|
|
err);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = re_search (®buf, test->string, strlen (test->string),
|
|
|
|
test->start, strlen (test->string) - test->start, NULL);
|
|
|
|
if (res != test->res)
|
|
|
|
{
|
|
|
|
printf ("%sre_search \"%s\" \"%s\" failed: %d (expected %d)\n",
|
|
|
|
fail, test->pattern, test->string, res, test->res);
|
|
|
|
regfree (®buf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test->res > 0 && test->start == 0)
|
|
|
|
{
|
|
|
|
res = re_search (®buf, test->string, strlen (test->string),
|
|
|
|
test->res, strlen (test->string) - test->res, NULL);
|
|
|
|
if (res != test->res)
|
|
|
|
{
|
|
|
|
printf ("%sre_search from expected \"%s\" \"%s\" failed: %d (expected %d)\n",
|
|
|
|
fail, test->pattern, test->string, res, test->res);
|
|
|
|
regfree (®buf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
regfree (®buf);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
replace (char *p, char c)
|
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
/* A -> A" */
|
|
|
|
case 'A': *p++ = '\xc3'; *p++ = '\x84'; break;
|
|
|
|
/* B -> O" */
|
|
|
|
case 'B': *p++ = '\xc3'; *p++ = '\x96'; break;
|
|
|
|
/* C -> U" */
|
|
|
|
case 'C': *p++ = '\xc3'; *p++ = '\x9c'; break;
|
|
|
|
/* D -> a" */
|
|
|
|
case 'D': *p++ = '\xc3'; *p++ = '\xa4'; break;
|
|
|
|
/* ! -> MULTIPLICATION SIGN */
|
|
|
|
case '!': *p++ = '\xc3'; *p++ = '\x97'; break;
|
|
|
|
/* = -> EM DASH */
|
|
|
|
case '=': *p++ = '\xe2'; *p++ = '\x80'; *p++ = '\x94'; break;
|
|
|
|
/* ~ -> MUSICAL SYMBOL HALF NOTE */
|
|
|
|
case '~': *p++ = '\xf0'; *p++ = '\x9d'; *p++ = '\x85'; *p++ = '\x9e';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
do_mb_tests (const struct test_s *test)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
struct test_s t;
|
|
|
|
const char *const chars = "ABCD!=~";
|
|
|
|
char repl[8], *p;
|
|
|
|
char pattern[strlen (test->pattern) * 4 + 1];
|
|
|
|
char string[strlen (test->string) * 4 + 1];
|
|
|
|
char fail[8 + sizeof ("UTF-8 ")];
|
|
|
|
|
2003-11-25 03:30:51 +08:00
|
|
|
t = *test;
|
2003-11-21 17:20:45 +08:00
|
|
|
t.pattern = pattern;
|
|
|
|
t.string = string;
|
|
|
|
strcpy (fail, "UTF-8 ");
|
|
|
|
for (i = 1; i < 128; ++i)
|
|
|
|
{
|
|
|
|
p = repl;
|
|
|
|
for (j = 0; j < 7; ++j)
|
|
|
|
if (i & (1 << j))
|
|
|
|
{
|
|
|
|
if (!strchr (test->pattern, chars[j])
|
|
|
|
&& !strchr (test->string, chars[j]))
|
|
|
|
break;
|
|
|
|
*p++ = chars[j];
|
|
|
|
}
|
|
|
|
if (j < 7)
|
|
|
|
continue;
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
for (j = 0, p = pattern; test->pattern[j]; ++j)
|
|
|
|
if (strchr (repl, test->pattern[j]))
|
|
|
|
p = replace (p, test->pattern[j]);
|
|
|
|
else if (test->pattern[j] == '\\' && test->pattern[j + 1])
|
|
|
|
{
|
|
|
|
*p++ = test->pattern[j++];
|
|
|
|
*p++ = test->pattern[j];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*p++ = test->pattern[j];
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
t.start = test->start;
|
|
|
|
t.res = test->res;
|
|
|
|
|
|
|
|
for (j = 0, p = string; test->string[j]; ++j)
|
|
|
|
if (strchr (repl, test->string[j]))
|
|
|
|
{
|
|
|
|
char *d = replace (p, test->string[j]);
|
|
|
|
if (test->start > j)
|
|
|
|
t.start += d - p - 1;
|
|
|
|
if (test->res > j)
|
|
|
|
t.res += d - p - 1;
|
|
|
|
p = d;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*p++ = test->string[j];
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
p = stpcpy (fail + strlen ("UTF-8 "), repl);
|
|
|
|
*p++ = ' ';
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
if (do_one_test (&t, fail))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
size_t i;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
mtrace ();
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
|
|
|
|
{
|
2003-11-21 17:20:45 +08:00
|
|
|
if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
{
|
2003-11-21 17:20:45 +08:00
|
|
|
puts ("setlocale de_DE.ISO-8859-1 failed");
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
ret = 1;
|
|
|
|
}
|
2003-11-21 17:20:45 +08:00
|
|
|
ret |= do_one_test (&tests[i], "");
|
|
|
|
if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
{
|
2003-11-21 17:20:45 +08:00
|
|
|
puts ("setlocale de_DE.UTF-8 failed");
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
ret = 1;
|
|
|
|
}
|
2003-11-21 17:20:45 +08:00
|
|
|
ret |= do_one_test (&tests[i], "UTF-8 ");
|
2003-11-25 03:30:51 +08:00
|
|
|
ret |= do_mb_tests (&tests[i]);
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
2003-11-13 01:47:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|