Created
March 30, 2015 22:06
-
-
Save jnthn/36054887e166cf0e35f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.nqp b/src/Perl6/Actions.nqp | |
index 5a92c57..0ce6e26 100644 | |
--- a/src/Perl6/Actions.nqp | |
+++ b/src/Perl6/Actions.nqp | |
@@ -3538,18 +3538,13 @@ class Perl6::Actions is HLL::Actions does STDActions { | |
} | |
method capterm($/) { | |
- # Construct a Parcel, and then call .Capture to coerce it to a capture. | |
- my $past := $<termish> ?? $<termish>.ast !! | |
- $<capture> ?? $<capture>.ast !! | |
- QAST::Op.new( :op('call'), :name('&infix:<,>') ); | |
- unless $past.isa(QAST::Op) && $past.name eq '&infix:<,>' { | |
- $past := QAST::Op.new( :op('call'), :name('&infix:<,>'), $past ); | |
- } | |
- make QAST::Op.new( :op('callmethod'), :name('Capture'), $past); | |
- } | |
- | |
- method capture($/) { | |
- make $<EXPR>.ast; | |
+ my $past := $<termish> | |
+ ?? QAST::Op.new( $<termish>.ast ) | |
+ !! $<semiarglist>.ast; | |
+ $past.unshift(QAST::WVal.new( :value($*W.find_symbol(['Capture']) ) )); | |
+ $past.op('callmethod'); | |
+ $past.name('from-args'); | |
+ make $past; | |
} | |
method multisig($/) { | |
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp | |
index c21c233..e449bb6 100644 | |
--- a/src/Perl6/Grammar.nqp | |
+++ b/src/Perl6/Grammar.nqp | |
@@ -2804,16 +2804,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | |
token capterm { | |
'\\' | |
[ | |
- | '(' <.ws> <capture>? ')' | |
+ | '(' <semiarglist> ')' | |
| <?before \S> <termish> | |
| {} <.panic: "You can't backslash that"> | |
] | |
} | |
- rule capture { | |
- <EXPR> | |
- } | |
- | |
rule param_sep { | |
'' $<sep>=[','|':'|';;'|';'] { @*seps.push($<sep>) } | |
} | |
diff --git a/src/core/Capture.pm b/src/core/Capture.pm | |
index 2d95c17..816a330 100644 | |
--- a/src/core/Capture.pm | |
+++ b/src/core/Capture.pm | |
@@ -7,6 +7,8 @@ my class Capture { # declared in BOOTSTRAP | |
nqp::create(self).BUILD(:@list,:%hash); | |
} | |
+ method from-args(|c) { c } | |
+ | |
submethod BUILD(:@list, :%hash) { | |
nqp::bindattr(self, Capture, '$!list', | |
nqp::getattr(nqp::decont(@list.Parcel), Parcel, '$!storage') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment