On Fri, Oct 31, 2008 at 08:47:09PM -0700, Chris Dolan via RT wrote: > It seems to be Regex.pir that is taking all of the invocations. I have > discovered that, beyond <text>, I cannot create tokens/rules named > "null", "ws", etc. The latter is particularly problematic in writing > parsers in Perl6. The following simple example shows the failure: > > grammar WSOverride { > token TOP { <tok_foo> <.ws> <tok_bar> }; > token tok_foo { foo }; > token tok_bar { bar }; > token ws { [ \h | \v | '%' ]+ }; > } > > ok('foo bar' ~~ WSOverride::TOP); # succeeds > ok("foo\nbar" ~~ WSOverride::TOP); # succeeds > ok("foo%%%\nbar" ~~ WSOverride::TOP); # fails
First, note that C< 'foo bar' ~~ WSOverride::TOP > isn't really the correct syntax for invoking a rule -- but the synopses don't really specify what the correct syntax is yet. At the moment we do know that it's not likely to be C< 'foo' ~~ Grammar::rule >. Beyond that, the problem appears to be that Rakudo is not presently creating its grammars properly -- it appears to be deriving them directly from Any instead of from a PGE grammar class of some sort. As a result, inheritance and method dispatch don't seem to be working quite properly, and we'll need to get that fixed. Pm