Skip to content

Instantly share code, notes, and snippets.

@colomon
Created June 27, 2012 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colomon/3005906 to your computer and use it in GitHub Desktop.
Save colomon/3005906 to your computer and use it in GitHub Desktop.
| :dba('infixed function') <?before '[' <[&\$]> <twigil>? [<alpha>|'('] > '[' ~ ']' <infix=.variable>
{ $O = $<infix><O> // <O(|%additive)>; $sym = $<infix>; }
method infixish($/) {
if $<colonpair> || $<regex_infix> {
return Nil; # handled elsewhere
}
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;
} else {
make $<infix>.ast;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment