Permalink
Browse files

Wire reduce meta op up to use the new reducewith that can handle chai…

…ning, triangle form and right-associative ops.
  • Loading branch information...
1 parent 9a20634 commit 3469ffe042f2b2f749a163cbdb80289120d06a51 @jnthn jnthn committed Apr 2, 2010
Showing with 6 additions and 3 deletions.
  1. +5 −2 src/Perl6/Actions.pm
  2. +1 −1 src/Perl6/Grammar.pm
View
@@ -2051,8 +2051,11 @@ method prefix_circumfix_meta_operator:sym<reduce>($/) {
PAST::Var.new( :name($opsub), :scope('package') ),
PAST::Op.new(
:pasttype('callmethod'), :name('assuming'),
- PAST::Op.new( :pirop('find_sub_not_null__Ps'), '&reduce' ),
- PAST::Op.new( :pirop('find_sub_not_null__Ps'), $base_op )
+ PAST::Op.new( :pirop('find_sub_not_null__Ps'), '&reducewith' ),
+ PAST::Op.new( :pirop('find_sub_not_null__Ps'), $base_op ),
+ PAST::Val.new( :named('triangle'), :value($<triangle> ?? 1 !! 0) ),
+ PAST::Val.new( :named('chaining'), :value($<op><OPER><O><prec> eq 'm=') ),
+ PAST::Val.new( :named('right-assoc'), :value($<op><OPER><O><assoc> eq 'right') )
)
));
%*METAOPGEN{$opsub} := 1;
View
@@ -1174,7 +1174,7 @@ regex prefix_circumfix_meta_operator:sym<reduce> {
'['
[
|| <op=.infixish> <?before ']'>
-# || \\<op=.infixish> <?before ']'>
+ || $<triangle>=[\\]<op=.infixish> <?before ']'>
|| <!>
]
']'

0 comments on commit 3469ffe

Please sign in to comment.