Skip to content

Instantly share code, notes, and snippets.

@ronaldxs
Created January 24, 2017 15:23
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 ronaldxs/901b9b802dcd85c8b588b202c36bb5ac to your computer and use it in GitHub Desktop.
Save ronaldxs/901b9b802dcd85c8b588b202c36bb5ac to your computer and use it in GitHub Desktop.
#
# https://design.perl6.org/S05.html#Extensible_metasyntax_(%3C...%3E)
# section starting "A leading :: indicates a symbolic indirect subrule: "
#
# see also https://github.com/perl6/roast/blob/master/S05-metasyntax/angle-brackets.t#L172
# see also https://docs.perl6.org/language/packages#index-entry-%3A%3A%28%29
#
grammar g { token t { <[2]> } };
say so "2" ~~ /<g::t>/;
my $rname = "digit";
say so "2" ~~ /<::($rname)>/;
$rname = "g::t";
try {say so "2" ~~ /<::($rname)>/} // note "err: $!";
$rname = "t";
try {say so "2" ~~ /<::g::($rname)>/} // note "err: $!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment