Skip to content

Instantly share code, notes, and snippets.

Created May 17, 2012 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2718535 to your computer and use it in GitHub Desktop.
Save anonymous/2718535 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/rakudo$ cat z
grammar FAIL {
token TOP { ^[ '?' <digit> ]? [ '#' <digit> ]? $ };
}
my $m = FAIL.parse('?5');
say "full match: '$m'";
say " digit: '$m<digit>'";
say " keys: $m.keys()";
pmichaud@kiwi:~/p6/rakudo$ ./perl6 z
full match: '?5'
digit: '5'
keys: digit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment