Re: [perl #129299] [REGEX] Quantified capture group breaks `$/.list`
Fixed (for now at least) with 9b6f2eb5434e71f07bc649 . Tests still needed. > On 18 Sep 2016, at 19:30, Sam S. (via RT) > wrote: > > # New Ticket Created by Sam S. > # Please include the string: [perl #129299] > # in the subject line of all future correspondence about this issue. > # https://rt.perl.org/Ticket/Display.html?id=129299 > > > > When a quantified capture group matched zero times but the overall regex > matches, then the List returned from `$/.list` stops iterating before the > corresponding element: > >"ac" ~~ / (a) (b)? (c) /; >say ($0, $1, $2); # (「a」 Nil 「c」) >say $/.list; # (「a」) >say $/.list.map({1}); # (1) >say $/.list.elems;# 3 >say $/.list[0, 1, 2, 3]; # (「a」 (Mu) 「c」 Nil > > Expected behavior would be for `$/.list;` to return `(「a」 Nil 「c」)`. > > mst++ suggested that maybe an InterationEnd is ending up where it shouldn't > be.
Re: [perl #129299] [REGEX] Quantified capture group breaks `$/.list`
Ah, found it: The List iterator assumes that a List cannot have “holes” in it. Apparently it can :-( Going to sleep on how to fix this. > On 18 Sep 2016, at 19:30, Sam S. (via RT) > wrote: > > # New Ticket Created by Sam S. > # Please include the string: [perl #129299] > # in the subject line of all future correspondence about this issue. > # https://rt.perl.org/Ticket/Display.html?id=129299 > > > > When a quantified capture group matched zero times but the overall regex > matches, then the List returned from `$/.list` stops iterating before the > corresponding element: > >"ac" ~~ / (a) (b)? (c) /; >say ($0, $1, $2); # (「a」 Nil 「c」) >say $/.list; # (「a」) >say $/.list.map({1}); # (1) >say $/.list.elems;# 3 >say $/.list[0, 1, 2, 3]; # (「a」 (Mu) 「c」 Nil > > Expected behavior would be for `$/.list;` to return `(「a」 Nil 「c」)`. > > mst++ suggested that maybe an InterationEnd is ending up where it shouldn't > be.
Re: [perl #129299] [REGEX] Quantified capture group breaks `$/.list`
I’m looking into this. This appears to be an artefact of .gist on the list, caused by the say. Which also happens for .perl on the list. say $/.list.Str; # a c Suspecting the gistseen/perlseen machinery now. Investigating... > On 18 Sep 2016, at 19:30, Sam S. (via RT) > wrote: > > # New Ticket Created by Sam S. > # Please include the string: [perl #129299] > # in the subject line of all future correspondence about this issue. > # https://rt.perl.org/Ticket/Display.html?id=129299 > > > > When a quantified capture group matched zero times but the overall regex > matches, then the List returned from `$/.list` stops iterating before the > corresponding element: > >"ac" ~~ / (a) (b)? (c) /; >say ($0, $1, $2); # (「a」 Nil 「c」) >say $/.list; # (「a」) >say $/.list.map({1}); # (1) >say $/.list.elems;# 3 >say $/.list[0, 1, 2, 3]; # (「a」 (Mu) 「c」 Nil > > Expected behavior would be for `$/.list;` to return `(「a」 Nil 「c」)`. > > mst++ suggested that maybe an InterationEnd is ending up where it shouldn't > be.
[perl #129299] [REGEX] Quantified capture group breaks `$/.list`
# New Ticket Created by Sam S. # Please include the string: [perl #129299] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=129299 > When a quantified capture group matched zero times but the overall regex matches, then the List returned from `$/.list` stops iterating before the corresponding element: "ac" ~~ / (a) (b)? (c) /; say ($0, $1, $2); # (「a」 Nil 「c」) say $/.list; # (「a」) say $/.list.map({1}); # (1) say $/.list.elems;# 3 say $/.list[0, 1, 2, 3]; # (「a」 (Mu) 「c」 Nil Expected behavior would be for `$/.list;` to return `(「a」 Nil 「c」)`. mst++ suggested that maybe an InterationEnd is ending up where it shouldn't be.