From: Jarkko Hietaniemi Date: Thu, 17 Aug 2000 00:51:49 +0000 (+0000) Subject: Tweak the regex compilation errors once more. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=79eeca274c358bbc6dfc41f18a8cb0c37b1b4384;p=p5sagit%2Fp5-mst-13.2.git Tweak the regex compilation errors once more. p4raw-id: //depot/perl@6663 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 11580f7..b55c7df 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -557,10 +557,10 @@ C<-i.bak>, or some such. characters and Perl was unable to create a unique filename during inplace editing with the B<-i> switch. The file was ignored. -=item Can't do {n,m} with n > m at ===HERE=== in regex m/%s/ +=item Can't do {n,m} with n > m before << HERE in regex m/%s/ (F) Minima must be less than or equal to maxima. If you really want your -regexp to match something 0 times, just put {0}. The ===HERE=== shows in the +regexp to match something 0 times, just put {0}. The << HERE shows in the regular expression about where the problem was discovered. See L. =item Can't do setegid! @@ -1379,10 +1379,10 @@ some time before now. Check your logic flow. flock() operates on filehandles. Are you attempting to call flock() on a dirhandle by the same name? -=item Quantifier follows nothing at ===HERE=== in regex m/%s/ +=item Quantifier follows nothing before << HERE in regex m/%s/ (F) You started a regular expression with a quantifier. Backslash it if you -meant it literally. The ===HERE=== shows in the regular expression about where the +meant it literally. The << HERE shows in the regular expression about where the problem was discovered. See L. =item Format not terminated @@ -1629,10 +1629,10 @@ transparently promotes all numbers to a floating point representation internally--subject to loss of precision errors in subsequent operations. -=item Internal disaster at ===HERE=== in regex m/%s/ +=item Internal disaster before << HERE in regex m/%s/ (P) Something went badly wrong in the regular expression parser. -The ===HERE=== shows in the regular expression about where the problem was +The << HERE shows in the regular expression about where the problem was discovered. @@ -1645,9 +1645,9 @@ L). Somehow, this count has become scrambled, so Perl is making a guess and treating this C as a request to terminate the Perl script and execute the specified command. -=item Internal urp at ===HERE=== in regex m/%s/ +=item Internal urp before << HERE in regex m/%s/ -(P) Something went badly awry in the regular expression parser. The ===HERE=== +(P) Something went badly awry in the regular expression parser. The <<. -=item Lookbehind longer than %d not implemented at ===HERE=== in reges m/%s/ +=item Lookbehind longer than %d not implemented before << HERE in reges m/%s/ (F) There is currently a limit on the length of string which lookbehind can -handle. This restriction may be eased in a future release. The ===HERE=== shows in +handle. This restriction may be eased in a future release. The << HERE shows in the regular expression about where the problem was discovered. =item Malformed PERLLIB_PREFIX @@ -1935,10 +1935,10 @@ provided for this purpose. (F) You tried to do a read/write/send/recv operation with a buffer length that is less than 0. This is difficult to imagine. -=item Nested quantifiers at ===HERE=== in regex m/%s/ +=item Nested quantifiers before << HERE in regex m/%s/ (F) You can't quantify a quantifier without intervening parentheses. So -things like ** or +* or ?* are illegal. The ===HERE=== shows in the regular +things like ** or +* or ?* are illegal. The << HERE shows in the regular expression about where the problem was discovered. Note, however, that the minimal matching quantifiers, C<*?>, C<+?>, and @@ -2704,13 +2704,13 @@ in L. (S unsafe) The subroutine being declared or defined had previously been declared or defined with a different function prototype. -=item Quantifier in {,} bigger than %d at ===HERE=== in regex m/%s/ +=item Quantifier in {,} bigger than %d before << HERE in regex m/%s/ (F) There is currently a limit to the size of the min and max values of the -{min,max} construct. The ===HERE=== shows in the regular expression about where +{min,max} construct. The << HERE shows in the regular expression about where the problem was discovered. See L. -=item Quantifier unexpected on zero-length expression at ===HERE=== in regex m/%s/ +=item Quantifier unexpected on zero-length expression before << HERE in regex m/%s/ (W regexp) You applied a regular expression quantifier in a place where it makes no sense, such as on a zero-width assertion. Try putting the @@ -2778,14 +2778,14 @@ Doing so has no effect. (W internal) The internal sv_replace() function was handed a new SV with a reference count of other than 1. -=item Reference to nonexistant group at ===HERE=== in regex m/%s/ +=item Reference to nonexistant group before << HERE in regex m/%s/ (F) You used something like C<\7> in your regular expression, but there are not at least seven sets of capturing parentheses in the expression. If you wanted to have the character with value 7 inserted into the regular expression, prepend a zero to make the number at least two digits: C<\07> -The ===HERE=== shows in the regular expression about where the problem was +The << HERE shows in the regular expression about where the problem was discovered. =item regexp memory corruption @@ -2890,9 +2890,9 @@ scalar that had previously been marked as free. (W closed) The socket you're sending to got itself closed sometime before now. Check your logic flow. -=item Sequence (? incomplete at ===HERE=== mark in regex m/%s/ +=item Sequence (? incomplete before << HERE mark in regex m/%s/ -(F) A regular expression ended with an incomplete extension (?. The ===HERE=== +(F) A regular expression ended with an incomplete extension (?. The <<. @@ -2901,16 +2901,16 @@ L. (F) If the contents of a (?{...}) clause contains braces, they must balance for Perl to properly detect the end of the clause. See L. -=item Sequence (?%s...) not implemented at ===HERE=== mark in regex m/%s/ +=item Sequence (?%s...) not implemented before << HERE mark in regex m/%s/ (F) A proposed regular expression extension has the character reserved but -has not yet been written. The ===HERE=== shows in the regular expression about +has not yet been written. The << HERE shows in the regular expression about where the problem was discovered. See L. -=item Sequence (?%s...) not recognized at ===HERE=== mark in regex m/%s/ +=item Sequence (?%s...) not recognized before << HERE mark in regex m/%s/ (F) You used a regular expression extension that doesn't make sense. -The ===HERE=== shows in the regular expression about +The << HERE shows in the regular expression about where the problem was discovered. See L. @@ -3098,7 +3098,7 @@ assignment or as a subroutine argument for example). (F) Your Perl was compiled with B<-D>SETUID_SCRIPTS_ARE_SECURE_NOW, but a version of the setuid emulator somehow got run anyway. -=item Switch (?(condition)... contains too many branches at ===HERE=== in regex m/%s/ +=item Switch (?(condition)... contains too many branches before << HERE in regex m/%s/ (F) A (?(condition)if-clause|else-clause) construct can have at most two branches (the if-clause and the else-clause). If you want one or both to @@ -3107,13 +3107,13 @@ clustering parentheses: (?(condition)(?:this|that|other)|else-clause) -The ===HERE=== shows in the regular expression about where the problem was +The << HERE shows in the regular expression about where the problem was discovered. See L. -=item Switch condition not recognized at ===HERE=== in regex m/%s/ +=item Switch condition not recognized before << HERE in regex m/%s/ (F) If the argument to the (?(...)if-clause|else-clause) construct is a -number, it can be only a number. The ===HERE=== shows in the regular expression +number, it can be only a number. The << HERE shows in the regular expression about where the problem was discovered. See L. =item switching effective %s is not implemented @@ -3391,7 +3391,7 @@ representative, who probably put it there in the first place. (F) There are no byte-swapping functions for a machine with this byte order. -=item Unknown switch condition (?(%.2s at ===HERE=== in regex m/%s/ +=item Unknown switch condition (?(%.2s before << HERE in regex m/%s/ (F) The condition of a (?(condition)if-clause|else-clause) construct is not known. The condition may be lookaround (the condition is true if the @@ -3399,7 +3399,7 @@ lookaround is true), a (?{...}) construct (the condition is true if the code evaluates to a true value), or a number (the condition is true if the set of capturing parentheses named by the number is defined). -The ===HERE=== shows in the regular expression about where the problem was +The << HERE shows in the regular expression about where the problem was discovered. See L. =item Unknown open() mode '%s' @@ -3415,14 +3415,14 @@ iterating over it, and someone else stuck a message in the stream of data Perl expected. Someone's very confused, or perhaps trying to subvert Perl's population of %ENV for nefarious purposes. -=item unmatched [ at ===HERE=== mark in regex m/%s/ +=item unmatched [ before << HERE mark in regex m/%s/ (F) The brackets around a character class must match. If you wish to include a closing bracket in a character class, backslash it or put it -first. See L. The ===HERE=== shows in the regular expression about +first. See L. The << HERE shows in the regular expression about where the escape was discovered. -=item unmatched ( in regexp at ===HERE=== mark in regex m/%s/ +=item unmatched ( in regexp before << HERE mark in regex m/%s/ (F) Unbackslashed parentheses must always be balanced in regular expressions. If you're a vi user, the % key is valuable for finding the @@ -3454,12 +3454,12 @@ script, a binary program, or a directory as a Perl program. recognized by Perl inside character classes. The character was understood literally. -=item Unrecognized escape \\%c passed through at ===HERE=== in m/%s/ +=item Unrecognized escape \\%c passed through before << HERE in m/%s/ (W regexp) You used a backslash-character combination which is not recognized by Perl. This combination appears in an interpolated variable or a C<'>-delimited regular expression. The character was understood -literally. The ===HERE=== shows in the regular expression about where the escape +literally. The << HERE shows in the regular expression about where the escape was discovered. @@ -3748,10 +3748,10 @@ anonymous, using the C syntax. When inner anonymous subs that reference variables in outer subroutines are called or referenced, they are automatically rebound to the current values of such variables. -=item Variable length lookbehind not implemented at ===HERE=== in regex m/%s/ +=item Variable length lookbehind not implemented before << HERE in regex m/%s/ (F) Lookbehind is allowed only for subexpressions whose length is fixed and -known at compile time. The ===HERE=== shows in the regular expression about where +known at compile time. The << HERE shows in the regular expression about where the problem was discovered. =item Version number must be a constant number diff --git a/regcomp.c b/regcomp.c index 0217657..f0b7c5c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -210,10 +210,10 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, * of t/op/regmesg.t, the tests in t/op/re_tests, and those in * op/pragma/warn/regcomp. */ -#define MARKER1 "=HERE=" /* marker as it appears in the description */ -#define MARKER2 " ===HERE=== " /* marker as it appears within the regex */ +#define MARKER1 "HERE" /* marker as it appears in the description */ +#define MARKER2 " << HERE " /* marker as it appears within the regex */ -#define REPORT_LOCATION " at " MARKER1 " mark in regex m/%.*s" MARKER2 "%s/" +#define REPORT_LOCATION " before " MARKER1 " mark in regex m/%.*s" MARKER2 "%s/" /* * Calls SAVEDESTRUCTOR_X if needed, then calls Perl_croak with the given diff --git a/t/op/misc.t b/t/op/misc.t index e15b653..39719b4 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -346,7 +346,7 @@ print "you die joe!\n" unless "@x" eq 'x y z'; /(?{"{"})/ # Check it outside of eval too EXPECT Sequence (?{...}) not terminated or not {}-balanced at - line 1, within pattern -Sequence (?{...}) not terminated or not {}-balanced at =HERE= mark in regex m/(?{ ===HERE=== "{"})/ at - line 1. +Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/(?{ << HERE "{"})/ at - line 1. ######## /(?{"{"}})/ # Check it outside of eval too EXPECT diff --git a/t/op/re_tests b/t/op/re_tests index 4add4dc..c2753e5 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -45,9 +45,9 @@ a[b-d]e ace y $& ace a[b-d] aac y $& ac a[-b] a- y $& a- a[b-] a- y $& a- -a[b-a] - c - Invalid [] range "b-a" at =HERE= mark in regex m/a[b-a ===HERE=== ]/ -a[]b - c - Unmatched [ at =HERE= mark in regex m/a[ ===HERE=== ]b/ at (eval 96) line 1, line 49. -a[ - c - Unmatched [ at =HERE= mark in regex m/a[ ===HERE=== / at (eval 97) line 1, line 50. +a[b-a] - c - Invalid [] range "b-a" before HERE mark in regex m/a[b-a << HERE ]/ +a[]b - c - Unmatched [ before HERE mark in regex m/a[ << HERE ]b/ at (eval 96) line 1, line 49. +a[ - c - Unmatched [ before HERE mark in regex m/a[ << HERE / at (eval 97) line 1, line 50. a] a] y $& a] a[]]b a]b y $& a]b a[^bc]d aed y $& aed @@ -95,21 +95,21 @@ a[\S]b a-b y - - ab|cd abc y $& ab ab|cd abcd y $& ab ()ef def y $&-$1 ef- -*a - c - Quantifier follows nothing at =HERE= mark in regex m/* ===HERE=== a/ at (eval 192) line 1, line 98. -(*)b - c - Quantifier follows nothing at =HERE= mark in regex m/(* ===HERE=== )b/ at (eval 193) line 1, line 99. +*a - c - Quantifier follows nothing before HERE mark in regex m/* << HERE a/ at (eval 192) line 1, line 98. +(*)b - c - Quantifier follows nothing before HERE mark in regex m/(* << HERE )b/ at (eval 193) line 1, line 99. $b b n - - a\ - c - Search pattern not terminated a\(b a(b y $&-$1 a(b- a\(*b ab y $& ab a\(*b a((b y $& a((b a\\b a\b y $& a\b -abc) - c - Unmatched ) at =HERE= mark in regex m/abc) ===HERE=== / at (eval 205) line 1, line 106. -(abc - c - Unmatched ( at =HERE= mark in regex m/( ===HERE=== abc/ at (eval 206) line 1, line 107. +abc) - c - Unmatched ) before HERE mark in regex m/abc) << HERE / at (eval 205) line 1, line 106. +(abc - c - Unmatched ( before HERE mark in regex m/( << HERE abc/ at (eval 206) line 1, line 107. ((a)) abc y $&-$1-$2 a-a-a (a)b(c) abc y $&-$1-$2 abc-a-c a+b+c aabbabc y $& abc a{1,}b{1,}c aabbabc y $& abc -a** - c - Nested quantifiers at =HERE= mark in regex m/a** ===HERE=== / at (eval 215) line 1, line 112. +a** - c - Nested quantifiers before HERE mark in regex m/a** << HERE / at (eval 215) line 1, line 112. a.+?c abcabc y $& abc (a+|b)* ab y $&-$1 ab-b (a+|b){0,} ab y $&-$1 ab-b @@ -117,7 +117,7 @@ a.+?c abcabc y $& abc (a+|b){1,} ab y $&-$1 ab-b (a+|b)? ab y $&-$1 a-a (a+|b){0,1} ab y $&-$1 a-a -)( - c - Unmatched ) at =HERE= mark in regex m/) ===HERE=== (/ at (eval 230) line 1, line 120. +)( - c - Unmatched ) before HERE mark in regex m/) << HERE (/ at (eval 230) line 1, line 120. [^ab]* cde y $& cde abc n - - a* y $& @@ -218,9 +218,9 @@ a[-]?c ac y $& ac 'a[b-d]'i AAC y $& AC 'a[-b]'i A- y $& A- 'a[b-]'i A- y $& A- -'a[b-a]'i - c - Invalid [] range "b-a" at =HERE= mark in regex m/a[b-a ===HERE=== ]/ -'a[]b'i - c - Unmatched [ at =HERE= mark in regex m/a[ ===HERE=== ]b/ at (eval 431) line 1, line 222. -'a['i - c - Unmatched [ at =HERE= mark in regex m/a[ ===HERE=== / at (eval 432) line 1, line 223. +'a[b-a]'i - c - Invalid [] range "b-a" before HERE mark in regex m/a[b-a << HERE ]/ +'a[]b'i - c - Unmatched [ before HERE mark in regex m/a[ << HERE ]b/ at (eval 431) line 1, line 222. +'a['i - c - Unmatched [ before HERE mark in regex m/a[ << HERE / at (eval 432) line 1, line 223. 'a]'i A] y $& A] 'a[]]b'i A]B y $& A]B 'a[^bc]d'i AED y $& AED @@ -232,21 +232,21 @@ a[-]?c ac y $& ac 'ab|cd'i ABC y $& AB 'ab|cd'i ABCD y $& AB '()ef'i DEF y $&-$1 EF- -'*a'i - c - Quantifier follows nothing at =HERE= mark in regex m/* ===HERE=== a/ at (eval 455) line 1, line 235. -'(*)b'i - c - Quantifier follows nothing at =HERE= mark in regex m/(* ===HERE=== )b/ at (eval 456) line 1, line 236. +'*a'i - c - Quantifier follows nothing before HERE mark in regex m/* << HERE a/ at (eval 455) line 1, line 235. +'(*)b'i - c - Quantifier follows nothing before HERE mark in regex m/(* << HERE )b/ at (eval 456) line 1, line 236. '$b'i B n - - 'a\'i - c - Search pattern not terminated 'a\(b'i A(B y $&-$1 A(B- 'a\(*b'i AB y $& AB 'a\(*b'i A((B y $& A((B 'a\\b'i A\B y $& A\B -'abc)'i - c - Unmatched ) at =HERE= mark in regex m/abc) ===HERE=== / at (eval 468) line 1, line 243. -'(abc'i - c - Unmatched ( at =HERE= mark in regex m/( ===HERE=== abc/ at (eval 469) line 1, line 244. +'abc)'i - c - Unmatched ) before HERE mark in regex m/abc) << HERE / at (eval 468) line 1, line 243. +'(abc'i - c - Unmatched ( before HERE mark in regex m/( << HERE abc/ at (eval 469) line 1, line 244. '((a))'i ABC y $&-$1-$2 A-A-A '(a)b(c)'i ABC y $&-$1-$2 ABC-A-C 'a+b+c'i AABBABC y $& ABC 'a{1,}b{1,}c'i AABBABC y $& ABC -'a**'i - c - Nested quantifiers at =HERE= mark in regex m/a** ===HERE=== / at (eval 478) line 1, line 249. +'a**'i - c - Nested quantifiers before HERE mark in regex m/a** << HERE / at (eval 478) line 1, line 249. 'a.+?c'i ABCABC y $& ABC 'a.*?c'i ABCABC y $& ABC 'a.{0,5}?c'i ABCABC y $& ABC @@ -257,7 +257,7 @@ a[-]?c ac y $& ac '(a+|b)?'i AB y $&-$1 A-A '(a+|b){0,1}'i AB y $&-$1 A-A '(a+|b){0,1}?'i AB y $&-$1 - -')('i - c - Unmatched ) at =HERE= mark in regex m/) ===HERE=== (/ at (eval 499) line 1, line 260. +')('i - c - Unmatched ) before HERE mark in regex m/) << HERE (/ at (eval 499) line 1, line 260. '[^ab]*'i CDE y $& CDE 'abc'i n - - 'a*'i y $& @@ -346,7 +346,7 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce (? line 400. -a(?{{})b - c - Sequence (?{...}) not terminated or not {}-balanced at =HERE= mark in regex m/a(?{ ===HERE=== {})b/ at (eval 781) line 1, line 401. +a(?{)b - c - Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/a(?{ << HERE )b/ at (eval 780) line 1, line 400. +a(?{{})b - c - Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/a(?{ << HERE {})b/ at (eval 781) line 1, line 401. a(?{}})b - c - -a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced at =HERE= mark in regex m/a(?{ ===HERE=== "{"})b/ at (eval 783) line 1, line 403. +a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/a(?{ << HERE "{"})b/ at (eval 783) line 1, line 403. a(?{"\{"})b cabd y $& ab a(?{"{"}})b - c - Unmatched right curly bracket a(?{$bl="\{"}).b caxbd y $bl { @@ -441,7 +441,7 @@ x(~~)*(?:(?:F)?)? x~~ y - - ^(\(+)?blah(?(1)(\)))$ blah y ($2) () ^(\(+)?blah(?(1)(\)))$ blah) n - - ^(\(+)?blah(?(1)(\)))$ (blah n - - -(?(1?)a|b) a c - Switch condition not recognized at =HERE= mark in regex m/(?(1? ===HERE=== )a|b)/ at (eval 868) line 1, line 444. +(?(1?)a|b) a c - Switch condition not recognized before HERE mark in regex m/(?(1? << HERE )a|b)/ at (eval 868) line 1, line 444. (?(1)a|b|c) a c - Switch (?(condition)... contains too many branches (?(?{0})a|b) a n - - (?(?{0})b|a) a y $& a @@ -473,10 +473,10 @@ $(?<=^(a)) a y $1 a ([[:]+) a:[b]: y $1 :[ ([[=]+) a=[b]= y $1 =[ ([[.]+) a.[b]. y $1 .[ -[a[:xyz: - c - Unmatched [ at =HERE= mark in regex m/[ ===HERE=== a[:xyz:/ at (eval 950) line 1, line 476. -[a[:xyz:] - c - POSIX class [:xyz:] unknown at =HERE= mark in regex m/[a[:xyz:] ===HERE=== / +[a[:xyz: - c - Unmatched [ before HERE mark in regex m/[ << HERE a[:xyz:/ at (eval 950) line 1, line 476. +[a[:xyz:] - c - POSIX class [:xyz:] unknown before HERE mark in regex m/[a[:xyz:] << HERE / [a[:]b[:c] abc y $& abc -([a[:xyz:]b]+) pbaq c - POSIX class [:xyz:] unknown at =HERE= mark in regex m/([a[:xyz:] ===HERE=== b]+)/ +([a[:xyz:]b]+) pbaq c - POSIX class [:xyz:] unknown before HERE mark in regex m/([a[:xyz:] << HERE b]+)/ [a[:]b[:c] abc y $& abc ([[:alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd ([[:alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy @@ -503,8 +503,8 @@ $(?<=^(a)) a y $1 a ([[:^word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 -- ${nulnul}${ffff} ([[:^upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 cd01 ([[:^xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 Xy__-- ${nulnul}${ffff} -[[:foo:]] - c - POSIX class [:foo:] unknown at =HERE= mark in regex m/[[:foo:] ===HERE=== ]/ -[[:^foo:]] - c - POSIX class [:^foo:] unknown at =HERE= mark in regex m/[[:^foo:] ===HERE=== ]/ +[[:foo:]] - c - POSIX class [:foo:] unknown before HERE mark in regex m/[[:foo:] << HERE ]/ +[[:^foo:]] - c - POSIX class [:^foo:] unknown before HERE mark in regex m/[[:^foo:] << HERE ]/ ((?>a+)b) aaab y $1 aaab (?>(a+))b aaab y $1 aaa ((?>[^()]+)|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x diff --git a/t/op/regmesg.t b/t/op/regmesg.t index 2aaca5c..2267206 100644 --- a/t/op/regmesg.t +++ b/t/op/regmesg.t @@ -13,8 +13,8 @@ my $debug = 1; ## arrays below. The {#} is a meta-marker -- it marks where the marker should ## go. -my $marker1 = "=HERE="; -my $marker2 = " ===HERE=== "; +my $marker1 = "HERE"; +my $marker2 = " << HERE "; ## ## Key-value pairs of code/error of code that should have fatal errors. @@ -26,77 +26,77 @@ my $inf_m1 = ($Config{reg_infty} || 32767) - 1; my $inf_p1 = $inf_m1 + 2; my @death = ( - '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions at {#} mark in regex m/[[=foo=]{#}]/', + '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=foo=]{#}]/', - '/(?<= .*)/' => 'Variable length lookbehind not implemented at {#} mark in regex m/(?<= .*){#}/', + '/(?<= .*)/' => 'Variable length lookbehind not implemented before {#} mark in regex m/(?<= .*){#}/', - '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented at {#} mark in regex m/(?<= x{1000}){#}/', + '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented before {#} mark in regex m/(?<= x{1000}){#}/', - '/(?@)/' => 'Sequence (?@...) not implemented at {#} mark in regex m/(?@{#})/', + '/(?@)/' => 'Sequence (?@...) not implemented before {#} mark in regex m/(?@{#})/', - '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced at {#} mark in regex m/(?{{#} 1/', + '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced before {#} mark in regex m/(?{{#} 1/', - '/(?(1x))/' => 'Switch condition not recognized at {#} mark in regex m/(?(1x{#}))/', + '/(?(1x))/' => 'Switch condition not recognized before {#} mark in regex m/(?(1x{#}))/', - '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches at {#} mark in regex m/(?(1)x|y|{#}z)/', + '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches before {#} mark in regex m/(?(1)x|y|{#}z)/', - '/(?(x)y|x)/' => 'Unknown switch condition (?(x) at {#} mark in regex m/(?({#}x)y|x)/', + '/(?(x)y|x)/' => 'Unknown switch condition (?(x) before {#} mark in regex m/(?({#}x)y|x)/', - '/(?/' => 'Sequence (? incomplete at {#} mark in regex m/(?{#}/', + '/(?/' => 'Sequence (? incomplete before {#} mark in regex m/(?{#}/', - '/(?;x/' => 'Sequence (?;...) not recognized at {#} mark in regex m/(?;{#}x/', - '/(?<;x/' => 'Sequence (?<;...) not recognized at {#} mark in regex m/(?<;{#}x/', + '/(?;x/' => 'Sequence (?;...) not recognized before {#} mark in regex m/(?;{#}x/', + '/(?<;x/' => 'Sequence (?<;...) not recognized before {#} mark in regex m/(?<;{#}x/', - '/((x)/' => 'Unmatched ( at {#} mark in regex m/({#}(x)/', + '/((x)/' => 'Unmatched ( before {#} mark in regex m/({#}(x)/', - "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 at {#} mark in regex m/x{{#}$inf_p1}/", + "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 before {#} mark in regex m/x{{#}$inf_p1}/", - '/x{3,1}/' => 'Can\'t do {n,m} with n > m at {#} mark in regex m/x{3,1}{#}/', + '/x{3,1}/' => 'Can\'t do {n,m} with n > m before {#} mark in regex m/x{3,1}{#}/', - '/x**/' => 'Nested quantifiers at {#} mark in regex m/x**{#}/', + '/x**/' => 'Nested quantifiers before {#} mark in regex m/x**{#}/', - '/x[/' => 'Unmatched [ at {#} mark in regex m/x[{#}/', + '/x[/' => 'Unmatched [ before {#} mark in regex m/x[{#}/', - '/*/', => 'Quantifier follows nothing at {#} mark in regex m/*{#}/', + '/*/', => 'Quantifier follows nothing before {#} mark in regex m/*{#}/', - '/\p{x/' => 'Missing right brace on \p{} at {#} mark in regex m/\p{{#}x/', + '/\p{x/' => 'Missing right brace on \p{} before {#} mark in regex m/\p{{#}x/', - 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} at {#} mark in regex m/[\p{{#}x]/', + 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} before {#} mark in regex m/[\p{{#}x]/', - '/(x)\2/' => 'Reference to nonexistent group at {#} mark in regex m/(x)\2{#}/', + '/(x)\2/' => 'Reference to nonexistent group before {#} mark in regex m/(x)\2{#}/', 'my $m = chr(92); $m =~ $m', => 'Trailing \ in regex m/\/', - '/\x{1/' => 'Missing right brace on \x{} at {#} mark in regex m/\x{{#}1/', + '/\x{1/' => 'Missing right brace on \x{} before {#} mark in regex m/\x{{#}1/', - 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} at {#} mark in regex m/[\x{{#}X]/', + 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} before {#} mark in regex m/[\x{{#}X]/', - '/\x{x}/' => 'Can\'t use \x{} without \'use utf8\' declaration at {#} mark in regex m/\x{x}{#}/', + '/\x{x}/' => 'Can\'t use \x{} without \'use utf8\' declaration before {#} mark in regex m/\x{x}{#}/', - '/[[:barf:]]/' => 'POSIX class [:barf:] unknown at {#} mark in regex m/[[:barf:]{#}]/', + '/[[:barf:]]/' => 'POSIX class [:barf:] unknown before {#} mark in regex m/[[:barf:]{#}]/', - '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions at {#} mark in regex m/[[=barf=]{#}]/', + '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=barf=]{#}]/', - '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions at {#} mark in regex m/[[.barf.]{#}]/', + '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions before {#} mark in regex m/[[.barf.]{#}]/', - '/[z-a]/' => 'Invalid [] range "z-a" at {#} mark in regex m/[z-a{#}]/', + '/[z-a]/' => 'Invalid [] range "z-a" before {#} mark in regex m/[z-a{#}]/', ); ## ## Key-value pairs of code/error of code that should have non-fatal warnings. ## @warning = ( - "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) at {#} mark in regex m/(?p{#}{ 'a' })/", + "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) before {#} mark in regex m/(?p{#}{ 'a' })/", - 'm/\b*/' => '\b* matches null string many times at {#} mark in regex m/\b*{#}/', + 'm/\b*/' => '\b* matches null string many times before {#} mark in regex m/\b*{#}/', - 'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes at {#} mark in regex m/[:blank:]{#}/', + 'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes before {#} mark in regex m/[:blank:]{#}/', - "m'[\\y]'" => 'Unrecognized escape \y in character class passed through at {#} mark in regex m/[\y{#}]/', + "m'[\\y]'" => 'Unrecognized escape \y in character class passed through before {#} mark in regex m/[\y{#}]/', - 'm/[a-\d]/' => 'False [] range "a-\d" at {#} mark in regex m/[a-\d{#}]/', - 'm/[\w-x]/' => 'False [] range "\w-" at {#} mark in regex m/[\w-{#}x]/', - "m'\\y'" => 'Unrecognized escape \y passed through at {#} mark in regex m/\y{#}/', + 'm/[a-\d]/' => 'False [] range "a-\d" before {#} mark in regex m/[a-\d{#}]/', + 'm/[\w-x]/' => 'False [] range "\w-" before {#} mark in regex m/[\w-{#}x]/', + "m'\\y'" => 'Unrecognized escape \y passed through before {#} mark in regex m/\y{#}/', ); my $total = (@death + @warning)/2; diff --git a/t/pragma/warn/regcomp b/t/pragma/warn/regcomp index fd12445..59076d5 100644 --- a/t/pragma/warn/regcomp +++ b/t/pragma/warn/regcomp @@ -29,7 +29,7 @@ $a =~ /(?=a)*/ ; no warnings 'regexp' ; $a =~ /(?=a)*/ ; EXPECT -(?=a)* matches null string many times at =HERE= mark in regex m/(?=a)* ===HERE=== / at - line 4. +(?=a)* matches null string many times before HERE mark in regex m/(?=a)* << HERE / at - line 4. ######## # regcomp.c [S_study_chunk] use warnings 'regexp' ; @@ -38,7 +38,7 @@ $_ = "" ; no warnings 'regexp' ; /(?=a)?/; EXPECT -Quantifier unexpected on zero-length expression at =HERE= mark in regex m/(?=a)? ===HERE=== / at - line 4. +Quantifier unexpected on zero-length expression before HERE mark in regex m/(?=a)? << HERE / at - line 4. ######## # regcomp.c [S_regatom] $x = '\m' ; @@ -47,7 +47,7 @@ $a =~ /a$x/ ; no warnings 'regexp' ; $a =~ /a$x/ ; EXPECT -Unrecognized escape \m passed through at =HERE= mark in regex m/a\m ===HERE=== / at - line 4. +Unrecognized escape \m passed through before HERE mark in regex m/a\m << HERE / at - line 4. ######## # regcomp.c [S_regpposixcc S_checkposixcc] BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 } @@ -61,9 +61,9 @@ no warnings 'regexp' ; /[:zog:]/; /[[:zog:]]/; EXPECT -POSIX syntax [: :] belongs inside character classes at =HERE= mark in regex m/[:alpha:] ===HERE=== / at - line 5. -POSIX syntax [: :] belongs inside character classes at =HERE= mark in regex m/[:zog:] ===HERE=== / at - line 6. -POSIX class [:zog:] unknown at =HERE= mark in regex m/[[:zog:] ===HERE=== ]/ +POSIX syntax [: :] belongs inside character classes before HERE mark in regex m/[:alpha:] << HERE / at - line 5. +POSIX syntax [: :] belongs inside character classes before HERE mark in regex m/[:zog:] << HERE / at - line 6. +POSIX class [:zog:] unknown before HERE mark in regex m/[[:zog:] << HERE ]/ ######## # regcomp.c [S_checkposixcc] BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 } @@ -73,8 +73,8 @@ $_ = "" ; no warnings 'regexp' ; /[.zog.]/; EXPECT -POSIX syntax [. .] belongs inside character classes at =HERE= mark in regex m/[.zog.] ===HERE=== / at - line 5. -POSIX syntax [. .] is reserved for future extensions at =HERE= mark in regex m/[.zog.] ===HERE=== / +POSIX syntax [. .] belongs inside character classes before HERE mark in regex m/[.zog.] << HERE / at - line 5. +POSIX syntax [. .] is reserved for future extensions before HERE mark in regex m/[.zog.] << HERE / ######## # regcomp.c [S_checkposixcc] BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 } @@ -84,7 +84,7 @@ $_ = "" ; no warnings 'regexp' ; /[[.zog.]]/; EXPECT -POSIX syntax [. .] is reserved for future extensions at =HERE= mark in regex m/[[.zog.] ===HERE=== ]/ +POSIX syntax [. .] is reserved for future extensions before HERE mark in regex m/[[.zog.] << HERE ]/ ######## # regcomp.c [S_regclass] $_ = ""; @@ -109,14 +109,14 @@ no warnings 'regexp' ; /[[:alpha:]-[:digit:]]/; /[[:digit:]-[:alpha:]]/; EXPECT -False [] range "a-\d" at =HERE= mark in regex m/[a-\d ===HERE=== ]/ at - line 5. -False [] range "\d-" at =HERE= mark in regex m/[\d- ===HERE=== b]/ at - line 6. -False [] range "\s-" at =HERE= mark in regex m/[\s- ===HERE=== \d]/ at - line 7. -False [] range "\d-" at =HERE= mark in regex m/[\d- ===HERE=== \s]/ at - line 8. -False [] range "a-[:digit:]" at =HERE= mark in regex m/[a-[:digit:] ===HERE=== ]/ at - line 9. -False [] range "[:digit:]-" at =HERE= mark in regex m/[[:digit:]- ===HERE=== b]/ at - line 10. -False [] range "[:alpha:]-" at =HERE= mark in regex m/[[:alpha:]- ===HERE=== [:digit:]]/ at - line 11. -False [] range "[:digit:]-" at =HERE= mark in regex m/[[:digit:]- ===HERE=== [:alpha:]]/ at - line 12. +False [] range "a-\d" before HERE mark in regex m/[a-\d << HERE ]/ at - line 5. +False [] range "\d-" before HERE mark in regex m/[\d- << HERE b]/ at - line 6. +False [] range "\s-" before HERE mark in regex m/[\s- << HERE \d]/ at - line 7. +False [] range "\d-" before HERE mark in regex m/[\d- << HERE \s]/ at - line 8. +False [] range "a-[:digit:]" before HERE mark in regex m/[a-[:digit:] << HERE ]/ at - line 9. +False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE b]/ at - line 10. +False [] range "[:alpha:]-" before HERE mark in regex m/[[:alpha:]- << HERE [:digit:]]/ at - line 11. +False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE [:alpha:]]/ at - line 12. ######## # regcomp.c [S_regclassutf8] BEGIN { @@ -148,14 +148,14 @@ no warnings 'regexp' ; /[[:alpha:]-[:digit:]]/; /[[:digit:]-[:alpha:]]/; EXPECT -False [] range "a-\d" at =HERE= mark in regex m/[a-\d ===HERE=== ]/ at - line 12. -False [] range "\d-" at =HERE= mark in regex m/[\d- ===HERE=== b]/ at - line 13. -False [] range "\s-" at =HERE= mark in regex m/[\s- ===HERE=== \d]/ at - line 14. -False [] range "\d-" at =HERE= mark in regex m/[\d- ===HERE=== \s]/ at - line 15. -False [] range "a-[:digit:]" at =HERE= mark in regex m/[a-[:digit:] ===HERE=== ]/ at - line 16. -False [] range "[:digit:]-" at =HERE= mark in regex m/[[:digit:]- ===HERE=== b]/ at - line 17. -False [] range "[:alpha:]-" at =HERE= mark in regex m/[[:alpha:]- ===HERE=== [:digit:]]/ at - line 18. -False [] range "[:digit:]-" at =HERE= mark in regex m/[[:digit:]- ===HERE=== [:alpha:]]/ at - line 19. +False [] range "a-\d" before HERE mark in regex m/[a-\d << HERE ]/ at - line 12. +False [] range "\d-" before HERE mark in regex m/[\d- << HERE b]/ at - line 13. +False [] range "\s-" before HERE mark in regex m/[\s- << HERE \d]/ at - line 14. +False [] range "\d-" before HERE mark in regex m/[\d- << HERE \s]/ at - line 15. +False [] range "a-[:digit:]" before HERE mark in regex m/[a-[:digit:] << HERE ]/ at - line 16. +False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE b]/ at - line 17. +False [] range "[:alpha:]-" before HERE mark in regex m/[[:alpha:]- << HERE [:digit:]]/ at - line 18. +False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE [:alpha:]]/ at - line 19. ######## # regcomp.c [S_regclass S_regclassutf8] use warnings 'regexp' ; @@ -163,5 +163,5 @@ $a =~ /[a\zb]/ ; no warnings 'regexp' ; $a =~ /[a\zb]/ ; EXPECT -Unrecognized escape \z in character class passed through at =HERE= mark in regex m/[a\z ===HERE=== b]/ at - line 3. +Unrecognized escape \z in character class passed through before HERE mark in regex m/[a\z << HERE b]/ at - line 3.