summaryrefslogtreecommitdiff
path: root/posix/bug-regex19.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-24 19:30:51 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-24 19:30:51 +0000
commit65e6becf5b1b9ca1e911986d030b8b31b5dd4cfa (patch)
tree119234eb952b9bd87c68ceb03f68826d4bbad4de /posix/bug-regex19.c
parent951d64082330765a22da6beac6e067ec054605e7 (diff)
Update.
2003-11-24 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_token_t): Add word_char bit. Add comment. (re_dfa_t): Add sb_char field. (bitset_mask): New function. * posix/regcomp.c (free_dfa_content): Free sb_char. (init_dfa): Don't initialize word_char unnecessarily. Initialize sb_char. (duplicate_node): Don't duplicate !word_char CHARACTERs with NEXT_WORD_CONSTRAINT constraint or word_char CHARACTERs with NEXT_NOTWORD_CONSTRAINT. Return -1 in *new_idx instead. (duplicate_node_closure): Handle clone_dest == -1 from duplicate_node. (peek_token): Initialize word_char bit. (parse_expression, parse_dup_op): Add comments. (parse_bracket_exp): Don't set bitmask bits for multi-byte char starting bytes here at the beginning. Mask off the bits right before creating SIMPLE_BRACKET. (build_charclass_op): Likewise. * posix/regexec.c (group_nodes_into_DFAstates) <case OP_PERIOD>: Only set accept bits for single-byte characters. (group_nodes_into_DFAstates): Don't rely on characters 0 .. 127 being single byte encoded and the rest multi-byte. * posix/bug-regex19.c (tests): Add new tests. (do_mb_tests): Initialize t to *test. (main): Fail even on do_mb_tests errors.
Diffstat (limited to 'posix/bug-regex19.c')
-rw-r--r--posix/bug-regex19.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/posix/bug-regex19.c b/posix/bug-regex19.c
index 01093e60ac..f24e0aa730 100644
--- a/posix/bug-regex19.c
+++ b/posix/bug-regex19.c
@@ -102,6 +102,20 @@ static struct test_s
{ERE, ".\\b.", "=A=", 0, 0},
{ERE, ".\\b.", "==", 0, -1},
{ERE, ".\\b.", "ABA", 0, -1},
+ {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},
{ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
{ERE, "\\<(A|!|.B)", "=AC", 0, 1},
{ERE, "\\<(A|!|.B)", "!AC", 0, 1},
@@ -140,12 +154,38 @@ static struct test_s
{ERE, ".\\<.", "AA~", 0, -1},
{ERE, ".\\<.", "==", 0, -1},
{ERE, ".\\<.", "ABA", 0, -1},
+ {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},
{ERE, ".\\B.", "ABA", 0, 0},
{ERE, ".\\B.", "=BDC", 0, 1},
+ {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},
{ERE, ".(\\b|\\B).", "=~AB", 0, 1},
{ERE, ".(\\b|\\B).", "A=C", 0, 0},
{ERE, ".(\\b|\\B).", "ABC", 0, 0},
{ERE, ".(\\b|\\B).", "=~\\!", 0, -1},
+ {ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 1},
+ {ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
+ {ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
+ {ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 3},
+ {ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, -1},
+ {ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, -1},
+ {ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 1},
+ {ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
+ {ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
+ {ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 3},
+ {ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, -1},
+ {ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, -1},
{ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
{ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
{ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},
@@ -288,6 +328,7 @@ do_mb_tests (const struct test_s *test)
char string[strlen (test->string) * 4 + 1];
char fail[8 + sizeof ("UTF-8 ")];
+ t = *test;
t.pattern = pattern;
t.string = string;
strcpy (fail, "UTF-8 ");
@@ -367,9 +408,7 @@ main (void)
ret = 1;
}
ret |= do_one_test (&tests[i], "UTF-8 ");
- // Until the implementation is fixed, ignore the results of the
- // MB tests.
- /* ret |= */do_mb_tests (&tests[i]);
+ ret |= do_mb_tests (&tests[i]);
}
return ret;