On Sun Dec 07 13:31:27 2008, bacek wrote:
> Hello.
>
> Simple example
>
> ba...@icering:~/src/xquery$ cat m.pl
> token a { 'a' };
> token b { 'b' };
> rule Foo { <a> | <b> };
>
> 'b' ~~ / <Foo> /;
> given $/<Foo> {
> when .<a> { say "a"; };
> when .<b> { say "b"; };
> };
Now fixed in 7bd5a95 (and tests added to spectest).
Thanks!
Pm
>
>
> ba...@icering:~/src/xquery$ perl6 m.pl
> Method 'ACCEPTS' not found for invocant of class 'PGE;Match'
>
>
> <bacek> is it legal syntax?
> or I always should use if/elsif/else?
> <moritz_> bacek: yes, but until you match your regex you won't get any
> meaningful result
> <bacek> perl6: token a { 'a' }; token b { 'b' }; rule Foo { <a> | <b> };
> 'b'~~ / <Foo> /; given $/<Foo> { when .<a> { say "a"; }; when .<b> { say
> "b"; }; };
> <p6eval> rakudo 33630: OUTPUT[Method 'ACCEPTS' not found for invocant of
> class 'PGE;Match'current instr.: 'infix:~~' pc 14429
> (src/builtins/match.pir:18)]
> ..pugs: OUTPUT[Error eval perl5: "if
> (!$INC{'Pugs/Runtime/Match/HsBridge.pm'}) { unshift @INC,
> '/home/evalenv/pugs/perl5/Pugs-Compiler-Rule/lib'; unshift @INC,
> '/home/evalenv/pugs/third-party/Parse-Yapp/lib'; eval q[require
> 'Pugs/Runtime/Match/HsBridge.pm'] or die $@;}'Pugs::Runti...
> ..elf 24206: OUTPUT[Can't locate object method "cb__RegexDef" via package
> "EmitSimpleP5" at ./elf_f line 1612.]
> <bacek> moritz_: thanks
> looks like another TODO ticket for rakudo.
> <moritz_> let me check the S03 smart match table first...
> yes, Any .foo - method truth
>
>
>