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

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

Thread Previous | Thread Next
From:
Chris Dolan
Date:
October 31, 2007 04:09
Subject:
Re: [PATCH] New failing test for RT#45667 (m/[#]/x treated inconsistently)
Message ID:
C1980C77-51D6-4697-B4BD-67BC05B0A535@chrisdolan.net
On Oct 30, 2007, at 11:08 AM, Dave Mitchell wrote:

> Well, they're slightly related, but the two fixes can be developed
> independently of each other. They both involve making the tokeniser  
> be a
> bit more clever when processing literal strings. There's a function  
> that
> scans through characters in a literal string until it finds something
> "interesting". For example, in the double-quoted string "abc$d", it  
> stops
> at the $ and returns "abc" as a token.  One fix involves stopping that
> function thinking that # is interesting when within [], the other  
> involves
> making it think that '(?{' is interesting.

OK, fair enough.  Consistency is what I seek.  :-)  In that light,  
here's an alternative proposed test patch.  As of 32199, this patch  
yields (abbreviated somewhat):

    ok 1342
    ok 1343
    ok 1344
    not ok 1345 () 'foo \[#\]'x:foo[#]:y:$&:foo[#] => `foo[', match=1
    not ok 1346 () 'foo [#]':foo#:y:$&:foo# => `'', match=
    ok 1347
    ok 1348
    not ok 1349 () 'foo \[#\]':foo[#]:y:$&:foo[#] => `'', match=

Chris


--- t/op/re_tests.orig  2007-10-28 09:26:00.000000000 -0500
+++ t/op/re_tests       2007-10-30 19:55:16.000000000 -0500
@@ -1338,3 +1338,12 @@
.*\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#    y       $&      foo#
+'foo [#'x      foo#    c       -       Unmatched [
+'foo \[#]'x    foo#    n       -       -
+'foo \[#\]'x   foo[#]  y       $&      foo[#]
+'foo [#]'      foo#    y       $&      foo#
+'foo [#'       foo#    c       -       Unmatched [
+'foo \[#]'     foo#    n       -       -
+'foo \[#\]'    foo[#]  y       $&      foo[#]


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About