Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (22 sloc) 0.599 kB
use v6;
use Test;
plan 4;
# L<S05/Variable (non-)interpolation/Alternatively, if you predeclare a proto regex>
grammar Grammar::With::Protos {
token TOP {
proto token fred { <...> }
token fred:sym<foo> {
<sym> \d+
token fred:sym<bar> {
<sym> :s 'boz'+
my $m = Grammar::With::Protos.parse("foo23bar bozboz foo42");
ok($m, 'parse succeeded');
is(~$m<fred>[0], "foo23", "Submatch 1 correct");
is(~$m<fred>[1], "bar bozboz ", "Submatch 2 correct");
is(~$m<fred>[2], "foo42", "Submatch 3 correct");
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.