On Mon Dec 15 03:43:26 2008, baest wrote:
> Moritz Lenz via RT (09:23 2008-12-14):
> > Martin Kjeldsen (via RT) wrote:
> > > # New Ticket Created by  Martin Kjeldsen
> > > # Please include the string:  [perl #61308]
> > > # in the subject line of all future correspondence about this
> issue.
> > > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61308 >
> > >
> > >
> > > When using rules at least with <ws> overwritten, the rule also
> captures
> > > whitespace. Please see attached file for example.
> >
> > You're right that there's a bug, but the real issue is that 'token
> ws {
> > ... }' isn't used by implicit <.ws> in rules yet:
> >
> > grammar A {
> >     token ws { 'a' };
> >     rule b {x y};
> > };
> >
> > if 'xab' ~~ m/ ^ <A::b> $/ {
> >     say "match";
> > } else {
> >     say "no match";
> > }
> > # output: no match\n
> >
> > Thank you for your report,
> > Moritz
> >
> 
> Hi Moritz,
> 
> you're right, I can't get your example to work. But I think you meant
> 
> if 'xay' ~~ m/ ^ <A::b> $/ { # y instead of b in string
> 
> and shouldn't it be rule b {'x' 'y'}; or doesn't that matter (I don't
> know).
> 
> But no matter it still doesn't work for some reason.

The following version works fine for me:

$ cat x
grammar A {
    token ws { 'a' };
    rule b {x y};
};

if 'xay' ~~ m/^ <A::b> $/ { say 'match'; }
else { say 'nomatch'; }

$ ./parrot perl6.pbc x
match
$


So, clearly the <ws> rule is being called.

See next reply for the other example.

Pm

Reply via email to