In How can I pass arguments to a Perl 6 grammar? I passed an argument to a rule as part of a submerse. I was wondering how I'd do that completely inside a grammar. Suppose I had something like:
grammar TryIt {
rule TOP { \d+ <stuff> }
rule stuff ($count) { <[ \S A..Z ]>{$count} }
}
my $match = TryIt.parse: "123 ABCD";
say $match;
How do I pass an argument from TOP
to stuff
? I didn't find any examples and various guesses about parens near stuff didn't work.