diff --git a/src/pcre2_printint.c b/src/pcre2_printint.c index 54dd32de7..02dcdf876 100644 --- a/src/pcre2_printint.c +++ b/src/pcre2_printint.c @@ -463,38 +463,35 @@ static void print_class(FILE *f, PCRE2_SPTR code, const uint8_t *char_lists_end, BOOL utf, const char *before, const char *after) { -BOOL printmap, invertmap; +BOOL printmap, negated; PCRE2_SPTR ccode; int i; -fprintf(f, "%s[", before); - -/* Negative XCLASS has an inverted map whereas the original opcodes have -already done the inversion. */ -invertmap = FALSE; +/* Negative XCLASS and NCLASS both have a bitmap indicating which characters +are accepted. For clarity we print this inverted and prefixed by "^". */ if (*code == OP_XCLASS) { ccode = code + LINK_SIZE + 1; printmap = (*ccode & XCL_MAP) != 0; - if ((*ccode & XCL_NOT) != 0) - { - invertmap = TRUE; - fprintf(f, "^"); - } + negated = (*ccode & XCL_NOT) != 0; ccode++; } else /* CLASS or NCLASS */ { printmap = TRUE; + negated = *code == OP_NCLASS; ccode = code + 1; } +fprintf(f, "%s[%s", before, negated? "^" : ""); + /* Print a bit map */ if (printmap) { + BOOL first = TRUE; uint8_t inverted_map[32]; const uint8_t *map = (const uint8_t *)ccode; - if (invertmap) + if (negated) { /* Using 255 ^ instead of ~ avoids clang sanitize warning. */ for (i = 0; i < 32; i++) inverted_map[i] = 255 ^ map[i]; @@ -507,13 +504,15 @@ if (printmap) int j; for (j = i+1; j < 256; j++) if ((map[j/8] & (1u << (j&7))) == 0) break; - if (i == '-' || i == ']') fprintf(f, "\\"); + if (i == '-' || i == '\\' || i == ']' || (first && i == '^')) + fprintf(f, "\\"); if (PRINTABLE(i)) fprintf(f, "%c", i); else fprintf(f, "\\x%02x", i); + first = FALSE; if (--j > i) { if (j != i + 1) fprintf(f, "-"); - if (j == '-' || j == ']') fprintf(f, "\\"); + if (j == '-' || j == '\\' || j == ']') fprintf(f, "\\"); if (PRINTABLE(j)) fprintf(f, "%c", j); else fprintf(f, "\\x%02x", j); } @@ -580,7 +579,7 @@ if (*code == OP_XCLASS) } /* Indicate a non-UTF class which was created by negation */ -fprintf(f, "]%s%s", (*code == OP_NCLASS)? " (neg)" : "", after); +fprintf(f, "]%s", after); } @@ -842,7 +841,7 @@ for(;;) case OP_NOT: fprintf(f, " %s [^", flag); extra = print_char(f, code + 1, utf); - fprintf(f, "]"); + fprintf(f, "] (not)"); break; case OP_NOTSTARI: @@ -868,7 +867,7 @@ for(;;) case OP_NOTPOSQUERY: fprintf(f, " %s [^", flag); extra = print_char(f, code + 1, utf); - fprintf(f, "]%s", OP_names[*code]); + fprintf(f, "]%s (not)", OP_names[*code]); break; case OP_NOTEXACTI: @@ -890,6 +889,7 @@ for(;;) if (*code == OP_NOTMINUPTO || *code == OP_NOTMINUPTOI) fprintf(f, "?"); else if (*code == OP_NOTPOSUPTO || *code == OP_NOTPOSUPTOI) fprintf(f, "+"); + fprintf(f, " (not)"); break; case OP_RECURSE: diff --git a/src/pcre2test.c b/src/pcre2test.c index 7f01cf928..cdae26f06 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -242,7 +242,7 @@ to hold them as 32-bit code units. */ enum { PR_OK, PR_SKIP, PR_ABEND }; /* The macro PRINTABLE determines whether to print an output character as-is or -as a hex value when showing compiled patterns. is We use it in cases when the +as a hex value when showing compiled patterns. We use it in cases when the locale has not been explicitly changed, so as to get consistent output from systems that differ in their output from isprint() even in the "C" locale. */ diff --git a/testdata/testinput2 b/testdata/testinput2 index d012aceb6..848e7e494 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -7228,4 +7228,18 @@ a)"xI /[\E/ +/[\^z]/B + +/[ \^]/B + +/[\\z]/B + +/[0-z]/B + +/[0\-z]/B + +/[]z]/B + +/[ \]]/B + # End of testinput2 diff --git a/testdata/testoutput10 b/testdata/testoutput10 index 6fc0a65e4..7706282fd 100644 --- a/testdata/testoutput10 +++ b/testdata/testoutput10 @@ -461,7 +461,7 @@ Subject length lower bound = 1 /[^ab\xC0-\xF0]/IB,utf ------------------------------------------------------------------ Bra - [\x00-`c-\xbf\xf1-\xff] (neg) + [^ab\xc0-\xf0] Ket End ------------------------------------------------------------------ @@ -604,7 +604,7 @@ Subject length lower bound = 3 /[^\x{c4}]/IB ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -648,7 +648,7 @@ Subject length lower bound = 1 /[^\xff]/IB,utf ------------------------------------------------------------------ Bra - [^\x{ff}] + [^\x{ff}] (not) Ket End ------------------------------------------------------------------ @@ -898,7 +898,7 @@ Subject length lower bound = 2 /[^\x{c4}]/IB,utf ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -1159,7 +1159,7 @@ Subject length lower bound = 17 /[^ⱥ]/Bi,utf ------------------------------------------------------------------ Bra - /i [^\x{2c65}] + /i [^\x{2c65}] (not) Ket End ------------------------------------------------------------------ @@ -1559,7 +1559,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-`c-\xff] (neg) + [^ab] Ket End ------------------------------------------------------------------ diff --git a/testdata/testoutput11-16 b/testdata/testoutput11-16 index 6cc49d33f..8b9cd014e 100644 --- a/testdata/testoutput11-16 +++ b/testdata/testoutput11-16 @@ -9,7 +9,7 @@ /[^\x{c4}]/IB ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -364,11 +364,11 @@ Subject length lower bound = 6 /[^\x{80}][^\x{ff}][^\x{100}][^\x{1000}][^\x{ffff}]/B ------------------------------------------------------------------ Bra - [^\x{80}] - [^\x{ff}] - [^\x{100}] - [^\x{1000}] - [^\x{ffff}] + [^\x{80}] (not) + [^\x{ff}] (not) + [^\x{100}] (not) + [^\x{1000}] (not) + [^\x{ffff}] (not) Ket End ------------------------------------------------------------------ @@ -376,11 +376,11 @@ Subject length lower bound = 6 /[^\x{80}][^\x{ff}][^\x{100}][^\x{1000}][^\x{ffff}]/Bi ------------------------------------------------------------------ Bra - /i [^\x{80}] - /i [^\x{ff}] - /i [^\x{100}] - /i [^\x{1000}] - /i [^\x{ffff}] + /i [^\x{80}] (not) + /i [^\x{ff}] (not) + /i [^\x{100}] (not) + /i [^\x{1000}] (not) + /i [^\x{ffff}] (not) Ket End ------------------------------------------------------------------ @@ -388,15 +388,15 @@ Subject length lower bound = 6 /[^\x{100}]*[^\x{1000}]+[^\x{ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{100}]{5,6}+/B ------------------------------------------------------------------ Bra - [^\x{100}]* - [^\x{1000}]+ - [^\x{ffff}]?? - [^\x{8000}]{4} - [^\x{8000}]* - [^\x{7fff}]{2} - [^\x{7fff}]{0,7}? - [^\x{100}]{5} - [^\x{100}]?+ + [^\x{100}]* (not) + [^\x{1000}]+ (not) + [^\x{ffff}]?? (not) + [^\x{8000}]{4} (not) + [^\x{8000}]* (not) + [^\x{7fff}]{2} (not) + [^\x{7fff}]{0,7}? (not) + [^\x{100}]{5} (not) + [^\x{100}]?+ (not) Ket End ------------------------------------------------------------------ @@ -404,15 +404,15 @@ Subject length lower bound = 6 /[^\x{100}]*[^\x{1000}]+[^\x{ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{100}]{5,6}+/Bi ------------------------------------------------------------------ Bra - /i [^\x{100}]* - /i [^\x{1000}]+ - /i [^\x{ffff}]?? - /i [^\x{8000}]{4} - /i [^\x{8000}]* - /i [^\x{7fff}]{2} - /i [^\x{7fff}]{0,7}? - /i [^\x{100}]{5} - /i [^\x{100}]?+ + /i [^\x{100}]* (not) + /i [^\x{1000}]+ (not) + /i [^\x{ffff}]?? (not) + /i [^\x{8000}]{4} (not) + /i [^\x{8000}]* (not) + /i [^\x{7fff}]{2} (not) + /i [^\x{7fff}]{0,7}? (not) + /i [^\x{100}]{5} (not) + /i [^\x{100}]?+ (not) Ket End ------------------------------------------------------------------ @@ -474,8 +474,8 @@ MK: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789AB /[^\x00-a]{12,}[^b-\xff]*/B ------------------------------------------------------------------ Bra - [b-\xff] (neg){12,} - [\x00-a] (neg)*+ + [^\x00-a]{12,} + [^b-\xff]*+ Ket End ------------------------------------------------------------------ @@ -483,16 +483,16 @@ MK: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789AB /[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/B ------------------------------------------------------------------ Bra - [\x00-\x08\x0e-\x1f!-\xff] (neg)* + [^\x09-\x0d ]* \s* [0-9A-Z_a-z]++ \W+ - [\x00-/:-\xff] (neg)*? + [^0-9]*? \d 0 - [\x00-/:-@[-^`{-\xff] (neg){4,6}? + [^0-9A-Z_a-z]{4,6}? \w* A Ket diff --git a/testdata/testoutput11-32 b/testdata/testoutput11-32 index 8fc94506c..d24dcdc97 100644 --- a/testdata/testoutput11-32 +++ b/testdata/testoutput11-32 @@ -9,7 +9,7 @@ /[^\x{c4}]/IB ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -364,11 +364,11 @@ Subject length lower bound = 6 /[^\x{80}][^\x{ff}][^\x{100}][^\x{1000}][^\x{ffff}]/B ------------------------------------------------------------------ Bra - [^\x{80}] - [^\x{ff}] - [^\x{100}] - [^\x{1000}] - [^\x{ffff}] + [^\x{80}] (not) + [^\x{ff}] (not) + [^\x{100}] (not) + [^\x{1000}] (not) + [^\x{ffff}] (not) Ket End ------------------------------------------------------------------ @@ -376,11 +376,11 @@ Subject length lower bound = 6 /[^\x{80}][^\x{ff}][^\x{100}][^\x{1000}][^\x{ffff}]/Bi ------------------------------------------------------------------ Bra - /i [^\x{80}] - /i [^\x{ff}] - /i [^\x{100}] - /i [^\x{1000}] - /i [^\x{ffff}] + /i [^\x{80}] (not) + /i [^\x{ff}] (not) + /i [^\x{100}] (not) + /i [^\x{1000}] (not) + /i [^\x{ffff}] (not) Ket End ------------------------------------------------------------------ @@ -388,15 +388,15 @@ Subject length lower bound = 6 /[^\x{100}]*[^\x{1000}]+[^\x{ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{100}]{5,6}+/B ------------------------------------------------------------------ Bra - [^\x{100}]* - [^\x{1000}]+ - [^\x{ffff}]?? - [^\x{8000}]{4} - [^\x{8000}]* - [^\x{7fff}]{2} - [^\x{7fff}]{0,7}? - [^\x{100}]{5} - [^\x{100}]?+ + [^\x{100}]* (not) + [^\x{1000}]+ (not) + [^\x{ffff}]?? (not) + [^\x{8000}]{4} (not) + [^\x{8000}]* (not) + [^\x{7fff}]{2} (not) + [^\x{7fff}]{0,7}? (not) + [^\x{100}]{5} (not) + [^\x{100}]?+ (not) Ket End ------------------------------------------------------------------ @@ -404,15 +404,15 @@ Subject length lower bound = 6 /[^\x{100}]*[^\x{1000}]+[^\x{ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{100}]{5,6}+/Bi ------------------------------------------------------------------ Bra - /i [^\x{100}]* - /i [^\x{1000}]+ - /i [^\x{ffff}]?? - /i [^\x{8000}]{4} - /i [^\x{8000}]* - /i [^\x{7fff}]{2} - /i [^\x{7fff}]{0,7}? - /i [^\x{100}]{5} - /i [^\x{100}]?+ + /i [^\x{100}]* (not) + /i [^\x{1000}]+ (not) + /i [^\x{ffff}]?? (not) + /i [^\x{8000}]{4} (not) + /i [^\x{8000}]* (not) + /i [^\x{7fff}]{2} (not) + /i [^\x{7fff}]{0,7}? (not) + /i [^\x{100}]{5} (not) + /i [^\x{100}]?+ (not) Ket End ------------------------------------------------------------------ @@ -474,8 +474,8 @@ MK: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789AB /[^\x00-a]{12,}[^b-\xff]*/B ------------------------------------------------------------------ Bra - [b-\xff] (neg){12,} - [\x00-a] (neg)*+ + [^\x00-a]{12,} + [^b-\xff]*+ Ket End ------------------------------------------------------------------ @@ -483,16 +483,16 @@ MK: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789AB /[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/B ------------------------------------------------------------------ Bra - [\x00-\x08\x0e-\x1f!-\xff] (neg)* + [^\x09-\x0d ]* \s* [0-9A-Z_a-z]++ \W+ - [\x00-/:-\xff] (neg)*? + [^0-9]*? \d 0 - [\x00-/:-@[-^`{-\xff] (neg){4,6}? + [^0-9A-Z_a-z]{4,6}? \w* A Ket diff --git a/testdata/testoutput12-16 b/testdata/testoutput12-16 index 80ae07677..f4e3e2d22 100644 --- a/testdata/testoutput12-16 +++ b/testdata/testoutput12-16 @@ -241,7 +241,7 @@ Subject length lower bound = 1 /[^ab\xC0-\xF0]/IB,utf ------------------------------------------------------------------ Bra - [\x00-`c-\xbf\xf1-\xff] (neg) + [^ab\xc0-\xf0] Ket End ------------------------------------------------------------------ @@ -384,7 +384,7 @@ Subject length lower bound = 3 /[^\x{c4}]/IB ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -426,7 +426,7 @@ Subject length lower bound = 1 /[^\xff]/IB,utf ------------------------------------------------------------------ Bra - [^\x{ff}] + [^\x{ff}] (not) Ket End ------------------------------------------------------------------ @@ -719,7 +719,7 @@ Subject length lower bound = 2 /[^\x{c4}]/IB,utf ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -987,7 +987,7 @@ Subject length lower bound = 17 /[^ⱥ]/Bi,utf ------------------------------------------------------------------ Bra - /i [^\x{2c65}] + /i [^\x{2c65}] (not) Ket End ------------------------------------------------------------------ @@ -1377,7 +1377,7 @@ Subject length lower bound = 2 /[\W\pL]/B ------------------------------------------------------------------ Bra - [\x00-/:-^`-\xff] (neg) + [^0-9_] Ket End ------------------------------------------------------------------ @@ -1394,7 +1394,7 @@ No match /[\s[:^ascii:]]/B,ucp ------------------------------------------------------------------ Bra - [\x09-\x0d \x80-\xff] (neg) + [^\x00-\x08\x0e-\x1f!-\x7f] Ket End ------------------------------------------------------------------ @@ -1423,7 +1423,7 @@ Failed: error 191 at offset 0: PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowe ------------------------------------------------------------------ Bra ^ - [\x00-`c-\xff] (neg) + [^ab] Ket End ------------------------------------------------------------------ diff --git a/testdata/testoutput12-32 b/testdata/testoutput12-32 index 4beb9499e..73a7dc801 100644 --- a/testdata/testoutput12-32 +++ b/testdata/testoutput12-32 @@ -236,7 +236,7 @@ Subject length lower bound = 1 /[^ab\xC0-\xF0]/IB,utf ------------------------------------------------------------------ Bra - [\x00-`c-\xbf\xf1-\xff] (neg) + [^ab\xc0-\xf0] Ket End ------------------------------------------------------------------ @@ -379,7 +379,7 @@ Subject length lower bound = 3 /[^\x{c4}]/IB ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -421,7 +421,7 @@ Subject length lower bound = 1 /[^\xff]/IB,utf ------------------------------------------------------------------ Bra - [^\x{ff}] + [^\x{ff}] (not) Ket End ------------------------------------------------------------------ @@ -713,7 +713,7 @@ Subject length lower bound = 2 /[^\x{c4}]/IB,utf ------------------------------------------------------------------ Bra - [^\x{c4}] + [^\x{c4}] (not) Ket End ------------------------------------------------------------------ @@ -981,7 +981,7 @@ Subject length lower bound = 17 /[^ⱥ]/Bi,utf ------------------------------------------------------------------ Bra - /i [^\x{2c65}] + /i [^\x{2c65}] (not) Ket End ------------------------------------------------------------------ @@ -1371,7 +1371,7 @@ Failed: error -28: UTF-32 error: code points greater than 0x10ffff are not defin /[\W\pL]/B ------------------------------------------------------------------ Bra - [\x00-/:-^`-\xff] (neg) + [^0-9_] Ket End ------------------------------------------------------------------ @@ -1388,7 +1388,7 @@ No match /[\s[:^ascii:]]/B,ucp ------------------------------------------------------------------ Bra - [\x09-\x0d \x80-\xff] (neg) + [^\x00-\x08\x0e-\x1f!-\x7f] Ket End ------------------------------------------------------------------ @@ -1420,7 +1420,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-`c-\xff] (neg) + [^ab] Ket End ------------------------------------------------------------------ diff --git a/testdata/testoutput15 b/testdata/testoutput15 index 892473bc9..e2407a729 100644 --- a/testdata/testoutput15 +++ b/testdata/testoutput15 @@ -453,7 +453,7 @@ Failed: error -52: nested recursion at the same subject position /[^\xff]((?1))/BI ------------------------------------------------------------------ Bra - [^\x{ff}] + [^\x{ff}] (not) CBra 1 Recurse Ket diff --git a/testdata/testoutput17 b/testdata/testoutput17 index 46e107f19..3666092b3 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -506,7 +506,7 @@ Failed: error -46: JIT stack limit reached /[^\xff]((?1))/BI ------------------------------------------------------------------ Bra - [^\x{ff}] + [^\x{ff}] (not) CBra 1 Recurse Ket diff --git a/testdata/testoutput2 b/testdata/testoutput2 index 1dd4e0f33..1992be0e5 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -1774,7 +1774,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-/:-@[-`{-\xff] (neg) + [^0-9A-Za-z] Ket End ------------------------------------------------------------------ @@ -1814,7 +1814,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-@[-`{-\xff] (neg) + [^A-Za-z] Ket End ------------------------------------------------------------------ @@ -1865,7 +1865,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x80-\xff] (neg) + [^\x00-\x7f] Ket End ------------------------------------------------------------------ @@ -1901,7 +1901,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-\x08\x0a-\x1f!-\xff] (neg) + [^\x09 ] Ket End ------------------------------------------------------------------ @@ -2082,7 +2082,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [ -~\x80-\xff] (neg) + [^\x00-\x1f\x7f] Ket End ------------------------------------------------------------------ @@ -2107,7 +2107,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-/12:-\xff] (neg) + [^03-9] Ket End ------------------------------------------------------------------ @@ -2134,7 +2134,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ Bra ^ - [\x00-\x08\x0a-\x1f!-\xff] (neg) + [^\x09 ] Ket End ------------------------------------------------------------------ @@ -2711,7 +2711,7 @@ Subject length lower bound = 1 /[\S]/IB ------------------------------------------------------------------ Bra - [\x00-\x08\x0e-\x1f!-\xff] (neg) + [^\x09-\x0d ] Ket End ------------------------------------------------------------------ @@ -3004,8 +3004,8 @@ Subject length lower bound = 1 /[^x]{1,3}+/B,no_auto_possess ------------------------------------------------------------------ Bra - [^x] - [^x]{0,2}+ + [^x] (not) + [^x]{0,2}+ (not) Ket End ------------------------------------------------------------------ @@ -3013,8 +3013,8 @@ Subject length lower bound = 1 /[^x]{1,3}+/Bi,no_auto_possess ------------------------------------------------------------------ Bra - /i [^x] - /i [^x]{0,2}+ + /i [^x] (not) + /i [^x]{0,2}+ (not) Ket End ------------------------------------------------------------------ @@ -7133,7 +7133,7 @@ Matched, but too many substrings /[^a]+a/B ------------------------------------------------------------------ Bra - [^a]++ + [^a]++ (not) a Ket End @@ -7142,7 +7142,7 @@ Matched, but too many substrings /[^a]+a/Bi ------------------------------------------------------------------ Bra - /i [^a]++ + /i [^a]++ (not) /i a Ket End @@ -7151,7 +7151,7 @@ Matched, but too many substrings /[^a]+A/Bi ------------------------------------------------------------------ Bra - /i [^a]++ + /i [^a]++ (not) /i A Ket End @@ -7160,7 +7160,7 @@ Matched, but too many substrings /[^a]+b/B ------------------------------------------------------------------ Bra - [^a]+ + [^a]+ (not) b Ket End @@ -7169,7 +7169,7 @@ Matched, but too many substrings /[^a]+\d/B ------------------------------------------------------------------ Bra - [^a]+ + [^a]+ (not) \d Ket End @@ -7179,7 +7179,7 @@ Matched, but too many substrings ------------------------------------------------------------------ Bra a*+ - [^a] + [^a] (not) Ket End ------------------------------------------------------------------ @@ -9444,10 +9444,10 @@ Partial match: ab Cond false CBra 1 < - [^m] - [^>] + [^m] (not) + [^>] (not) > - [^<] + [^<] (not) Ket CBra 2 \w*+ @@ -9466,10 +9466,10 @@ Partial match: ab Cond false CBra 1 < - [\x00-/:-\xff] (neg) - [^>] + [^0-9] + [^>] (not) > - [^<] + [^<] (not) Ket CBra 2 \w*+ @@ -13082,11 +13082,11 @@ Subject length lower bound = 5 [a-d]{5,12}+ [0-9e-z]*+ # - [\x00-`{-\xff] (neg)++ + [^a-z]++ [b-y]*+ a [2-7]?+ - [\x00-/:-`{-\xff] (neg)++ + [^0-9a-z]++ Ket End ------------------------------------------------------------------ @@ -13325,7 +13325,7 @@ Failed: error 178 at offset 5: digits missing after \x or in \x{} or \o{} or \N{ /[^ab]*+/B,no_auto_possess ------------------------------------------------------------------ Bra - [\x00-`c-\xff] (neg)*+ + [^ab]*+ Ket End ------------------------------------------------------------------ @@ -15617,7 +15617,7 @@ Subject length lower bound = 0 T? *MARK ;.'?`(\x{ea}p {! - [\x00- "-&+-:<->@-BD-xz-\xff] (neg) + [^!'-*;?Cy] {1; CBra 1 \x08 @@ -19738,7 +19738,7 @@ No match ------------------------------------------------------------------ Bra eclass[ - cls:[\x00-@B-\xff] (neg) + cls:[^A] cls:[B] op: || ] @@ -19900,7 +19900,7 @@ No match Bra eclass[ cls:[A] - cls:[\x00-\^-\xff] (neg) + cls:[^\]] op: || ] Ket @@ -20018,7 +20018,7 @@ No match Bra eclass[ cls:[\x09-\x0d 0-9AC-E] - cls:[\x00-y{-\xff] (neg) + cls:[^z] op: && ] Ket @@ -20049,7 +20049,7 @@ No match Bra eclass[ cls:[z] - cls:[\x00-\x08\x0e-\x1f!-/:-@BF-\xff] (neg) + cls:[^\x09-\x0d 0-9AC-E] op: || ] Ket @@ -20249,7 +20249,7 @@ No match Bra eclass[ cls:[a] - cls:[\x00-ac-\xff] (neg) + cls:[^b] op: || op: ^ ] @@ -21062,6 +21062,62 @@ Failed: error 106 at offset 3: missing terminating ] for character class /[\E/ Failed: error 106 at offset 3: missing terminating ] for character class +/[\^z]/B +------------------------------------------------------------------ + Bra + [\^z] + Ket + End +------------------------------------------------------------------ + +/[ \^]/B +------------------------------------------------------------------ + Bra + [ ^] + Ket + End +------------------------------------------------------------------ + +/[\\z]/B +------------------------------------------------------------------ + Bra + [\\z] + Ket + End +------------------------------------------------------------------ + +/[0-z]/B +------------------------------------------------------------------ + Bra + [0-z] + Ket + End +------------------------------------------------------------------ + +/[0\-z]/B +------------------------------------------------------------------ + Bra + [\-0z] + Ket + End +------------------------------------------------------------------ + +/[]z]/B +------------------------------------------------------------------ + Bra + [\]z] + Ket + End +------------------------------------------------------------------ + +/[ \]]/B +------------------------------------------------------------------ + Bra + [ \]] + Ket + End +------------------------------------------------------------------ + # End of testinput2 Error -70: PCRE2_ERROR_BADDATA (unknown error number) Error -62: bad serialized data diff --git a/testdata/testoutput5 b/testdata/testoutput5 index 29dbd1678..80d1fd531 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -324,7 +324,7 @@ Subject length lower bound = 1 /[^\xFF]/IB ------------------------------------------------------------------ Bra - [^\x{ff}] + [^\x{ff}] (not) Ket End ------------------------------------------------------------------ @@ -358,7 +358,7 @@ Subject length lower bound = 1 /[^\x{100}]abc(xyz(?1))/IB,utf ------------------------------------------------------------------ Bra - [^\x{100}] + [^\x{100}] (not) abc CBra 1 xyz @@ -1673,11 +1673,11 @@ Partial match: \x{0d}\x{0d} /[^\x{100}][^\x{1234}][^\x{ffff}][^\x{10000}][^\x{10ffff}]/B,utf ------------------------------------------------------------------ Bra - [^\x{100}] - [^\x{1234}] - [^\x{ffff}] - [^\x{10000}] - [^\x{10ffff}] + [^\x{100}] (not) + [^\x{1234}] (not) + [^\x{ffff}] (not) + [^\x{10000}] (not) + [^\x{10ffff}] (not) Ket End ------------------------------------------------------------------ @@ -1685,11 +1685,11 @@ Partial match: \x{0d}\x{0d} /[^\x{100}][^\x{1234}][^\x{ffff}][^\x{10000}][^\x{10ffff}]/Bi,utf ------------------------------------------------------------------ Bra - /i [^\x{100}] - /i [^\x{1234}] - /i [^\x{ffff}] - /i [^\x{10000}] - /i [^\x{10ffff}] + /i [^\x{100}] (not) + /i [^\x{1234}] (not) + /i [^\x{ffff}] (not) + /i [^\x{10000}] (not) + /i [^\x{10ffff}] (not) Ket End ------------------------------------------------------------------ @@ -1697,15 +1697,15 @@ Partial match: \x{0d}\x{0d} /[^\x{100}]*[^\x{10000}]+[^\x{10ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{fffff}]{5,6}+/B,utf ------------------------------------------------------------------ Bra - [^\x{100}]* - [^\x{10000}]+ - [^\x{10ffff}]?? - [^\x{8000}]{4} - [^\x{8000}]* - [^\x{7fff}]{2} - [^\x{7fff}]{0,7}? - [^\x{fffff}]{5} - [^\x{fffff}]?+ + [^\x{100}]* (not) + [^\x{10000}]+ (not) + [^\x{10ffff}]?? (not) + [^\x{8000}]{4} (not) + [^\x{8000}]* (not) + [^\x{7fff}]{2} (not) + [^\x{7fff}]{0,7}? (not) + [^\x{fffff}]{5} (not) + [^\x{fffff}]?+ (not) Ket End ------------------------------------------------------------------ @@ -1713,15 +1713,15 @@ Partial match: \x{0d}\x{0d} /[^\x{100}]*[^\x{10000}]+[^\x{10ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{fffff}]{5,6}+/Bi,utf ------------------------------------------------------------------ Bra - /i [^\x{100}]* - /i [^\x{10000}]+ - /i [^\x{10ffff}]?? - /i [^\x{8000}]{4} - /i [^\x{8000}]* - /i [^\x{7fff}]{2} - /i [^\x{7fff}]{0,7}? - /i [^\x{fffff}]{5} - /i [^\x{fffff}]?+ + /i [^\x{100}]* (not) + /i [^\x{10000}]+ (not) + /i [^\x{10ffff}]?? (not) + /i [^\x{8000}]{4} (not) + /i [^\x{8000}]* (not) + /i [^\x{7fff}]{2} (not) + /i [^\x{7fff}]{0,7}? (not) + /i [^\x{fffff}]{5} (not) + /i [^\x{fffff}]?+ (not) Ket End ------------------------------------------------------------------ @@ -3126,7 +3126,7 @@ No match /[^a]*\x{3c2}/Bi,utf ------------------------------------------------------------------ Bra - /i [^a]* + /i [^a]* (not) clist 03a3 03c2 03c3 Ket End @@ -4070,7 +4070,7 @@ MK: a\x{12345}b\x{09}(d)c /[[:^ascii:]]/utf,ucp,bincode ------------------------------------------------------------------ Bra - [\x80-\xff] (neg) + [^\x00-\x7f] Ket End ------------------------------------------------------------------ @@ -4078,7 +4078,7 @@ MK: a\x{12345}b\x{09}(d)c /[[:^ascii:]\w]/utf,ucp,bincode ------------------------------------------------------------------ Bra - [0-9A-Z_a-z\x80-\xff] (neg) + [^\x00-/:-@[-^`{-\x7f] Ket End ------------------------------------------------------------------ @@ -4086,7 +4086,7 @@ MK: a\x{12345}b\x{09}(d)c /[\w[:^ascii:]]/utf,ucp,bincode ------------------------------------------------------------------ Bra - [0-9A-Z_a-z\x80-\xff] (neg) + [^\x00-/:-@[-^`{-\x7f] Ket End ------------------------------------------------------------------ @@ -4111,7 +4111,7 @@ No match /[[:^ascii:]a]/utf,ucp,bincode ------------------------------------------------------------------ Bra - [a\x80-\xff] (neg) + [^\x00-`b-\x7f] Ket End ------------------------------------------------------------------ @@ -6096,7 +6096,7 @@ Failed: error -57 at offset 4 in replacement: bad escape sequence in replacement /[\x80-\x{4000}\x90\x{400}-\x{f000}\xa0\x{4000}-\x{10ffff}]++/B,utf ------------------------------------------------------------------ Bra - [\x80-\xff] (neg)++ + [^\x00-\x7f]++ Ket End ------------------------------------------------------------------ @@ -6106,7 +6106,7 @@ Failed: error -57 at offset 4 in replacement: bad escape sequence in replacement /[\x80-\x{4000}\x90\x{400}-\x{f000}\xa0\pN\x{4000}-\x{10ffff}]++/B,utf ------------------------------------------------------------------ Bra - [0-9\x80-\xff] (neg)++ + [^\x00-/:-\x7f]++ Ket End ------------------------------------------------------------------ @@ -6148,7 +6148,7 @@ No match /[\pN\xf0-\x{10ffff}]{5,8}/B,utf ------------------------------------------------------------------ Bra - [0-9\xb2\xb3\xb9\xbc-\xbe\xf0-\xff] (neg){5,8}+ + [^\x00-/:-\xb1\xb4-\xb8\xba\xbb\xbf-\xef]{5,8}+ Ket End ------------------------------------------------------------------ @@ -6459,7 +6459,7 @@ No match Bra eclass[ cls:[\p{L}] - cls:[\x00-\^-\xff] (neg) + cls:[^\]] op: || ] Ket @@ -6519,7 +6519,7 @@ No match Bra eclass[ cls:[\x09-\x0d 0-9A-Z\xc0-\xd6\xd8-\xde\p{Lu}] - cls:[\x00-y{-\xff] (neg) + cls:[^z] op: && ] Ket @@ -6893,7 +6893,7 @@ No match Bra eclass[ cls:[\p{Nd}] - cls:[\x00-46-\xff] (neg) + cls:[^5] op: || op: ^ ] diff --git a/testdata/testoutput8-16-2 b/testdata/testoutput8-16-2 index aa774fb34..f2a3815d8 100644 --- a/testdata/testoutput8-16-2 +++ b/testdata/testoutput8-16-2 @@ -618,7 +618,7 @@ Memory allocation - code size : 14 Memory allocation - code size : 14 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 14 Memory allocation - code size : 14 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 14 Memory allocation - code size : 14 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 14 Memory allocation - code size : 14 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-16-3 b/testdata/testoutput8-16-3 index 149bf94c5..d46ceba47 100644 --- a/testdata/testoutput8-16-3 +++ b/testdata/testoutput8-16-3 @@ -618,7 +618,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^a] + 3 [^a] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^a] + 3 [^a] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^\x{aa}] + 3 [^\x{aa}] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^\x{aa}] + 3 [^\x{aa}] (not) 5 5 Ket 8 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-16-4 b/testdata/testoutput8-16-4 index 149bf94c5..d46ceba47 100644 --- a/testdata/testoutput8-16-4 +++ b/testdata/testoutput8-16-4 @@ -618,7 +618,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^a] + 3 [^a] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^a] + 3 [^a] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^\x{aa}] + 3 [^\x{aa}] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 18 Memory allocation - code size : 18 ------------------------------------------------------------------ 0 5 Bra - 3 [^\x{aa}] + 3 [^\x{aa}] (not) 5 5 Ket 8 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-32-2 b/testdata/testoutput8-32-2 index 10d8fd8a4..e9865c85a 100644 --- a/testdata/testoutput8-32-2 +++ b/testdata/testoutput8-32-2 @@ -618,7 +618,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-32-3 b/testdata/testoutput8-32-3 index 10d8fd8a4..e9865c85a 100644 --- a/testdata/testoutput8-32-3 +++ b/testdata/testoutput8-32-3 @@ -618,7 +618,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-32-4 b/testdata/testoutput8-32-4 index 10d8fd8a4..e9865c85a 100644 --- a/testdata/testoutput8-32-4 +++ b/testdata/testoutput8-32-4 @@ -618,7 +618,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^a] + 2 [^a] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 28 Memory allocation - code size : 28 ------------------------------------------------------------------ 0 4 Bra - 2 [^\x{aa}] + 2 [^\x{aa}] (not) 4 4 Ket 6 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-8-2 b/testdata/testoutput8-8-2 index 77a86abd4..0ebc4d015 100644 --- a/testdata/testoutput8-8-2 +++ b/testdata/testoutput8-8-2 @@ -618,7 +618,7 @@ Memory allocation - code size : 10 Memory allocation - code size : 9 ------------------------------------------------------------------ 0 5 Bra - 3 [^a] + 3 [^a] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 9 Memory allocation - code size : 9 ------------------------------------------------------------------ 0 5 Bra - 3 [^a] + 3 [^a] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 9 Memory allocation - code size : 9 ------------------------------------------------------------------ 0 5 Bra - 3 [^\x{aa}] + 3 [^\x{aa}] (not) 5 5 Ket 8 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 9 Memory allocation - code size : 10 ------------------------------------------------------------------ 0 6 Bra - 3 [^\x{aa}] + 3 [^\x{aa}] (not) 6 6 Ket 9 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-8-3 b/testdata/testoutput8-8-3 index 9abb9e5c4..04b3a3e6b 100644 --- a/testdata/testoutput8-8-3 +++ b/testdata/testoutput8-8-3 @@ -618,7 +618,7 @@ Memory allocation - code size : 12 Memory allocation - code size : 11 ------------------------------------------------------------------ 0 6 Bra - 4 [^a] + 4 [^a] (not) 6 6 Ket 10 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 11 Memory allocation - code size : 11 ------------------------------------------------------------------ 0 6 Bra - 4 [^a] + 4 [^a] (not) 6 6 Ket 10 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 11 Memory allocation - code size : 11 ------------------------------------------------------------------ 0 6 Bra - 4 [^\x{aa}] + 4 [^\x{aa}] (not) 6 6 Ket 10 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 11 Memory allocation - code size : 12 ------------------------------------------------------------------ 0 7 Bra - 4 [^\x{aa}] + 4 [^\x{aa}] (not) 7 7 Ket 11 End ------------------------------------------------------------------ diff --git a/testdata/testoutput8-8-4 b/testdata/testoutput8-8-4 index f00001807..42119f783 100644 --- a/testdata/testoutput8-8-4 +++ b/testdata/testoutput8-8-4 @@ -618,7 +618,7 @@ Memory allocation - code size : 14 Memory allocation - code size : 13 ------------------------------------------------------------------ 0 7 Bra - 5 [^a] + 5 [^a] (not) 7 7 Ket 12 End ------------------------------------------------------------------ @@ -627,7 +627,7 @@ Memory allocation - code size : 13 Memory allocation - code size : 13 ------------------------------------------------------------------ 0 7 Bra - 5 [^a] + 5 [^a] (not) 7 7 Ket 12 End ------------------------------------------------------------------ @@ -636,7 +636,7 @@ Memory allocation - code size : 13 Memory allocation - code size : 13 ------------------------------------------------------------------ 0 7 Bra - 5 [^\x{aa}] + 5 [^\x{aa}] (not) 7 7 Ket 12 End ------------------------------------------------------------------ @@ -645,7 +645,7 @@ Memory allocation - code size : 13 Memory allocation - code size : 14 ------------------------------------------------------------------ 0 8 Bra - 5 [^\x{aa}] + 5 [^\x{aa}] (not) 8 8 Ket 13 End ------------------------------------------------------------------ diff --git a/testdata/testoutput9 b/testdata/testoutput9 index 7be6b8647..7845dc11a 100644 --- a/testdata/testoutput9 +++ b/testdata/testoutput9 @@ -306,7 +306,7 @@ Subject length lower bound = 1 /[^\h]/B ------------------------------------------------------------------ Bra - [\x00-\x08\x0a-\x1f!-\x9f\xa1-\xff] (neg) + [^\x09 \xa0] Ket End ------------------------------------------------------------------ @@ -357,8 +357,8 @@ Failed: error 177 at offset 7: character code point value in \u.... sequence is /[^\x00-a]{12,}[^b-\xff]*/B ------------------------------------------------------------------ Bra - [b-\xff] (neg){12,}+ - [\x00-a] (neg)*+ + [^\x00-a]{12,}+ + [^b-\xff]*+ Ket End ------------------------------------------------------------------ @@ -366,16 +366,16 @@ Failed: error 177 at offset 7: character code point value in \u.... sequence is /[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/B ------------------------------------------------------------------ Bra - [\x00-\x08\x0e-\x1f!-\xff] (neg)*+ + [^\x09-\x0d ]*+ \s* [0-9A-Z_a-z]++ \W+ - [\x00-/:-\xff] (neg)*+ + [^0-9]*+ \d 0 - [\x00-/:-@[-^`{-\xff] (neg){4,6}+ + [^0-9A-Z_a-z]{4,6}+ \w* A Ket