Skip to content
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

[c] Fix for #3601 -- fix parsing of all preprocessor directives #3608

Merged
merged 2 commits into from
Jul 15, 2023
Merged

[c] Fix for #3601 -- fix parsing of all preprocessor directives #3608

merged 2 commits into from
Jul 15, 2023

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Jul 12, 2023

This is a fix for #3601.

This PR changes the lexer rules for preprocessing directives to ignore all '#' directives. The rules that were in the grammar were incomplete. The idea of parsing these lines is to get past most errors where people had not performed preprocessing--which is a lot of people. It also is required since the preprocessor added #line directives for the compiler to print out line/column error information. Again, this grammar is designed to be used on code after preprocessing.

I also added a test from the GCC testsuit, which contains preprocessor directives, and a couple of macros expanded as to parse.

@kaby76 kaby76 mentioned this pull request Jul 12, 2023
@KvanTTT KvanTTT added c example New example of file(s) parsed by grammar-generated parser labels Jul 12, 2023
@kaby76 kaby76 marked this pull request as draft July 15, 2023 07:46
@kaby76 kaby76 marked this pull request as ready for review July 15, 2023 12:17
@teverett
Copy link
Member

@kaby76 thanks

@teverett teverett merged commit 3f44239 into antlr:master Jul 15, 2023
39 checks passed
rvrooman-codelogic pushed a commit to CodeLogicIncEngineering/grammars-v4-public-fork that referenced this pull request Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c example New example of file(s) parsed by grammar-generated parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants