Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make o left associative
This allows [\o] &cos xx * to work.
  • Loading branch information
TimToady committed Oct 6, 2015
1 parent 164953b commit 54746f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -3981,8 +3981,6 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}

token infix:sym<**> { <sym> <O('%exponentiation')> }
token infix:sym<∘> { <sym> <O('%exponentiation')> }
token infix:sym<o> { <sym> <O('%exponentiation')> }

token prefix:sym<+> { <sym> <O('%symbolic_unary')> }
token prefix:sym<~~> { <sym> <.dupprefix('~~')> <O('%symbolic_unary')> }
Expand Down Expand Up @@ -4043,6 +4041,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
[<-alpha> <.obs('. to concatenate strings', '~')>]?
<O('%dottyinfix')>
}
token infix:sym<∘> { <sym> <O('%concatenation')> }
token infix:sym<o> { <sym> <O('%concatenation')> }

token infix:sym<&> { <sym> <O('%junctive_and, :iffy<1>')> }
token infix:sym<(&)> { <sym> <O('%junctive_and')> }
Expand Down
4 changes: 3 additions & 1 deletion src/core/operators.pm
Expand Up @@ -631,7 +631,9 @@ sub infix:<orelse>(**@a) {
$current;
}

sub infix:<∘> (&f, &g --> Block) { (&f).count > 1 ?? -> |args { f |g |args } !! -> |args { f g |args } }
multi sub infix:<∘> () { *.self }
multi sub infix:<∘> (&f) { &f }
multi sub infix:<∘> (&f, &g --> Block) { (&f).count > 1 ?? -> |args { f |g |args } !! -> |args { f g |args } }
my &infix:<o> := &infix:<∘>;

# vim: ft=perl6 expandtab sw=4

0 comments on commit 54746f2

Please sign in to comment.