On Wed, Jun 3, 2009 at 8:08 AM, Håkon Skaarud Karlsen <
perl6-bugs-follo...@perl.org> wrote:

> # New Ticket Created by  Håkon Skaarud Karlsen
> # Please include the string:  [perl #66250]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=66250 >
>
>
> This works:
>  grammar A { rule TOP { 'a ' 'b' {*} } }; my $m = A.parse('a b'); say $/;
> Result: "a b"
> Expected result: "a b"
>
> This doesn't work:
>  grammar A { rule TOP { 'a' ' b' {*} } }; my $m = A.parse('a b'); say $/;
> Result: Empty string
> Expected result: "a b"
>

>
> And this doesn't work:
>  grammar A { rule TOP { 'a' <blank> 'b' {*} } }; my $m = A.parse('a
> b'); say $/;
> Result: Empty string
> Expected result: "a b"


These results seem logical to me.  As I understand things, significant
whitespace means that whitespace within rules gets replaced with either \s*
or \s+ depending on context.  Since rules are also greedy (no backtracking),
the significant whitespace in your second example ate all of the spaces in
your string leaving no spaces for ' b' to match.  A similar thing happens
with your third example; there is nothing for <blank> to match (though I
haven't looked at the spec, so I'm not entirely sure what <blank> should
match)

-Scott
-- 
Jonathan Scott Duff
perlpi...@gmail.com

Reply via email to