Skip to content

Commit

Permalink
unbotch MINUS SIGN patch
Browse files Browse the repository at this point in the history
helps to put the right precedence level and arity...
  • Loading branch information
TimToady committed Dec 18, 2015
1 parent 3d8d56a commit b050d5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Perl6/Grammar.nqp
Expand Up @@ -4045,8 +4045,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token prefix:sym<+> { <sym> <O('%symbolic_unary')> }
token prefix:sym<~~> { <sym> <.dupprefix('~~')> <O('%symbolic_unary')> }
token prefix:sym<~> { <sym> <O('%symbolic_unary')> }
token prefix:sym<-> { <sym> <![>]> <O('%symbolic_unary')> }
token prefix:sym<βˆ’> { <sym> <![>]> <O('%symbolic_unary')> }
token prefix:sym<-> { <sym> <O('%symbolic_unary')> }
token prefix:sym<βˆ’> { <sym> <O('%symbolic_unary')> }
token prefix:sym<??> { <sym> <.dupprefix('??')> <O('%symbolic_unary')> }
token prefix:sym<?> { <sym> <!before '??'> <O('%symbolic_unary')> }
token prefix:sym<!> { <sym> <!before '!!'> <O('%symbolic_unary')> }
Expand Down Expand Up @@ -4088,7 +4088,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<sym> [<?before '>>'> || <![>]>]
<O('%additive')>
}
token infix:sym<βˆ’> { <sym> <![>]> <O('%symbolic_unary')> }
token infix:sym<βˆ’> { <sym> <O('%additive')> }
token infix:sym<+|> { <sym> <O('%additive')> }
token infix:sym<+^> { <sym> <O('%additive')> }
token infix:sym<~|> { <sym> <O('%additive')> }
Expand Down
8 changes: 5 additions & 3 deletions src/core/Numeric.pm
Expand Up @@ -41,7 +41,7 @@ multi sub prefix:<+>(\a) { a.Numeric }
proto sub prefix:<->($?) is pure { * }
multi sub prefix:<->(\a) { -a.Numeric }

sub prefix:<βˆ’>(|c) is pure { prefix:<->(|c) }
sub prefix:<βˆ’>($n) is pure { prefix:<->($n) }

proto sub abs($) is pure { * }
multi sub abs(\a) { abs a.Numeric }
Expand Down Expand Up @@ -186,10 +186,12 @@ multi sub infix:<+>($x = 0) { $x.Numeric }
multi sub infix:<+>(\a, \b) { a.Numeric + b.Numeric }

proto sub infix:<->(Mu $?, Mu $?) is pure { * }
multi sub infix:<->($x = 0) { $x.Numeric }
multi sub infix:<->($x = 0) { -$x.Numeric }
multi sub infix:<->(\a, \b) { a.Numeric - b.Numeric }

sub infix:<βˆ’>(|c) is pure { infix:<->(|c) }
proto sub infix:<βˆ’>(Mu $?, Mu $?) is pure { * }
multi sub infix:<βˆ’>($x = 0) { -$x.Numeric }
multi sub infix:<βˆ’>(\a, \b) is pure { a.Numeric - b.Numeric }

proto sub infix:<*>(Mu $?, Mu $?) is pure { * }
multi sub infix:<*>($x = 1) { $x.Numeric }
Expand Down

0 comments on commit b050d5e

Please sign in to comment.