In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/c608e803deefdbeca9961ca4913f4addb6bb3ae0?hp=da1f5b59634bdfea59787843016be4809df50836>
- Log ----------------------------------------------------------------- commit c608e803deefdbeca9961ca4913f4addb6bb3ae0 Author: Karl Williamson <[email protected]> Date: Mon Mar 18 12:13:46 2013 -0600 pod/perldiag: Document some regex messages M pod/perldiag.pod M t/porting/diag.t commit 0d0b4b3bcdca1518f23f812b554dc4edc23dfb15 Author: Karl Williamson <[email protected]> Date: Sun Mar 17 19:36:39 2013 -0600 pod/perldiag: Document new messages for qr/(?[ ])/ M pod/perldiag.pod M t/porting/diag.t commit 9b73678dbbd06e700aa59a369b47be44fed1fb55 Author: Karl Williamson <[email protected]> Date: Sun Mar 17 18:51:40 2013 -0600 perldiag: Nits M pod/perldiag.pod commit 93f313efce5af0afe7c5f9bdca84a71149a9f321 Author: Karl Williamson <[email protected]> Date: Sun Mar 17 11:46:45 2013 -0600 pod/perlre: Italicize text to indicate non-literal Also, changes a reference to the section into an actual link. M pod/perlre.pod commit 982c4ecb0121ffb412a0c6a3bd4b9a8b95318f76 Author: Karl Williamson <[email protected]> Date: Sun Mar 17 11:32:52 2013 -0600 perldiag.pod: Fix broken link M pod/perldiag.pod M t/porting/known_pod_issues.dat ----------------------------------------------------------------------- Summary of changes: pod/perldiag.pod | 256 +++++++++++++++++++++++++++++++++++++++- pod/perlre.pod | 16 ++- t/porting/diag.t | 25 ---- t/porting/known_pod_issues.dat | 1 - 4 files changed, 259 insertions(+), 39 deletions(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 3f0397c..8d29e2d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -789,7 +789,7 @@ is no builtin with the name C<word>. (F) You used C<\p{}> or C<\P{}> but the character property by that name could not be found. Maybe you misspelled the name of the property? See L<perluniprops/Properties accessible through \p{} and \P{}> -for a complete list of available properties. +for a complete list of available official properties. =item Can't find label %s @@ -1596,6 +1596,13 @@ valid magic number. (P) The malloc package that comes with Perl had an internal failure. +=item Corrupted regexp opcode %d > %d + +(F) +This is either an error in Perl, or, if you're using one, your +L<custom regular expression engine|perlreapi>. If not the latter, +report the problem through the L<perlbug> utility. + =item Count after length/code in unpack (F) You had an unpack template indicating a counted-length string, but @@ -1783,7 +1790,7 @@ it's ugly. Your code will be interpreted as an attempt to call a method named "elseif" for the class returned by the following block. This is unlikely to be what you want. -=item Empty %s +=item Empty \%c{} in regex; marked by <-- HERE in m/%s/ (F) C<\p> and C<\P> are used to introduce a named Unicode property, as described in L<perlunicode> and L<perlre>. You used C<\p> or C<\P> in @@ -1898,6 +1905,17 @@ as a goto, or a loop control statement. (W exiting) You are exiting a substitution by unconventional means, such as a return, a goto, or a loop control statement. +=item Expecting close bracket in regex; marked by <-- HERE in m/%s/ + +(F) +You wrote something like + + (?13 + +to denote a capturing group of the form +L<C<(?I<PARNO>)>|perlre/(?PARNO) (?-PARNO) (?+PARNO) (?R) (?0)>, +but omitted the C<")">. + =item Experimental "%s" subs not enabled (F) To use lexical subs, you must first enable them: @@ -2242,6 +2260,17 @@ two from 1 to 32 (or 64, if your platform supports that). (W digit) You may have tried to use an 8 or 9 in an octal number. Interpretation of the octal number stopped before the 8 or 9. +=item Illegal pattern in regex; marked by <-- HERE in m/%s/ + +(F) +You wrote something like + + (?+foo) + +The C<"+"> is valid only when followed by digits, indicating a +capturing group. See +L<C<(?I<PARNO>)>|perlre/(?PARNO) (?-PARNO) (?+PARNO) (?R) (?0)>. + =item Illegal switch in PERL5OPT: -%c (X) The PERL5OPT environment variable may only be used to set the @@ -2271,6 +2300,14 @@ would otherwise result in the same message being repeated. Failure of user callbacks dispatched using the C<G_KEEPERR> flag could also result in this warning. See L<perlcall/G_KEEPERR>. +=item Incomplete expression within '(?[ ])' in regex; marked by <-- HERE in m/%s/ + +(F) +There was a syntax error within the C<(?[ ])>. This can happen if the +expression inside the construct was completely empty, or if there are +too many or few operands for the number of operators. Perl is not smart +enough to give you a more precise indication as to what is wrong. + =item Inconsistent hierarchy during C3 merge of class '%s': merging failed on parent '%s' @@ -2408,6 +2445,18 @@ by Perl or by a user-supplied handler. See L<attributes>. (F) The indicated attributes for a subroutine or variable were not recognized by Perl or by a user-supplied handler. See L<attributes>. +=item Invalid [] range "%*.*s" in regex; marked by <-- HERE in m/%s/ + +(F) +You wrote something like + + [z-a] + +in a regular expression pattern. Ranges must be specified with the +lowest code point first. Instead write + + [a-z] + =item Invalid character in \N{...}; marked by <-- HERE in \N{%s} (F) Only certain characters are valid for character names. The @@ -2467,7 +2516,7 @@ character (U+FFFD). (S debugging) Perl was called with invalid debugger flags. Call perl with the B<-D> option with no flags to see the list of acceptable values. -See also L<perlrun/B<-D>I<letters>>. +See also L<perlrun/-Dletters>. =item Invalid [] range "%s" in regex; marked by <-- HERE in m/%s/ @@ -3053,6 +3102,25 @@ C<\N> is separated by spaces from the C<{>, in which case, remove the spaces. /\N {SPACE}/x; # Wrong! /\N{SPACE}/x; # ok +=item Need exactly 3 octal digits in regex; marked by <-- HERE in m/%s/ + +(F) Within S<C<(?[ ])>>, all constants interpreted as octal need to be +exactly 3 digits long. This helps catch some ambiguities. If your +constant is too short, add leading zeros, like + + (?[ [ \078 ] ]) # Syntax error! + (?[ [ \0078 ] ]) # Works + (?[ [ \007 8 ] ]) # Clearer + +The maximum number this construct can express is C<\777>. If you +need a larger one, you need to use L<\o{}|perlrebackslash/Octal escapes> +instead. If you meant two separate things, you need to separate them + + (?[ [ \7776 ] ]) # Syntax error! + (?[ [ \o{7776} ] ]) # One meaning + (?[ [ \777 6 ] ]) # Another meaning + (?[ [ \777 \006 ] ]) # Still another + =item Negative '/' count in unpack (F) The length count obtained from a length/code unpack operation was @@ -3317,18 +3385,43 @@ to UTC. If it's not, define the logical name F<SYS$TIMEZONE_DIFFERENTIAL> to translate to the number of seconds which need to be added to UTC to get local time. +=item Non-hex character in regex; marked by <-- HERE in m/%s/ + +(F) +In a regular expression, there was a non-hexadecimal character where +a hex one was expected, like + + (?[ [ \xDG ] ]) + (?[ [ \x{DEKA} ] ]) + =item Non-octal character '%c'. Resolved as "%s" (W digit) In parsing an octal numeric constant, a character was unexpectedly encountered that isn't octal. The resulting value is as indicated. +=item Non-octal character in regex; marked by <-- HERE in m/%s/ + +(F) +In a regular expression, there was a non-octal character where +an octal one was expected, like + + (?[ [ \o{1278} ] ]) + =item Non-string passed as bitmask (W misc) A number has been passed as a bitmask argument to select(). Use the vec() function to construct the file descriptor bitmasks for select. See L<perlfunc/select>. +=item (?[...]) not valid in locale in regex; marked by <-- HERE in m/%s/ + +(F) +C<(?[...])> cannot be used within the scope of a C<S<use locale>> or +with an C</l> regular expression modifier, as that would require +deferring to run-time the calculation of what it should evaluate to, and +it is regex compile-time only. + =item Null filename used (F) You can't require the null filename, especially because on many @@ -3449,6 +3542,16 @@ a symbol (glob or scalar) that already holds a filehandle. Although legal, this idiom might render your code confusing and is deprecated. +=item Operand with no preceding operator in regex; marked by <-- HERE in m/%s/ + +(F) +You wrote something like + + (?[ \p{Digit} \p{Thai} ]) + +There are two operands, but no operator giving how you want to combine +them. + =item Operation "%s": no method found, %s (F) An attempt was made to perform an overloaded operation for which no @@ -3875,7 +3978,7 @@ utility to report; in regex; marked by <-- HERE in m/%s/ case-insensitive matching, and there is a bug in Perl in which the built-in regular expression folding rules are not accurate. This may lead to incorrect results. Please report this as a bug using the -"perlbug" utility. (This message is marked deprecated, so that it by +L<perlbug> utility. (This message is marked deprecated, so that it by default will be turned-on.) =item Perl_my_%s() not available @@ -4120,6 +4223,17 @@ port. One can easily disable this by appropriate sighandlers, see L<perlipc/"Signals">. See also "Process terminated by SIGTERM/SIGINT" in L<perlos2>. +=item Property '%s' is unknown in regex; marked by <-- HERE in m/%s/ + +(F) +The named property which you specified via C<\p> or C<\P> is not one +known to Perl. Perhaps you misspelled the name? See +L<perluniprops/Properties accessible through \p{} and \P{}> +for a complete list of available official properties. If it is a +L<user-defined property|perlunicode/User-Defined Character Properties> +it must have been defined by the time the regular expression is +compiled. + =item Prototype after '%c' for %s : %s (W illegalproto) A character follows % or @ in a prototype. This is @@ -4826,6 +4940,12 @@ or "my $var" or "our $var". (W unopened) You tried to read from a filehandle that was never opened. +=item Syntax error in (?[...]) in regex m/%s/ + +(F) +Perl could not figure out what you meant inside this construct; this +notifies you that it is giving up trying. + =item System V %s is not implemented on this machine (F) You tried to do something with a function beginning with "sem", @@ -4893,6 +5013,18 @@ change or be removed in a future Perl version: use feature "lexical_subs"; my sub foo { ... } +=item The regex_sets feature is experimental + +(S experimental::regex_sets) This warning is emitted if you +use the syntax S<C<(?[ ])>> in a regular expression. +The details of this feature are subject to change. +if you want to use it, but know that in doing so you +are taking the risk of using an experimental feature which may +change in a future Perl version, you can do this to silence the +warning: + + no warnings "experimental::regex_sets"; + =item The %s function is unimplemented (F) The function indicated isn't implemented on this architecture, according @@ -5132,6 +5264,53 @@ Check the #! line, or manually feed your script into Perl yourself. (F) The unexec() routine failed for some reason. See your local FSF representative, who probably put it there in the first place. +=item Unexpected '(' with no preceding operator in regex; marked by <-- HERE in m/%s/ + +(F) +You had something like this: + + (?[ \p{Digit} ( \p{Lao} + \p{Thai} ) ]) + +There should be an operator before the C<"(">, as there's no indication +as to how the digits are to be combined with the characters in the Lao +and Thai scripts. + +=item Unexpected ')' in regex; marked by <-- HERE in m/%s/ + +(F) +You had something like this: + + (?[ ( \p{Digit} + ) ]) + +The C<")"> is out-of-place. Something apparently was supposed to be +combined with the digits, or the C<"+"> shouldn't be there, or something +like that. Perl can't figure out what was intended. + +=item Unexpected binary operator '%c' with no preceding operand in regex; marked by <-- HERE in m/%s/ + +(F) +You had something like this: + + (?[ | \p{Digit} ]) + +where the C<"|"> is a binary operator with an operand on the right, but +no operand on the left. + +=item Unexpected character in regex; marked by <-- HERE in m/%s/ + +(F) +You had something like this: + + (?[ z ]) + +Within C<(?[ ])>, no literal characters are allowed unless they are +within an inner pair of square brackets, like + + (?[ [ z ] ]) + +Another possibility is that you forgot a backslash. Perl isn't smart +enough to figure out what you really meant. + =item Unexpected constant lvalue entersub entry via type/targ %d:%d (P) When compiling a subroutine call in lvalue context, Perl failed an @@ -5260,6 +5439,16 @@ Note that if you want to enable a warnings category registered by a module (e.g. C<use warnings 'File::Find'>), you must have loaded this module first. +=item Unmatched '%c' in POSIX class in regex; marked by <-- HERE in m/%s/ + +You had something like this: + + (?[ [:alnum] ]) + +There should be a second C<":">, like this: + + (?[ [:alnum:] ]) + =item Unmatched [ in regex; marked by <-- HERE in m/%s/ (F) The brackets around a character class must match. If you wish to @@ -5267,6 +5456,17 @@ include a closing bracket in a character class, backslash it or put it first. The <-- HERE shows whereabouts in the regular expression the problem was discovered. See L<perlre>. +=item Unmatched '[' in POSIX class in regex; marked by <-- HERE in m/%s/ + +(F) +You had something like this: + + (?[ [:digit: ]) + +That should be written: + + (?[ [:digit:] ]) + =item Unmatched ( in regex; marked by <-- HERE in m/%s/ =item Unmatched ) in regex; marked by <-- HERE in m/%s/ @@ -5296,6 +5496,13 @@ subroutine. in your Perl script (or eval) near the specified column. Perhaps you tried to run a compressed script, a binary program, or a directory as a Perl program. +=item Unrecognized escape \%c in character class in regex; marked by <-- HERE in m/%s/ + +(F) +You used a backslash-character combination which is not recognized by +Perl inside character classes. This is a fatal error when the character +class is used within C<(?[ ])>. + =item Unrecognized escape \%c in character class passed through in regex; marked by <-- HERE in m/%s/ @@ -5443,6 +5650,23 @@ See L<Win32> for more information. You probably meant to use C<$]> instead. C<$[> is the base for indexing arrays. C<$]> is the Perl version number in decimal. +=item Use \\x{...} for more than two hex characters in regex; marked by <-- HERE in m/%s/ + +(F) +In a regular expression, you said something like + + (?[ [ \xBEEF ] ]) + +Perl isn't sure if you meant this + + (?[ [ \x{BEEF} ] ]) + +or if you meant this + + (?[ [ \x{BE} E F ] ]) + +You need to add either braces or blanks to disambiguate. + =item Useless assignment to a temporary (W misc) You assigned to an lvalue subroutine, but what @@ -5572,6 +5796,12 @@ about. This is not very useful, and perl currently optimizes this away. +=item Useless use of (?-p) in regex; marked by <-- HERE in m/%s/ + +(W regexp) +The C<p> modifier cannot be turned off once set. Trying to do so is +futile. + =item Useless use of %s with no values (W syntax) You used the push() or unshift() function with no arguments @@ -5581,6 +5811,20 @@ possible in principle that push(@tied_array) could have some effect if the array is tied to a class which implements a PUSH method. If so, you can write it as C<push(@tied_array,())> to avoid this warning. +=item Useless (%s%c) - %suse /%c modifier in regex; marked by <-- HERE in m/%s/ + +(W regexp) +The C</g> and C</o> regular expression modifiers are global and can't be +turned off once set; hence things like C<(?g)> or C<(?-o:)> do nothing. + +=item Useless (%sc) - %suse /gc modifier in regex; marked by <-- HERE in m/%s/ + +(W regexp) +The C</c> regular expression modifier is global, can't be turned off +once set, and doesn't do anything without the C</g> modifier being +specified as well; hence things like C<(?c)> or C<(?-c:)> do nothing, +nor do thing like C<(?gc)> nor C<(?-gc:)> . + =item "use" not allowed in expression (F) The "use" keyword is recognized and executed at compile time, and @@ -5980,9 +6224,9 @@ before now. Check your control flow. =item %s "\x%X" does not map to Unicode -(F) When reading in different encodings Perl tries to map everything +(F) When reading in different encodings, Perl tries to map everything into Unicode characters. The bytes you read in are not legal in -this encoding, for example +this encoding. For example utf8 "\xE4" does not map to Unicode diff --git a/pod/perlre.pod b/pod/perlre.pod index 80aa306..e4a0b11 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -1407,14 +1407,16 @@ The following pattern matches a parenthesized group: \) }x; -See also C<(?PARNO)> for a different, more efficient way to accomplish +See also +L<C<(?I<PARNO>)>|/(?PARNO) (?-PARNO) (?+PARNO) (?R) (?0)> +for a different, more efficient way to accomplish the same task. Executing a postponed regular expression 50 times without consuming any input string will result in a fatal error. The maximum depth is compiled into perl, so changing it requires a custom build. -=item C<(?PARNO)> C<(?-PARNO)> C<(?+PARNO)> C<(?R)> C<(?0)> +=item C<(?I<PARNO>)> C<(?-I<PARNO>)> C<(?+I<PARNO>)> C<(?R)> C<(?0)> X<(?PARNO)> X<(?1)> X<(?R)> X<(?0)> X<(?-1)> X<(?+1)> X<(?-PARNO)> X<(?+PARNO)> X<regex, recursive> X<regexp, recursive> X<regular expression, recursive> X<regex, relative recursion> @@ -1426,10 +1428,10 @@ as an independent pattern that must match at the current position. Capture groups contained by the pattern will have the value as determined by the outermost recursion. -PARNO is a sequence of digits (not starting with 0) whose value reflects +I<PARNO> is a sequence of digits (not starting with 0) whose value reflects the paren-number of the capture group to recurse to. C<(?R)> recurses to the beginning of the whole pattern. C<(?0)> is an alternate syntax for -C<(?R)>. If PARNO is preceded by a plus or minus sign then it is assumed +C<(?R)>. If I<PARNO> is preceded by a plus or minus sign then it is assumed to be relative, with negative numbers indicating preceding capture groups and positive ones following. Thus C<(?-1)> refers to the most recently declared group, and C<(?+1)> indicates the next group to be declared. @@ -1493,7 +1495,7 @@ be processed. =item C<(?&NAME)> X<(?&NAME)> -Recurse to a named subpattern. Identical to C<(?PARNO)> except that the +Recurse to a named subpattern. Identical to C<(?I<PARNO>)> except that the parenthesis to recurse to is determined by name. If multiple parentheses have the same name, then it recurses to the leftmost. @@ -2485,10 +2487,10 @@ else in the whole regular expression.) For this grouping operator there is no need to describe the ordering, since only whether or not C<S> can match is important. -=item C<(??{ EXPR })>, C<(?PARNO)> +=item C<(??{ EXPR })>, C<(?I<PARNO>)> The ordering is the same as for the regular expression which is -the result of EXPR, or the pattern contained by capture group PARNO. +the result of EXPR, or the pattern contained by capture group I<PARNO>. =item C<(?(condition)yes-pattern|no-pattern)> diff --git a/t/porting/diag.t b/t/porting/diag.t index 73e5bae..2473e65 100644 --- a/t/porting/diag.t +++ b/t/porting/diag.t @@ -490,18 +490,15 @@ chown not implemented! clear %s Code missing after '/' in pack Code missing after '/' in unpack -Corrupted regexp opcode %d > %d '%c' outside of string in pack Debug leaking scalars child failed%s with errno %d: %s '/' does not take a repeat count in %s Don't know how to get file name Don't know how to handle magic of type \%o -Dp not implemented on this platform -Empty \%c{} in regex; marked by <-- HERE in m/%s/ Error reading "%s": %s execl not implemented! EVAL without pos change exceeded limit in regex -Expecting close bracket in regex; marked by <-- HERE in m/%s/ Filehandle opened only for %sput Filehandle %s opened only for %sput Filehandle STD%s reopened as %s only for input @@ -523,11 +520,9 @@ Illegal binary digit '%c' ignored Illegal character %sin prototype for %s : %s Illegal hexadecimal digit '%c' ignored Illegal octal digit '%c' ignored -Illegal pattern in regex; marked by <-- HERE in m/%s/ Infinite recursion in regex internal %<num>p might conflict with future printf extensions Invalid argument to sv_cat_decode -Invalid [] range "%*.*s" in regex; marked by <-- HERE in m/%s/ Invalid range "%c-%c" in transliteration operator Invalid separator character %c%c%c in PerlIO layer specification %s Invalid TOKEN object ignored @@ -634,26 +629,6 @@ Within []-length '%c' not allowed in %s Wrong syntax (suid) fd script name "%s" 'X' outside of string in %s 'X' outside of string in unpack -Useless (%s%c) - %suse /%c modifier in regex; marked by <-- HERE in m/%s/ -Useless (%sc) - %suse /gc modifier in regex; marked by <-- HERE in m/%s/ -Useless use of (?-p) in regex; marked by <-- HERE in m/%s/ -Unmatched '%c' in POSIX class in regex; marked by <-- HERE in m/%s/ -Unmatched '[' in POSIX class in regex; marked by <-- HERE in m/%s/ -(?[...]) not valid in locale in regex; marked by <-- HERE in m/%s/ -The regex_sets feature is experimental -Syntax error in (?[...]) in regex m/%s/ -Unexpected character in regex; marked by <-- HERE in m/%s/ -Unexpected binary operator '%c' with no preceding operand in regex; marked by <-- HERE in m/%s/ -Unexpected '(' with no preceding operator in regex; marked by <-- HERE in m/%s/ -Unexpected ')' in regex; marked by <-- HERE in m/%s/ -Operand with no preceding operator in regex; marked by <-- HERE in m/%s/ -Property '%s' is unknown in regex; marked by <-- HERE in m/%s/ -Need exactly 3 octal digits in regex; marked by <-- HERE in m/%s/ -Unrecognized escape \%c in character class in regex; marked by <-- HERE in m/%s/ -Incomplete expression within '(?[ ])' in regex; marked by <-- HERE in m/%s/ -Non-octal character in regex; marked by <-- HERE in m/%s/ -Non-hex character in regex; marked by <-- HERE in m/%s/ -Use \\x{...} for more than two hex characters in regex; marked by <-- HERE in m/%s/ __CATEGORIES__ Code point 0x%X is not Unicode, all \p{} matches fail; all \P{} matches succeed diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat index ec3a57f..b9ba876 100644 --- a/t/porting/known_pod_issues.dat +++ b/t/porting/known_pod_issues.dat @@ -223,7 +223,6 @@ pod/perldebguts.pod Verbatim line length including indents exceeds 79 by 34 pod/perldebtut.pod Verbatim line length including indents exceeds 79 by 22 pod/perldebug.pod Verbatim line length including indents exceeds 79 by 3 pod/perldiag.pod =item type mismatch 1 -pod/perldiag.pod Apparent broken link 1 pod/perldsc.pod Verbatim line length including indents exceeds 79 by 4 pod/perldtrace.pod Verbatim line length including indents exceeds 79 by 26 pod/perlebcdic.pod Verbatim line length including indents exceeds 79 by 13 -- Perl5 Master Repository
