develooper Front page | perl.perl5.porters | Postings from April 2019

[perl #133687] Possible regex regression: Sequence (?_...) notrecognized in regex

Thread Next
From:
Karl Williamson via RT
Date:
April 4, 2019 20:29
Subject:
[perl #133687] Possible regex regression: Sequence (?_...) notrecognized in regex
Message ID:
rt-4.0.24-31163-1554409777-258.133687-15-0@perl.org
On Tue, 27 Nov 2018 05:44:32 -0800, davem wrote:
> On Sun, Nov 25, 2018 at 06:51:33PM -0800, James E Keenan via RT wrote:
> > Bisection points to:
> >
> > #####
> > d24ca0c5f11250dcd2552c84a048bda5786ba8d1 is the first bad commit
> > commit d24ca0c5f11250dcd2552c84a048bda5786ba8d1
> > Author: David Mitchell <davem@iabyn.com>
> > Date:   Sun Mar 18 15:53:40 2012 +0000
> >
> > Fix up runtime regex codeblocks.
> >
> > The previous commits in this branch have brought literal code blocks
> > into the New World Order; now do the same for runtime blocks, i.e.
> > those
> > needing "use re 'eval'".
> >
> > The main user-visible changes from this commit are that:
> > ...
> 
> Now fixed in blead by:
> 
> 
> commit 278d8c58e85c646b61e60fe48207e090278bb61c
> Author:     David Mitchell <davem@iabyn.com>
> AuthorDate: Tue Nov 27 13:26:39 2018 +0000
> Commit:     David Mitchell <davem@iabyn.com>
> CommitDate: Tue Nov 27 13:26:39 2018 +0000
> 
> handle /(?(?{code}))/ mixed compile-and runtime
> 
> Where a runtime pattern contains both compile-time and run-time code
> blocks, e.g.:
> 
> $re = '(?{ RRR })';
> / $re X(?{ CCC })Y/
> 
> The compile-time code-block CCC is parsed at the same time as the
> surrounding text. The runtime code RRR is parsed at runtime by
> constructing a fake pattern and re-parsing it, but with any compile-
> time
> code-blocks blanked out (so they don't get compiled twice). The
> compiled
> regex is then thrown away, but any optrees just created for the
> runtime
> code blocks are kept.
> 
> For example at runtime, the re-parsed pattern looks like:
> 
> / (?{ RRR }) X__________Y/
> 
> Unfortunately this was failing for the conditional pattern, e.g.
> 
> / $re X(?(?{ CCC }))Y/
> 
> which was getting blanked as
> 
> / (?{ RRR }) X(?_______)Y/
> 
> which isn't valid syntax.
> 
> This commit blanks (?{...}) into (?=====) instead which is always
> legal.

So can this ticket be closed?
-- 
Karl Williamson

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133687

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About