Give specific error for \F as for \L, \U etc.

This commit is contained in:
Philip.Hazel 2018-07-27 16:55:52 +00:00
parent f8a18f65be
commit a9453f096f
7 changed files with 23 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.TH PCRE2COMPAT 3 "18 April 2017" "PCRE2 10.30" .TH PCRE2COMPAT 3 "27 July 2018" "PCRE2 10.32"
.SH NAME .SH NAME
PCRE2 - Perl-compatible regular expressions (revised API) PCRE2 - Perl-compatible regular expressions (revised API)
.SH "DIFFERENCES BETWEEN PCRE2 AND PERL" .SH "DIFFERENCES BETWEEN PCRE2 AND PERL"
@ -28,12 +28,12 @@ counted, but their entries in the offsets vector are set only when a negative
assertion is a condition that has a matching branch (that is, the condition is assertion is a condition that has a matching branch (that is, the condition is
false). false).
.P .P
4. The following Perl escape sequences are not supported: \el, \eu, \eL, 4. The following Perl escape sequences are not supported: \eF, \el, \eL, \eu,
\eU, and \eN when followed by a character name or Unicode value. (\eN on its \eU, and \eN when followed by a character name. (\eN on its own, matching a
own, matching a non-newline character, is supported.) In fact these are non-newline character, is supported.) The escapes that modify the case of
implemented by Perl's general string-handling and are not part of its pattern following letters are implemented by Perl's general string-handling and are not
matching engine. If any of these are encountered by PCRE2, an error is part of its pattern matching engine. If any of these are encountered by PCRE2,
generated by default. However, if the PCRE2_ALT_BSUX option is set, an error is generated by default. However, if the PCRE2_ALT_BSUX option is set,
\eU and \eu are interpreted as ECMAScript interprets them. \eU and \eu are interpreted as ECMAScript interprets them.
.P .P
5. The Perl escape sequences \ep, \eP, and \eX are supported only if PCRE2 is 5. The Perl escape sequences \ep, \eP, and \eX are supported only if PCRE2 is
@ -194,6 +194,6 @@ Cambridge, England.
.rs .rs
.sp .sp
.nf .nf
Last updated: 18 April 2017 Last updated: 27 July 2018
Copyright (c) 1997-2017 University of Cambridge. Copyright (c) 1997-2018 University of Cambridge.
.fi .fi

View File

@ -523,7 +523,7 @@ character class, these sequences have different meanings.
.SS "Unsupported escape sequences" .SS "Unsupported escape sequences"
.rs .rs
.sp .sp
In Perl, the sequences \el, \eL, \eu, and \eU are recognized by its string In Perl, the sequences \eF, \el, \eL, \eu, and \eU are recognized by its string
handler and used to modify the case of following characters. By default, PCRE2 handler and used to modify the case of following characters. By default, PCRE2
does not support these escape sequences. However, if the PCRE2_ALT_BSUX option does not support these escape sequences. However, if the PCRE2_ALT_BSUX option
is set, \eU matches a "U" character, and \eu can be used to define a character is set, \eU matches a "U" character, and \eu can be used to define a character

View File

@ -1504,6 +1504,7 @@ else
/* A number of Perl escapes are not handled by PCRE. We give an explicit /* A number of Perl escapes are not handled by PCRE. We give an explicit
error. */ error. */
case CHAR_F:
case CHAR_l: case CHAR_l:
case CHAR_L: case CHAR_L:
*errorcodeptr = ERR37; *errorcodeptr = ERR37;

View File

@ -107,7 +107,7 @@ static const unsigned char compile_error_texts[] =
/* 35 */ /* 35 */
"lookbehind is too complicated\0" "lookbehind is too complicated\0"
"\\C is not allowed in a lookbehind assertion in UTF-" XSTRING(PCRE2_CODE_UNIT_WIDTH) " mode\0" "\\C is not allowed in a lookbehind assertion in UTF-" XSTRING(PCRE2_CODE_UNIT_WIDTH) " mode\0"
"PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u\0" "PCRE2 does not support \\F, \\L, \\l, \\N{name}, \\U, or \\u\0"
"number after (?C is greater than 255\0" "number after (?C is greater than 255\0"
"closing parenthesis for (?C expected\0" "closing parenthesis for (?C expected\0"
/* 40 */ /* 40 */

2
testdata/testinput2 vendored
View File

@ -910,6 +910,8 @@
/[:x:]/I /[:x:]/I
/\F/I
/\l/I /\l/I
/\L/I /\L/I

13
testdata/testoutput2 vendored
View File

@ -3244,20 +3244,23 @@ Failed: error 113 at offset 0: POSIX collating elements are not supported
/[:x:]/I /[:x:]/I
Failed: error 112 at offset 0: POSIX named classes are supported only within a class Failed: error 112 at offset 0: POSIX named classes are supported only within a class
/\F/I
Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
/\l/I /\l/I
Failed: error 137 at offset 2: PCRE does not support \L, \l, \N{name}, \U, or \u Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
/\L/I /\L/I
Failed: error 137 at offset 2: PCRE does not support \L, \l, \N{name}, \U, or \u Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
/\N{name}/I /\N{name}/I
Failed: error 137 at offset 2: PCRE does not support \L, \l, \N{name}, \U, or \u Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
/\u/I /\u/I
Failed: error 137 at offset 2: PCRE does not support \L, \l, \N{name}, \U, or \u Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
/\U/I /\U/I
Failed: error 137 at offset 2: PCRE does not support \L, \l, \N{name}, \U, or \u Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
/a{1,3}b/ungreedy /a{1,3}b/ungreedy
ab ab

View File

@ -4754,6 +4754,6 @@ No match
Failed: error 178 at offset 5: digits missing in \x{} or \o{} or \N{U+} Failed: error 178 at offset 5: digits missing in \x{} or \o{} or \N{U+}
/\N{U}/ /\N{U}/
Failed: error 137 at offset 2: PCRE does not support \L, \l, \N{name}, \U, or \u Failed: error 137 at offset 2: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u
# End of testinput5 # End of testinput5