diff options
author | M.J.T. Guy <mjtg@cus.cam.ac.uk> | 1997-07-07 18:02:29 +1200 |
---|---|---|
committer | Tim Bunce <Tim.Bunce@ig.co.uk> | 1997-08-07 00:00:00 +1200 |
commit | 1b1626e441fa9750f3953e46530f2e95046bb007 (patch) | |
tree | a3acc09c28a1f9ae185de6c85fd96366acd33cee /pod | |
parent | 706a304b44357647b233945e4e432234718ab515 (diff) | |
download | perl-1b1626e441fa9750f3953e46530f2e95046bb007.tar.gz |
Re: Bug in Regular Expressions when using colon as delimiter
Andreas Klussmann <andreas@infosys.heitec.net> wrote
> using
> $x =~ m:(?:xx):;
> instead of
> $x =~ m:(?\:xx):;
> terminates perl immediatly (not in the debuger) and gives
> Sequence (?
> and nothing more as error message.
This illustrates at least three bugs:
i) The message is truncated because of the "NUL in argument to die"
problem which I reported some time ago (and provided a kludge for
in Carp.pm).
ii) In any case, it would have produced an incorrect error message.
iii) This error and many (most? all?) other parsing errors in regular
expressions cause compilation to be terminated.
The attached patch fixes (i) and (ii) but not (iii). It also extends
the regexp tests to test the error messages generated rather than just
note that an error has occurred.
Additional points which I'll leave to someone else:
a) (iii) needs fixing.
b) I note that many regexp error messages are incorrect, as they quote
the regexp as /(?/ rather than as (e.g.) m:(?: or s:(?::.
c) My understanding of Chip's rework of sprintf was that it now provided
a mechanism for including strings with embedded NULs. Could this
be used to provide a complete fix for (i) rather than kludging each
case as it turns up?
d) I strongly suspect that the regexp tests a\ and 'a\'i
are not doing what the author intended. I've left them so they
say "ok" regardless. (Hint: \' is recognised in a '' string.)
p5p-msgid: E0wtbhv-0005Mm-00@ursa.cus.cam.ac.uk
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perldiag.pod | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index a5527ddd82..d3ea144e0e 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2070,6 +2070,10 @@ or possibly some other missing operator, such as a comma. (W) The filehandle you're sending to got itself closed sometime before now. Check your logic flow. +=item Sequence (? incomplete +(F) A regular expression ended with an incomplete extension (?. +See L<perlre>. + =item Sequence (?#... not terminated (F) A regular expression comment must be terminated by a closing |