-
Notifications
You must be signed in to change notification settings - Fork 106
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
fix: rework translation-unit top-level items to disallow binary expressions #146
Conversation
@amaanq no additional testcases, sorry, but this one should be sufficient. |
414cc4d
to
6a11836
Compare
@amaanq actually, I might have one - |
6a11836
to
0a76efd
Compare
That one seems to work on master, but good to add |
8a57c83
to
5897d88
Compare
@@ -649,6 +680,36 @@ module.exports = grammar({ | |||
$._statement, | |||
), | |||
|
|||
// This is missing binary expressions, others were kept so that macro code can be parsed better and code examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good to say why we skipped binary expressions. what's the problem with binary expression at the top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's because of this ambiguity with pointer expressions, could have been solved in another way? by playing with dynamic priorities?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I did try a lot w/ dynamic precendences, but that caused other issues elsewhere mainly and sometimes didn't do anything as well
5897d88
to
b1b0fad
Compare
b1b0fad
to
1bb93aa
Compare
reworked |
I'm not sure about that one, I think it is correct to associate the pointer declarator with a function name/identifier |
This resolves conflicts with declarations that can be interpreted as binary_expressions
Previously, pointers were associated with the function identifier, now they're associated with the return type
1bb93aa
to
0df358a
Compare
I reworked it anyways just for top level functions..if that proves to be incorrect/disputed I will revert @XVilka |
Actually, that breaks error recovery a bit in upstream tests and still doesn't fit fully right w/ me, so I reverted it, sorry. That needs a better solution than what I had |
Closes #48
I don't like how this looks with the nearly repeated rule, but it's the best option I could think of that didn't impact state count too much, maybe some JS-magic could make it look prettier with manipulating top_level_item
@XVilka if you have some more test cases I could add them
cc @ahlinc