Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^8: Parsing and translating Perl Regexes ( PPIx::Regexp::xplain )

by Anonymous Monk
on Nov 11, 2013 at 00:51 UTC ( #1061939=note: print w/replies, xml ) Need Help??

in reply to Re^7: Parsing and translating Perl Regexes ( PPIx::Regexp::xplain )
in thread Parsing and translating Perl Regexes

Status update:

The "\g10" thing was an out-and-out bug, caused by blindly reblessing backreferences over and above the number of capture groups present. Only things of the form \10 should be so reblessed.

The failure to recognize /foo/aia as equivalent to /foo/aai is also a bug.

The thing with recognizing /foo/ad as /foo/d is more problematic, partly because my design goal was never to distinguish valid regexes from invalid ones, but only to parse valid ones "correctly". The practical problems are that I can't do anything about the error at the point I might detect it, since the code at that point needs to consider also stuff fed in from (e.g.) "use re '/x';". So for the moment nothing is going to be done about those.

On the other hand, I have come up with a method on PPIx::Regexp::Element (i.e. inherited by all PPIx::Regexp objects) that will tell whether a given modifier is asserted. I'm sure there are all sorts of edge cases that I have not considered, but in "/(?-i:foo)/i" it correctly says /i is _not_ asserted on the "f".

Unfortunately I am looking at a very busy week, and probably will not get anything published until very late in the week at the earliest.

Tom Wyant

  • Comment on Re^8: Parsing and translating Perl Regexes ( PPIx::Regexp::xplain )

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061939]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2018-06-21 10:40 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.