开发者

Trouble using grammar with rakudo perl6

开发者_C百科The simplest grammar usage gives me complation error.

use v6;
grammar Foo {
   token bar { \w+ }
}
say 'abc' ~~ /<Foo::bar>/;

Invoked like src/rakudo/perl6 simple.p6, it fails with

regex assertion not terminated by angle bracket at line 7, near "::bar>/;\n"
...

I tried a number of known-to-work examples with similar results, so I suspect that my perl6 setup is incorrect.

If you use grammar with perl6, please show me your setup. Thanks in advance.


I'm sorry; your error message contains two clues (line 7, ::bar) that the code you've pasted is not enough to diagnose your problem. There's just not enough information to understand your problem.

Apart from that, you have a mismatched closing parenthesis in the last line of the code you did post, and you haven't declared the <Foo::bar>.

I don't think your Perl 6 setup is incorrect, for what it's worth. There's nothing in what you've written to indicate that.


Rakudo 2010.02 release (#26 "Amsterdam") has a regression that breaks module import. Use Rakudo 2010-01 release (#25 "Minneapolis") instead. download page is here: http://github.com/rakudo/rakudo/downloads

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜