Hi, we had the discussion a few times on how to match against a grammar, for example here: http://irclog.perlgeek.de/parrot/2008-05-31#i_322490
Attached patch adds the $string ~~ Grammar.new form to S05, on which @Larry.pick($some) seems to have agreed upon. In the end I don't really care how it's done, I just want it to be specced ;-) Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/
--- Rule.pod.old 2008-09-08 17:27:42.000000000 +0200 +++ Rule.pod 2008-09-08 17:32:15.000000000 +0200 @@ -3586,8 +3586,6 @@ $parsetree = m:keepall/<Perl.prog>/; } -=back - =item * To switch to a different grammar in the middle of a regex, you may use the C<:lang> adverb. @@ -3595,6 +3593,14 @@ token funnylang { '{' [ :lang($funnylang.unbalanced('}')) <expr> ] '}' } +=item * + +To match against the C<TOP> rule of a grammar, you instantiate the grammar: + + $string ~~ Identity.new; + +=back + =head1 Syntactic categories For writing your own backslash and assertion subrules or macros, you may