diff options
author | Jeffrey Friedl <jfriedl@regex.info> | 2000-08-08 17:59:43 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-09 23:05:47 +0000 |
commit | b45f050a81173020b0089d3ff02fa0276958461a (patch) | |
tree | 9ba9f52c16593c4b22ca597ee69abdc99927555b /pod/perldiag.pod | |
parent | 68d47915e40dc6ab5050a2c749c177f42d1374ff (diff) | |
download | perl-b45f050a81173020b0089d3ff02fa0276958461a.tar.gz |
Re: enhanced(?) regex error messages
Message-Id: <200008090759.AAA07144@ventrue.yahoo.com>
(plus two small patches sent privately)
(this still seems to leave few test failures)
p4raw-id: //depot/perl@6560
Diffstat (limited to 'pod/perldiag.pod')
-rw-r--r-- | pod/perldiag.pod | 218 |
1 files changed, 134 insertions, 84 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index ea6f8931a3..c20d71d568 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -404,7 +404,7 @@ check the return value of your socket() call? See L<perlfunc/bind>. =item Bizarre copy of %s in %s (P) Perl detected an attempt to copy an internal value that is not -copiable. +copyable. =item B<-P> not allowed for setuid/setgid script @@ -563,10 +563,11 @@ 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 +=item Can't do {n,m} with n > m at <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}. See L<perlre>. +(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 +regular expression about where the problem was discovered. See L<perlre>. =item Can't do setegid! @@ -1043,35 +1044,6 @@ references can be weakened. with an assignment operator, which implies modifying the value itself. Perhaps you need to copy the value to a temporary, and repeat that. -=item Character class syntax [%s] belongs inside character classes - -(W unsafe) The character class constructs [: :], [= =], and [. .] go -I<inside> character classes, the [] are part of the construct, for -example: /[012[:alpha:]345]/. Note that [= =] and [. .] are not -currently implemented; they are simply placeholders for future -extensions and will cause fatal errors. - -=item Character class syntax [. .] is reserved for future extensions - -(F regexp) Within regular expression character classes ([]) the syntax -beginning with "[." and ending with ".]" is reserved for future -extensions. If you need to represent those character sequences inside -a regular expression character class, just quote the square brackets -with the backslash: "\[." and ".\]". - -=item Character class syntax [= =] is reserved for future extensions - -(F) Within regular expression character classes ([]) the syntax -beginning with "[=" and ending with "=]" is reserved for future -extensions. If you need to represent those character sequences inside -a regular expression character class, just quote the square brackets -with the backslash: "\[=" and "=\]". - -=item Character class [:%s:] unknown - -(F) The class in the character class [: :] syntax is unknown. See -L<perlre>. - =item chmod() mode argument is missing initial 0 (W chmod) A novice will sometimes say @@ -1413,10 +1385,11 @@ 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 ?+* follows nothing in regexp +=item Quantifier follows nothing at <HERE< in regex m/%s/ -(F) You started a regular expression with a quantifier. Backslash it if -you meant it literally. See L<perlre>. +(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 +problem was discovered. See L<perlre>. =item Format not terminated @@ -1672,9 +1645,12 @@ transparently promotes all numbers to a floating point representation internally--subject to loss of precision errors in subsequent operations. -=item internal disaster in regexp +=item Internal disaster at <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 +discovered. + =item Internal inconsistency in tracking vforks @@ -1685,9 +1661,11 @@ L<perlvms/"exec LIST">). Somehow, this count has become scrambled, so Perl is making a guess and treating this C<exec> as a request to terminate the Perl script and execute the specified command. -=item internal urp in regexp at /%s/ +=item Internal urp at <HERE< in regex m/%s/ + +(P) Something went badly awry in the regular expression parser. The <HERE< +shows in the regular expression about where the problem was discovered. -(P) Something went badly awry in the regular expression parser. =item %s (...) interpreted as function @@ -1779,11 +1757,6 @@ effective uids or gids failed. to check the return value of your socket() call? See L<perlfunc/listen>. -=item Lookbehind longer than %d not implemented at {#} mark in regex 5s - -There is an upper limit to the depth of lookbehind in the (?<= -regular expression construct. - =item lstat() on filehandle %s (W io) You tried to do a lstat on a filehandle. What did you mean @@ -1796,6 +1769,12 @@ instead on the filehandle.) values cannot be returned in subroutines used in lvalue context. See L<perlsub/"Lvalue subroutines">. +=item Lookbehind longer than %d not implemented at <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 +the regular expression about where the problem was discovered. + =item Malformed PERLLIB_PREFIX (F) An error peculiar to OS/2. PERLLIB_PREFIX should be of the form @@ -1972,14 +1951,16 @@ 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 in regexp +=item Nested quantifiers at <HERE< in regex m/%s/ -(F) You can't quantify a quantifier without intervening parentheses. So -things like ** or +* or ?* are illegal. +(F) You can't quantify a quantifier without intervening parentheses. So +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 C<??> appear to be nested quantifiers, but aren't. See L<perlre>. + =item %s never introduced (S internal) The symbol in question was declared but somehow went out of @@ -2588,6 +2569,35 @@ problem can be found in L<perllocale> section B<LOCALE PROBLEMS>. process which isn't a subprocess of the current process. While this is fine from VMS' perspective, it's probably not what you intended. +=item POSIX syntax [%s] belongs inside character classes + +(W unsafe) The character class constructs [: :], [= =], and [. .] go +I<inside> character classes, the [] are part of the construct, for +example: /[012[:alpha:]345]/. Note that [= =] and [. .] are not +currently implemented; they are simply placeholders for future +extensions and will cause fatal errors. + +=item POSIX syntax [. .] is reserved for future extensions + +(F regexp) Within regular expression character classes ([]) the syntax +beginning with "[." and ending with ".]" is reserved for future +extensions. If you need to represent those character sequences inside +a regular expression character class, just quote the square brackets +with the backslash: "\[." and ".\]". + +=item POSIX syntax [= =] is reserved for future extensions + +(F) Within regular expression character classes ([]) the syntax +beginning with "[=" and ending with "=]" is reserved for future +extensions. If you need to represent those character sequences inside +a regular expression character class, just quote the square brackets +with the backslash: "\[=" and "=\]". + +=item POSIX class [:%s:] unknown + +(F) The class in the character class [: :] syntax is unknown. See +L<perlre>. + =item POSIX getpgrp can't take an argument (F) Your system has POSIX getpgrp(), which takes no argument, unlike @@ -2710,14 +2720,19 @@ in L<perlos2>. (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 {#} mark in regex %s +=item Quantifier in {,} bigger than %d at <HERE< in regex m/%s/ -(F) There is an upper limit to the number of allowed repetitions in the {,} -regular expression construct. +(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 +the problem was discovered. See L<perlre>. -=item Quantifier follows nothing in rgexp +=item Quantifier unexpected on zero-length expression at <HERE< in regex m/%s/ -(F) Quantifiers like * are suffixes, they quantify something preceding them. +(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 +quantifier inside the assertion instead. For example, the way to match +"abc" provided that it is followed by three repetitions of "xyz" is +C</abc(?=(?:xyz){3})/>, not C</abc(?=xyz){3}/>. =item Range iterator outside integer range @@ -2779,22 +2794,22 @@ 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 nonexistent group +=item Reference to nonexistant group at <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> -(F) In a regexp you tried to reference (\1, \2, ...) a group that -doesn't exist. Count your parentheses. +The <HERE< shows in the regular expression about where the problem was +discovered. =item regexp memory corruption (P) The regular expression engine got confused by what the regular expression compiler gave it. -=item regexp *+ operand could be empty - -(F) The part of the regexp subject to either the * or + quantifier could -match an empty string. - -=item regexp out of space +=item Regexp out of space (P) A "can't happen" error, because safemalloc() should have caught it earlier. @@ -2891,22 +2906,31 @@ 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 +=item Sequence (? incomplete at <HERE< mark in regex m/%s/ -(F) A regular expression ended with an incomplete extension (?. See +(F) A regular expression ended with an incomplete extension (?. The <HERE< +shows in the regular expression about where the problem was discovered. See L<perlre>. -=item Sequence (?%s...) not implemented +=item Sequence (?{...}) not terminated or not {}-balanced in regex m/%s/ + +(F) If the contents of a (?{...}) clause contains braces, they must balance +for Perl to properly detect the end of the clause. See L<perlre>. -(F) A proposed regular expression extension has the character reserved -but has not yet been written. See L<perlre>. +=item Sequence (?%s...) not implemented at <HERE< mark in regex m/%s/ -=item Sequence (?%s...) not recognized +(F) A proposed regular expression extension has the character reserved but +has not yet been written. The <HERE< shows in the regular expression about +where the problem was discovered. See L<perlre>. + +=item Sequence (?%s...) not recognized at <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 +where the problem was discovered. See L<perlre>. -=item Sequence (?#... not terminated +=item Sequence (?#... not terminated in regex m/%s/ (F) A regular expression comment must be terminated by a closing parenthesis. Embedded parentheses aren't allowed. See L<perlre>. @@ -3043,14 +3067,6 @@ a block by itself. (W unopened) You tried to use the stat() function on a filehandle that was either never opened or has since been closed. -=item Strange *+?{} on zero-length expression - -(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 -quantifier inside the assertion instead. For example, the way to match -"abc" provided that it is followed by three repetitions of "xyz" is -C</abc(?=(?:xyz){3})/>, not C</abc(?=xyz){3}/>. - =item Stub found while resolving method `%s' overloading %s (P) Overloading resolution over @ISA tree may be broken by importation @@ -3098,6 +3114,24 @@ 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/ + +(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 +contain alternation, such as using C<this|that|other>, enclose it in +clustering parentheses: + + (?(condition)(?:this|that|other)|else-clause) + +The <HERE< shows in the regular expression about where the problem was +discovered. See L<perlre>. + +=item Switch condition not recognized at <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 +about where the problem was discovered. See L<perlre>. + =item switching effective %s is not implemented (F) While under the C<use filetest> pragma, we cannot switch the real @@ -3367,11 +3401,23 @@ 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 Unknown BYTEORDER (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/ + +(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 +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 +discovered. See L<perlre>. + =item Unknown open() mode '%s' (F) The second argument of 3-argument open() is not among the list @@ -3423,12 +3469,14 @@ script, a binary program, or a directory as a Perl program. recognized by Perl inside character classes. The character was understood literally. -=item /%s/: Unrecognized escape \\%c passed through +=item Unrecognized escape \\%c passed through at <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. +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 +was discovered. + =item Unrecognized escape \\%c passed through @@ -3659,10 +3707,6 @@ something else of the same name (usually a subroutine) is exported by that module. It usually means you put the wrong funny character on the front of your variable. -=item Variable length lookbehind not implemented - -(F) Lookbehind currently only works for fixed-length regular expressions. - =item "%s" variable %s masks earlier declaration in same %s (W misc) A "my" or "our" variable has been redeclared in the current @@ -3719,6 +3763,12 @@ anonymous, using the C<sub {}> 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/ + +(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 +the problem was discovered. + =item Version number must be a constant number (P) The attempt to translate a C<use Module n.n LIST> statement into |