2
my $match := 'abcdef' ~~ / c(.)<alpha> /;
3
ok( $match eq 'cde', "simple match" );
5
ok($_ eq 'd','correct numbered capture');
8
ok($_.key eq 'alpha','the named capture is named correctly');
9
ok($_.value eq 'e','...and it contains the right things');
11
ok( $match.from == 2, ".from works" );
12
ok( $match.to == 5, ".to works");
13
ok( $match.orig eq "abcdef", ".orig works");
14
ok( $match.chars == 3, ".chars works");
17
ok($match."!dump_str"('mob') eq "mob: cde @ 2\nmob[0]: d @ 3\nmob<alpha>: e @ 4\n",".\"!dump_str\" works correctly");
20
token TOP { (o)(k) ' ' <integer> }
24
$match := ABC.parse('ok 123');
25
ok($match.dump eq "- 0: o\n- 1: k\n- integer: 123\n",".dump works correctly");