develooper Front page | perl.perl5.porters | Postings from June 2013

Re: [perl #92898] (*THEN) broken inside condition subpattern

Thread Previous | Thread Next
From:
ph10
Date:
June 23, 2013 11:18
Subject:
Re: [perl #92898] (*THEN) broken inside condition subpattern
Message ID:
alpine.LNX.2.03.1306231203030.17457@hermes.cam.ac.uk
On Sat, 22 Jun 2013, demerphq wrote:

> Sorry about the incredibly laggy reply. :-(

Hi Yves,

No problem; glad somebody has picked this up. For myself, I can no 
longer remember exactly what I was complaining about! 

> I think you are right that perl thinks differently to you. Probably
> because of implementation details.

Thanks for taking the time to give a long explanation of the way Perl 
works, which indeed is different to the way PCRE works - and of course 
it's far too late to change that now.

In a recent release of PCRE we have formulated some reasonably 
consistent rules for way that backtracking verbs are handled, and 
documented them. In many cases the behaviour is the same as Perl's, but 
there are some differences.

> Anyway, I can see how it would be reasonable to consider (?:foo) to be
> an alternation with only one branch, but to Perl it isnt, and that is
> how you should interpret the verb operators.

PCRE does now get this (perhaps not 100%, but to some extent) "right" in
its current treatment of (*THEN). The documentation even says this: "A 
subpattern that does not contain a | character is just a part of the    
enclosing alternative; it is not a nested alternation with only one      
alternative."

Regards,
Philip

-- 
Philip Hazel

Thread Previous | 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