Add support for - as a prefix operator (e.g. -(1+2)). There is currently support for it but only as a part of a literal.
So currently this is allowed:
And this is not:
And this is interpreted incorrectly:
-1**2 # Gives 1.0 ((-1)**2), should give -1.0 (-(1**2))
So we need to:
- Add code for the prefix operator
- (** < precedence < */)
- TODO: need to add some special cases to ensure that
2**-1 and 2**-3**-2. Python does this using:
prefixop = '-' power | '+' power | ...
power = primary '**' prefixop
primary = ... | '(' ... ')' | ...
Add support for
-as a prefix operator (e.g.-(1+2)). There is currently support for it but only as a part of a literal.So currently this is allowed:
And this is not:
And this is interpreted incorrectly:
So we need to:
-(**< precedence <*/)2**-1and2**-3**-2. Python does this using: