-
Notifications
You must be signed in to change notification settings - Fork 20
Add #ifdef/#ifndef parsing
#135
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #135 +/- ##
==========================================
+ Coverage 92.74% 92.95% +0.21%
==========================================
Files 21 21
Lines 2384 2427 +43
==========================================
+ Hits 2211 2256 +45
+ Misses 173 171 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f12ecfd to
f66bf5b
Compare
|
HI schamper, thanks for the changes. It still not work on my end, what is a little bit strange. But if i modify the regexp: From: TOK.add(r"#ifndef\s+(?P<name>[^\s]+)\s*(?=\s)", "IFNDEF")To: TOK.add(r"#ifndef\s+(?P<name>[^\s]+)\s*", "IFNDEF")Then runs my example. ChatGPT explains in that way:
This version will correctly match #ifndef __MYGUARD whether or not there is a space after __MYGUARD. |
f66bf5b to
cda868c
Compare
|
I just tab-completed those patterns from Copilot so I'm blaming AI 😄. Changed it. |
|
Another hint, if i run |
cda868c to
f382fb9
Compare
|
Fixed. |
|
With cda868c it looks really good, it can handle define guards and also all unit tests. Great work :) Thanks |
Miauwkeru
left a comment
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.
I did found a condition where I expected the parser to break, but it just continued
#ifndef __HELP
#define __HELP
#ifndef __MY_CONST
struct test {
uint32 a;
};
#endifIs it an idea to check the length of self._conditionals and _conditional_depth at the end of the parsing, to see whether the conditionals where actually closed.
b89b4db to
758ce48
Compare
758ce48 to
0e2918c
Compare
Fixes #125