Permalink
Browse files

Implementation of [&func] 2-arity function to operator.

  • Loading branch information...
colomon committed Jun 28, 2012
1 parent b5cc8a1 commit 40e422da527de4564c9df019dceea13cf488369a
Showing with 9 additions and 1 deletion.
  1. +7 −1 src/NieczaActions.pm6
  2. +2 −0 src/STD.pm6
View
@@ -1492,7 +1492,13 @@ method infixish($/) {
return Nil; # handled elsewhere
}
- if $<assign_meta_operator> {
+ if $<infix>.reduced eq 'variable' { # ie $<infix> is a variable
+ my $ast = $Operator_Function.new(function =>
+ self.do_variable_reference($/, $<infix>.ast),
+ :arity(2));
+ self.check_variable($<infix>);
+ make $ast;
+ } elsif $<assign_meta_operator> {
# TODO: there should probably be at least a potential for others
make $<infix>.ast.meta_assign;
View
@@ -3130,6 +3130,8 @@ grammar P6 is STD {
| [
| :dba('bracketed infix') '[' ~ ']' <infix=.infixish('[]')> { $O = $<infix><O>; $sym = $<infix><sym> }
[ <!before '='> { self.worry("Useless use of [] around infix op") unless $*IN_META; } ]?
+ | :dba('infixed function') <?before '[' <[&\$]> <twigil>? [<alpha>|'('] > '[' ~ ']' <infix=.variable>
+ { $O = $<infix><O> // %additive; $sym = $<infix>; }
| <infix=infix_circumfix_meta_operator> { $O = $<infix><O>; $sym = $<infix><sym>; }
| <infix=infix_prefix_meta_operator> { $O = $<infix><O>; $sym = $<infix><sym>; }
| <infix> { $O = $<infix><O>; $sym = $<infix><sym>; }

0 comments on commit 40e422d

Please sign in to comment.