This looks like a rule invocation bug to me -- if I change the code to use $str ~~ / <A::sp> / then it appears to work fine:
$ cat x grammar A { token foo { ^ [<alnum>||<sp>]+ $ }; token sp { ' ' | \n }; } say ?(" " ~~ /<A::sp>/); say ?("\n" ~~ /<A::sp>/); say ?("foo" ~~ /<A::foo>/); say ?("foo bar" ~~ /<A::foo>/); say ?("foo\nbar" ~~ /<A::foo>/); $ ./parrot perl6.pbc x 1 1 1 1 1 $ Closing ticket. Pm