Possessify high ASCII r962 | ph10 | 2012-04-20 19:28:23 +0200 (Pá, 20 dub 2012) | 3 lines Fix auto-possessifying bugs when PCRE_UCP is not set, but character tables specify characters in the range 127-255 are letters, spaces, etc. Petr Pisar: Changelog entries removed Index: testdata/testoutput15 =================================================================== --- testdata/testoutput15 (revision 961) +++ testdata/testoutput15 (revision 962) @@ -910,4 +910,140 @@ First char = \x{c7} Need char = \x{bf} +/\w+\x{C4}/8BZ +------------------------------------------------------------------ + Bra + \w++ + \x{c4} + Ket + End +------------------------------------------------------------------ + a\x{C4}\x{C4} + 0: a\x{c4} + +/\w+\x{C4}/8BZT1 +------------------------------------------------------------------ + Bra + \w+ + \x{c4} + Ket + End +------------------------------------------------------------------ + a\x{C4}\x{C4} + 0: a\x{c4}\x{c4} + +/\W+\x{C4}/8BZ +------------------------------------------------------------------ + Bra + \W+ + \x{c4} + Ket + End +------------------------------------------------------------------ + !\x{C4} + 0: !\x{c4} + +/\W+\x{C4}/8BZT1 +------------------------------------------------------------------ + Bra + \W++ + \x{c4} + Ket + End +------------------------------------------------------------------ + !\x{C4} + 0: !\x{c4} + +/\W+\x{A1}/8BZ +------------------------------------------------------------------ + Bra + \W+ + \x{a1} + Ket + End +------------------------------------------------------------------ + !\x{A1} + 0: !\x{a1} + +/\W+\x{A1}/8BZT1 +------------------------------------------------------------------ + Bra + \W+ + \x{a1} + Ket + End +------------------------------------------------------------------ + !\x{A1} + 0: !\x{a1} + +/X\s+\x{A0}/8BZ +------------------------------------------------------------------ + Bra + X + \s++ + \x{a0} + Ket + End +------------------------------------------------------------------ + X\x20\x{A0}\x{A0} + 0: X \x{a0} + +/X\s+\x{A0}/8BZT1 +------------------------------------------------------------------ + Bra + X + \s+ + \x{a0} + Ket + End +------------------------------------------------------------------ + X\x20\x{A0}\x{A0} + 0: X \x{a0}\x{a0} + +/\S+\x{A0}/8BZ +------------------------------------------------------------------ + Bra + \S+ + \x{a0} + Ket + End +------------------------------------------------------------------ + X\x{A0}\x{A0} + 0: X\x{a0}\x{a0} + +/\S+\x{A0}/8BZT1 +------------------------------------------------------------------ + Bra + \S++ + \x{a0} + Ket + End +------------------------------------------------------------------ + X\x{A0}\x{A0} + 0: X\x{a0} + +/\x{a0}+\s!/8BZ +------------------------------------------------------------------ + Bra + \x{a0}++ + \s + ! + Ket + End +------------------------------------------------------------------ + \x{a0}\x20! + 0: \x{a0} ! + +/\x{a0}+\s!/8BZT1 +------------------------------------------------------------------ + Bra + \x{a0}+ + \s + ! + Ket + End +------------------------------------------------------------------ + \x{a0}\x20! + 0: \x{a0} ! + /-- End of testinput15 --/ Index: testdata/testoutput18 =================================================================== --- testdata/testoutput18 (revision 961) +++ testdata/testoutput18 (revision 962) @@ -845,4 +845,140 @@ /í¼€/8 Failed: invalid UTF-16 string at offset 0 +/\w+\x{C4}/8BZ +------------------------------------------------------------------ + Bra + \w++ + \xc4 + Ket + End +------------------------------------------------------------------ + a\x{C4}\x{C4} + 0: a\x{c4} + +/\w+\x{C4}/8BZT1 +------------------------------------------------------------------ + Bra + \w+ + \xc4 + Ket + End +------------------------------------------------------------------ + a\x{C4}\x{C4} + 0: a\x{c4}\x{c4} + +/\W+\x{C4}/8BZ +------------------------------------------------------------------ + Bra + \W+ + \xc4 + Ket + End +------------------------------------------------------------------ + !\x{C4} + 0: !\x{c4} + +/\W+\x{C4}/8BZT1 +------------------------------------------------------------------ + Bra + \W++ + \xc4 + Ket + End +------------------------------------------------------------------ + !\x{C4} + 0: !\x{c4} + +/\W+\x{A1}/8BZ +------------------------------------------------------------------ + Bra + \W+ + \xa1 + Ket + End +------------------------------------------------------------------ + !\x{A1} + 0: !\x{a1} + +/\W+\x{A1}/8BZT1 +------------------------------------------------------------------ + Bra + \W+ + \xa1 + Ket + End +------------------------------------------------------------------ + !\x{A1} + 0: !\x{a1} + +/X\s+\x{A0}/8BZ +------------------------------------------------------------------ + Bra + X + \s++ + \xa0 + Ket + End +------------------------------------------------------------------ + X\x20\x{A0}\x{A0} + 0: X \x{a0} + +/X\s+\x{A0}/8BZT1 +------------------------------------------------------------------ + Bra + X + \s+ + \xa0 + Ket + End +------------------------------------------------------------------ + X\x20\x{A0}\x{A0} + 0: X \x{a0}\x{a0} + +/\S+\x{A0}/8BZ +------------------------------------------------------------------ + Bra + \S+ + \xa0 + Ket + End +------------------------------------------------------------------ + X\x{A0}\x{A0} + 0: X\x{a0}\x{a0} + +/\S+\x{A0}/8BZT1 +------------------------------------------------------------------ + Bra + \S++ + \xa0 + Ket + End +------------------------------------------------------------------ + X\x{A0}\x{A0} + 0: X\x{a0} + +/\x{a0}+\s!/8BZ +------------------------------------------------------------------ + Bra + \xa0++ + \s + ! + Ket + End +------------------------------------------------------------------ + \x{a0}\x20! + 0: \x{a0} ! + +/\x{a0}+\s!/8BZT1 +------------------------------------------------------------------ + Bra + \xa0+ + \s + ! + Ket + End +------------------------------------------------------------------ + \x{a0}\x20! + 0: \x{a0} ! + /-- End of testinput18 --/ Index: testdata/testinput15 =================================================================== --- testdata/testinput15 (revision 961) +++ testdata/testinput15 (revision 962) @@ -277,4 +277,40 @@ /\777/8DZ +/\w+\x{C4}/8BZ + a\x{C4}\x{C4} + +/\w+\x{C4}/8BZT1 + a\x{C4}\x{C4} + +/\W+\x{C4}/8BZ + !\x{C4} + +/\W+\x{C4}/8BZT1 + !\x{C4} + +/\W+\x{A1}/8BZ + !\x{A1} + +/\W+\x{A1}/8BZT1 + !\x{A1} + +/X\s+\x{A0}/8BZ + X\x20\x{A0}\x{A0} + +/X\s+\x{A0}/8BZT1 + X\x20\x{A0}\x{A0} + +/\S+\x{A0}/8BZ + X\x{A0}\x{A0} + +/\S+\x{A0}/8BZT1 + X\x{A0}\x{A0} + +/\x{a0}+\s!/8BZ + \x{a0}\x20! + +/\x{a0}+\s!/8BZT1 + \x{a0}\x20! + /-- End of testinput15 --/ Index: testdata/testinput18 =================================================================== --- testdata/testinput18 (revision 961) +++ testdata/testinput18 (revision 962) @@ -240,4 +240,40 @@ /í¼€/8 +/\w+\x{C4}/8BZ + a\x{C4}\x{C4} + +/\w+\x{C4}/8BZT1 + a\x{C4}\x{C4} + +/\W+\x{C4}/8BZ + !\x{C4} + +/\W+\x{C4}/8BZT1 + !\x{C4} + +/\W+\x{A1}/8BZ + !\x{A1} + +/\W+\x{A1}/8BZT1 + !\x{A1} + +/X\s+\x{A0}/8BZ + X\x20\x{A0}\x{A0} + +/X\s+\x{A0}/8BZT1 + X\x20\x{A0}\x{A0} + +/\S+\x{A0}/8BZ + X\x{A0}\x{A0} + +/\S+\x{A0}/8BZT1 + X\x{A0}\x{A0} + +/\x{a0}+\s!/8BZ + \x{a0}\x20! + +/\x{a0}+\s!/8BZT1 + \x{a0}\x20! + /-- End of testinput18 --/ Index: pcre_compile.c =================================================================== --- pcre_compile.c (revision 961) +++ pcre_compile.c (revision 962) @@ -3132,22 +3132,22 @@ When it is set, \d etc. are converted into OP_(NOT_)PROP codes. */ case OP_DIGIT: - return next > 127 || (cd->ctypes[next] & ctype_digit) == 0; + return next > 255 || (cd->ctypes[next] & ctype_digit) == 0; case OP_NOT_DIGIT: - return next <= 127 && (cd->ctypes[next] & ctype_digit) != 0; + return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0; case OP_WHITESPACE: - return next > 127 || (cd->ctypes[next] & ctype_space) == 0; + return next > 255 || (cd->ctypes[next] & ctype_space) == 0; case OP_NOT_WHITESPACE: - return next <= 127 && (cd->ctypes[next] & ctype_space) != 0; + return next <= 255 && (cd->ctypes[next] & ctype_space) != 0; case OP_WORDCHAR: - return next > 127 || (cd->ctypes[next] & ctype_word) == 0; + return next > 255 || (cd->ctypes[next] & ctype_word) == 0; case OP_NOT_WORDCHAR: - return next <= 127 && (cd->ctypes[next] & ctype_word) != 0; + return next <= 255 && (cd->ctypes[next] & ctype_word) != 0; case OP_HSPACE: case OP_NOT_HSPACE: @@ -3225,22 +3225,22 @@ switch(-next) { case ESC_d: - return c > 127 || (cd->ctypes[c] & ctype_digit) == 0; + return c > 255 || (cd->ctypes[c] & ctype_digit) == 0; case ESC_D: - return c <= 127 && (cd->ctypes[c] & ctype_digit) != 0; + return c <= 255 && (cd->ctypes[c] & ctype_digit) != 0; case ESC_s: - return c > 127 || (cd->ctypes[c] & ctype_space) == 0; + return c > 255 || (cd->ctypes[c] & ctype_space) == 0; case ESC_S: - return c <= 127 && (cd->ctypes[c] & ctype_space) != 0; + return c <= 255 && (cd->ctypes[c] & ctype_space) != 0; case ESC_w: - return c > 127 || (cd->ctypes[c] & ctype_word) == 0; + return c > 255 || (cd->ctypes[c] & ctype_word) == 0; case ESC_W: - return c <= 127 && (cd->ctypes[c] & ctype_word) != 0; + return c <= 255 && (cd->ctypes[c] & ctype_word) != 0; case ESC_h: case ESC_H: