Skip Menu |

Preferred bug tracker

Please email the preferred bug tracker to report your issue.

This queue is for tickets about the PPIx-Regexp CPAN distribution.

Report information
The Basics
Id: 82140
Status: resolved
Priority: 0/
Queue: PPIx-Regexp

People
Owner: Nobody in particular
Requestors: CHORNY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.028
Fixed in: (no value)



Subject: incorrect parsing of \?
PPIx::Regexp->new( '/(\?|I)/' ) parses to PPIx::Regexp failures=0 PPIx::Regexp::Token::Structure '' PPIx::Regexp::Structure::Regexp / ... / PPIx::Regexp::Structure::BranchReset (\?| ... ) PPIx::Regexp::Token::Literal 'I' PPIx::Regexp::Token::Modifier '' and requires perl 5.009005. This is incorrect. -- Alexandr Ciornii, http://chorny.net
On Thu Dec 20 15:04:35 2012, CHORNY wrote: Show quoted text
> PPIx::Regexp->new( '/(\?|I)/' ) parses to > PPIx::Regexp failures=0 > PPIx::Regexp::Token::Structure '' > PPIx::Regexp::Structure::Regexp / ... / > PPIx::Regexp::Structure::BranchReset (\?| ... ) > PPIx::Regexp::Token::Literal 'I' > PPIx::Regexp::Token::Modifier '' > > and requires perl 5.009005. This is incorrect. >
Well, branch reset requires 5.9.5, but this is clearly not a branch reset. Looks like the back slash is getting ignored somehow. Good catch. Thanks. Judging by the comments, I was trying to handle '?(\?|I)?'.
Version 0.028_01 just went to PAUSE, and should be available Real Soon Now. Please let me know how you like it. Under the assumption that this turned up in a Padre bug: With version 0.028_01 of PPIx::Regexp, perlcritic will complain that /(\?|I)/ should be written as a character class. The recommendation is [\?I] rather than the more-correct [?I], but that looks like a wart to me rather than an actual bug. Something will have to be done in Perl::Critic, but what kind of support PPIx::Regexp should give Perl::Critic for this is something I will have to think about.
On Thu Dec 20 19:10:38 2012, WYANT wrote: Show quoted text
> Version 0.028_01 just went to PAUSE, and should be available Real Soon > Now. Please let me know how you like it.
Yes, it's fixed. But there are similar bugs in parsing: /(\?>I)/ and /(\?:I)/ -- Alexandr Ciornii, http://chorny.net
On Fri Dec 28 08:20:04 2012, CHORNY wrote: Show quoted text
> On Thu Dec 20 19:10:38 2012, WYANT wrote:
> > Version 0.028_01 just went to PAUSE, and should be available Real Soon > > Now. Please let me know how you like it.
> > Yes, it's fixed. > But there are similar bugs in parsing: > /(\?>I)/ and /(\?:I)/ >
Right you are. And more, I suspect. I have worked a bit on your first example, but have decided a refactoring is in order.
The /(\?:I)/ case is going to be harder to get completely right, though I can certainly do better than I do now. How much do you care about regular expressions whose delimiters are letters (e.g. 'm xfoox', as a bizarre variant of 'm/foo/')?
Version 0.028_02 went to CPAN this afternoon. This contains a serious effort to fix all the '(?...)' parsing. There is a restriction, which I have not documented, but may before 0.029: the use of word characters as regular expression delimiters is not supported. That is, 'm i(?\i:...)i' is not going to parse as one would wish, and I have no real notion, at the moment, how to fix it.
On Fri Dec 28 18:23:19 2012, WYANT wrote: Show quoted text
> The /(\?:I)/ case is going to be harder to get completely right, though > I can certainly do better than I do now. > > How much do you care about regular expressions whose delimiters are > letters (e.g. 'm xfoox', as a bizarre variant of 'm/foo/')?
Personally I don't care, and I think that almost all users of Perl::MinimumVersion will also not care. -- Alexandr Ciornii, http://chorny.net
PPIx::Regexp 0.029 just went to PAUSE, and should appear on a CPAN mirror near you Real Soon Now. It still does not correctly handle regular expressions delimited by alphabetic characters. I thought about documenting this as a restriction, since I'm not sure how to handle it. But we'll see if it comes up as a real-life issue. Maybe an actual use case will stimulate the ol' brain cells.
There being no further correspondence, I'm calling this one resolved. If you find something else that looks like the same problem, please feel free to re-open the ticket. If it turns out you need PPIx::Regexp to be able to parse regexps that use alphabetic characters, please open a new ticket. Thank you very much for helping to improve PPIx::Regexp.