pratt: operators: unary minus loses to power
This is to make it work in accordance with python which gives us: `assert -2 ** 2 == -4`
This commit is contained in:
parent
e146766cdc
commit
399150be15
|
@ -12,9 +12,9 @@ OP( PLUS_PLUS, 130, 120, PREFIX_POSTFIX, ++, '+', '+', 0)
|
|||
OP(MINUS_MINUS, 130, 120, PREFIX_POSTFIX, --, '-', '-', 0)
|
||||
OP( NOT, 130, -1, PREFIX, !, '!', 0)
|
||||
OP( BIT_NOT, 130, -1, PREFIX, ~, '~', 0)
|
||||
OP( PLUS, 120, 90, PREFIX_INFIX, +, '+', 0)
|
||||
OP( MINUS, 120, 90, PREFIX_INFIX, -, '-', 0)
|
||||
OP( POWER, -1, 110, POWER, PLACEHOLDER, '*', '*', 0)
|
||||
OP( PLUS, 110, 90, PREFIX_INFIX, +, '+', 0)
|
||||
OP( MINUS, 110, 90, PREFIX_INFIX, -, '-', 0)
|
||||
OP( POWER, -1, 120, POWER, PLACEHOLDER, '*', '*', 0)
|
||||
OP( TIMES, -1, 100, INFIX, *, '*', 0)
|
||||
OP( DIVIDES, -1, 100, INFIX, /, '/', 0)
|
||||
OP( MODULO, -1, 100, INFIX, %, '%', 0)
|
||||
|
|
Loading…
Reference in a new issue