On Fri May 29 17:05:32 2015, alex.jakime...@gmail.com wrote:
> This command:
> perl6 -e "say 'rule1 foo rule2 bar' ~~ /^ ( 'rule1' || 'rule2' )* %% (.+?)
> $/"
> 
> Outputs this:
> 「rule1 foo rule2 bar」
>  0 => 「rule1」
>  1 => 「 」
>  1 => 「 f」
>  1 => 「 fo」
>  1 => 「 foo」
>  1 => 「 foo 」
>  0 => 「rule2」
>  1 => 「 」
>  1 => 「 b」
>  1 => 「 ba」
>  1 => 「 bar」
> 
> I can't see any reason why these partial matches should appear in the match
> object. I expected this:
> 
> 「rule1 foo rule2 bar」
>  0 => 「rule1」
>  1 => 「 foo 」
>  0 => 「rule2」
>  1 => 「 bar」

This one took some figuring out... Anyway, fixed now:

$ perl6 -e "say 'rule1 foo rule2 bar' ~~ /^ ( 'rule1' || 'rule2' )* %% (.+?) $/"
「rule1 foo rule2 bar」
 0 => 「rule1」
 1 => 「 foo 」
 0 => 「rule2」
 1 => 「 bar」

Tests in S05-match/capturing-contexts.t.

/jnthn

Reply via email to