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


In reply to Re^8: Parsing and translating Perl Regexes ( PPIx::Regexp::xplain ppixregexplain.pl _desc.pl ) by Anonymous Monk
in thread Parsing and translating Perl Regexes by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.