-
Notifications
You must be signed in to change notification settings - Fork 72
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
Macros apparently have higher precedence than numbers #183
Comments
I guess this is not a bug. The preprocessor works first, and it does not analize the code. To fix the problem we need to rewrite the preprocessor. |
Which is it? If I write: #define xFF
new AxFF = 255;
new a = AxFF;
printf("%d", a); // Prints 255 That is fine, because macros don't match in the middle of symbols, so they probably shouldn't match in the middle of valid numbers either. |
Sorry) Yeah, the preprocessor skips all non-alphabetic characters here: https://github.com/Zeex/pawn/blob/master/source/compiler/sc2.c#L1772-L1780 |
Don't skip if have #define test -
0test
10test
_0test Output:
|
|
Yeah is just a example, what i want to say is if as any character before number, don't match. |
What i tried #define hook%1(%2) forward UNIQUE_FUNCTION<@yH0%1@...>(%2);UNIQUE_FUNCTION<@yH0%1@...>(%2)
// Strip out extra spaces (nicely recursive)
#define @yH0%0\32;%1(%2) @yH0%1(%2)
#define tag:: tag_
hook tag::function() Changed |
That probably shouldn't happen, but only if the symbol is a valid part of a number and used as such. I quite like this, that I saw in a recent include:
In that case,
5_
is not possibly a valid number so should be replaced; while things like0x
,0b
, or5e
could be so shouldn't be.The text was updated successfully, but these errors were encountered: