-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple '+' or '-' prefix operators in a row should be disallowed #982
Comments
I agree. If I remember correctly, |
Yeah, it works accidentally, it shouldn't. I would highly advise you to go through your code and replace all instances it appears in, I will make it an error soon. |
|
I was just about to. :) |
@vendethiel |
change the rule of unary operator to I'm trying to make the error message more clear |
Could be done with something like:
|
@Shamanas
|
I'm not too sure how I don't know, so I'm probably wrong though :) |
I think @Shamanas is right: I think this was the right idea:
..except why can't it live in a separate PRE_INCREMENT / POST_INCREMENT rule? It might feel silly to actively look out for an operator we don't support, but that's the price to pay for having clear error messages, I guess. |
If it lived in a PRE_INCREMENT rule, we should do something like:
Anyways right? To me, Anyway, it's just a little trick for better error reporting, this can be fixed in better ways (but with bad error reporting :P) |
not necessarily, you can have several rules that start with '+', as long as unary plus has a (then again I haven't touched nagaqueen in a while) |
Sure, I don't disagree. Anyway, I think it's just a question of style, I don't lean in any direction too much :P |
Currently, using two '+'s or '-'s in a row causes rock to produce a postfix increment/decrement operator in the resulting C code.
Semantically, there is no reason in particular why it should be allowed anyways, it just causes confusion since ooc is a C family language but we have no increment/decrement operators.
The text was updated successfully, but these errors were encountered: