Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Wire reduce meta op up to use the new reducewith that can handle chai…
…ning, triangle form and right-associative ops.
  • Loading branch information
jnthn committed Apr 2, 2010
1 parent 9a20634 commit 3469ffe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Perl6/Actions.pm
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Grammar.pm
Expand Up @@ -1174,7 +1174,7 @@ regex prefix_circumfix_meta_operator:sym<reduce> {
'['
[
|| <op=.infixish> <?before ']'>
# || \\<op=.infixish> <?before ']'>
|| $<triangle>=[\\]<op=.infixish> <?before ']'>
|| <!>
]
']'
Expand Down

0 comments on commit 3469ffe

Please sign in to comment.