http://qs1969.pair.com?node_id=1061359


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

:) But if I do that I'll have to update my program, and I'm lazy and its hard to juggle :)

Ok, if you're willing to accept this is a roundabout way to report an issue, a work in progress that stalled few months ago, that started organically as a single subroutine walking the PPIx::Regexp tree and grew from there, slowly as I am learning my way around, into its current state, still in need of refactoring ...

I'll post the full code in two followups but here is an excerpt from ppixregexplain.pl from what I thought were bugs that received a "TODO.*BUG" note. If there are any inaccuracies thinkos typos you have been warned :)

ppixregexplain.pl:150:#~ #~ TODO REPORTBUG PPIx::Regexp::Token::Greed +iness NEEDS TO DIE / THERE NEEDS TO BE A SINGLE PPIx::Regexp::Token:: +Quantifier ppixregexplain.pl:325:#~ TODO REPORTBUG perlre/perlretut/re DO NOT LI +NK perldebguts which explains use re 'debug'; output ppixregexplain.pl:1165: "TODO warn REPORT BUG \\g10 UNRECOG +NIZED AS A PPIx::Regexp::Token::Backreference misparsed as PPIx::Reg +exp::Token::Literal (\\g10 is not \\10, can't be treated as octal)", ppixregexplain.pl:1172: push @{$$ret{start}}, 'ERROR warn T +ODO REPORTBUG octals NOT PARSED AS PPIx::Regexp::Node::Range'; ppixregexplain.pl:1470: push @{$$ret{start}}, "ERROR warn +TODO REPORT BUG THIS IS LITERAL ^ NOT NEGATION"; ppixregexplain.pl:1476: push @{$$ret{start}}, "ERROR warn +TODO REPORT BUG A LONE ^ IN A CHARCLASS IS A IS LITERAL ^ NOT NEGATIO +N"; _desc.pl:159:#~ THIS IS A LIE :) TODO REPORT BUG C<PPIx::Regexp::Struc +ture::Unknown> has no descendants. _desc.pl:176:#~ TODO REPORT BUG \g10 UNRECOGNIZED AS A REFERENCE mispa +rsed as PPIx::Regexp::Token::Literal _desc.pl:761:#~ TODO REPORT BUG? SHOULD BE RECOGNIZED AS Token::Modif +ier/GroupType::Modifier _desc.pl:931:'\P' => ['L<perlrecharclass/Unicode Properties>','TODO + warn REPORT BUG for PPIx::Regexp; \PP is \P{Prop} ; for example \PN +is \P{Number}; ' ], _desc.pl:932:'\p' => ['L<perlrecharclass/Unicode Properties>','TODO + warn REPORT BUG for PPIx::Regexp; \pP is \p{Prop} ; for example \pN +is \p{Number}; ' ],

In in furtherance of blind copying, the corresponding entries from my "test suite" (it tests my eyeball interface)

'qr/(?[ ( ( [c^] - [d^] ) | ( [^c] & ( [a] + [2] ) ) ) ])/', ## TODO R +EPORT misparsed as [^c] and [^d] "qr{ \\pP\\p{P}\\PP\\P{P} }x", ## TODO report bug misparsed single let +ter Unicode properties q{qr{[\200-\377\x00-\x1f]}}, ## TODO REPORTBUG NOT PARSED AS RANGE q{qr{[\0-\377]}}, ## TODO REPORTBUG NOT PARSED AS RANGE 'qr{ (?#legals) (?^) (?aa) (?a) (?d) (?l) (?u) (?p) (?i) (?m) (?s) (?x) (?-i) (?-m) (? +-s) (?-x) (?x) (?#NOTlegals) (?aad) (?ad) (?al) (?au) (?uu) (?ll) (?dd) (?-a) (?-d) (?-l) (?-u) (?- +p) (?-^) (?gcer) (?-gcer) }x',,, "m{(?i)a(?-i)B(?i)(?-i:B\\w(?i:q\\w))q}xi",# a case insensitive B case + sensitive
And one more
#~ a is case INsensitive #~ B is case SEnsitive my $re = PPIx::Regexp->new( <<'__GROAN__' ); m{ a (?i: (?-i)B (?i)a (?-i)B (?i)a (?-i)B (?i: a (?-i)B (?i)a (?-i)B (?i)a (?: (?-i)B B ) a [a-a] ) ) a $a_terpolats (?-i:$B_TERPOLATES) }xi __GROAN__

In the code below the modifiers propagation code is in the following definitions (you can copy/paste each line to find the sub definition)

sub xplain_modifiers sub PPIx::Regexp::Token::Modifier::xmods_explode sub PPIx::Regexp::xmods_propagate sub PPIx::Regexp::Element::xmerge_mods sub PPIx::Regexp::Node::xmods_susceptible sub PPIx::Regexp::Node::xmods