Closed lucaswerkmeister closed 9 years ago
And for symmetry, let’s even add a space in the slightly less ambiguous case of i++-i
.
In fact, let’s not even care about pre- or postfix, ‘cause I think -i--
is still problematic.
Not enough, because the ^
operator has precedence between prefix -
and --
, i. e. - --i ^ j
.
OTOH, -i ^ j
(as we output now) is also really confusing, so let’s just add a space any time the term isn’t a Primary
.
At the moment,
- --i
is formatted as---i
, which the compiler lexes as-- -i
instead. We should put a space in there.In fact, even when the syntax works out, we should add a space to avoid confusion:
All four printed expressions are valid, and I have no idea as which of the latter three the first one is parsed.