develooper Front page | perl.perl5.porters | Postings from October 2007

[PATCH] New failing test for RT#45667 (m/[#]/x treated inconsistently)

Thread Next
Chris Dolan
October 28, 2007 07:59
[PATCH] New failing test for RT#45667 (m/[#]/x treated inconsistently)
Message ID:

RT#45667 points out that the Perl parser and the Regexp parser treat  
m/[#]/x differently.  The former treats the # as a comment character  
and the latter treats it as a literal.  I propose that we adopt the  
Perl parser's behavior because 1) doing otherwise would require us to  
add more regexp-specific knowledge to the Perl parser and 2) other  
Regexp engines may not want to treat [#] the same as the current  
default engine.

The patch below adds a (currently failing) test to the regexp parser  
to enforce this decision.  The patch is against rsync


(P.S. my first post to P5P)

--- t/op/re_tests.orig  2007-10-28 09:26:00.000000000 -0500
+++ t/op/re_tests       2007-10-28 09:47:49.000000000 -0500
@@ -1338,3 +1338,5 @@
.*\z   foo\n   y       -       -
^(?:(\d)x)?\d$ 1       y       ${\(defined($1)?1:0)}   0
.*?(?:(\w)|(\w))x      abx     y       $1-$2   b-
+'foo [#]'x     foo#    c       -       Unmatched [

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About