Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Forked from lucasbuchala/MySlang.pm6
Last active July 30, 2018 21:40
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 AlexDaniel/8d1a3739b5fa70fb965d88b57db9dff1 to your computer and use it in GitHub Desktop.
Save AlexDaniel/8d1a3739b5fa70fb965d88b57db9dff1 to your computer and use it in GitHub Desktop.
use MySlang;
<begin>xxx<end1>
role G {
token term:sym<end1> { '<begin>' ~ '<end1>' \w+ }
token term:sym<end2> { '<begin>' ~ '<end2>' \w+ }
}
role A {
method term:sym<end1>(Mu $/) { say 'end1' }
method term:sym<end2>(Mu $/) { say 'end2' }
}
sub EXPORT {
$*LANG.refine_slang: 'MAIN', G, A;
{};
}
for ^10 {
exit 42 unless run <perl6 -Isandbox/ sandbox/main>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment