-
-
Save perlpilot/2777720 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
#!/usr/bin/env perl6 | |
sub sprint( Match:D $m, $nm='TOP', $indent is copy = 0) { | |
sub i { ' ' x ($indent * 2) } | |
sub show(Str $s) { $s.substr(0, 30).perl; } | |
my $s = ''; | |
$s = i() ~ "$m.from() $m.to() $nm " ~ show( ~$m) ~ "\n"; | |
# for $m.caps { | |
$s ~= sprint $_.value, $_.key, $indent + 1 if $_.value ~~ Match for $m.caps; | |
# } | |
$s; | |
} | |
"foo bar baz" ~~ m:s/ (\w+) ((\w)+) (\w+) /; | |
say sprint($/); |
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
➤ ./perl6 foo | |
0 11 TOP "foo bar baz" | |
0 3 0 "foo" | |
4 7 1 "bar" | |
4 5 0 "b" | |
5 6 0 "a" | |
6 7 0 "r" | |
8 11 2 "baz" |
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
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm | |
index 2ea20e9..5a93bd7 100644 | |
--- a/src/Perl6/Actions.pm | |
+++ b/src/Perl6/Actions.pm | |
@@ -552,7 +552,7 @@ class Perl6::Actions is HLL::Actions { | |
PAST::Op.new( | |
:pasttype<callmethod>, :name<map>, :node($/), | |
PAST::Op.new(:name('&infix:<,>'), $cond), | |
- $past | |
+ block_closure($past) | |
)); | |
} | |
else { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment