Created
March 10, 2017 00:15
-
-
Save TimToady/474bdc4ac6f6035015ec9745bdcdf62c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nqp; | |
grammar fee { } | |
my $b := fee."!cursor_init"("bar",:0p); | |
say "simple grammar has a " ~ nqp::getattr($b,Cursor,"\$!braid").^name; | |
nqp::getattr($b, Cursor, '$!braid')."!dump"('fee'); | |
role foo { } | |
my $l := $?LANG; | |
my $NQPCursor; | |
for $l.^mro { | |
if .^name eq 'NQPCursor' { $NQPCursor := $_; last } | |
} | |
my $c := $l.HOW.mixin($l,foo)."!cursor_init"("bar",:p(0)); | |
"mixed-in grammar attributes:".say; | |
.name.say for $c.^attributes; | |
say "Mixed in grammar .braid method returns a " ~ $c.braid.^name; | |
nqp::getattr($l, $NQPCursor, '$!braid')."!dump"('foo'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment