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

Enhances functionality related to preprocessors #398

Merged
merged 27 commits into from
Jul 12, 2023

Conversation

NiumXp
Copy link
Contributor

@NiumXp NiumXp commented Jul 1, 2023

Goals

  • Remove preprocessor tokens
  • Add to \ be a BACKSLASH token
    • I will do it in a separated PR
  • Support for null directives
  • Parse #error
  • Parse #warning
  • Parse #pragma
  • Parse #define
  • Parse #if
  • Parse #elif
  • Parse #else
  • Parse #endif
  • Parse #include and #import
    • String path
    • Tag path
      • Recursive path
      • Support names with -, _, ., etc.
  • Add test cases for all preprocessors
  • Fix all CheckPreprocessor* rules
    • CheckPreprocessorInclude
    • CheckPreprocessorDefine
    • CheckPreprocessorIndent
    • CheckPreprocessorProtection
  • Comments (one or multiline) in preprocessor EOL

Improves

  • An error is returned when some instruction of a .h is written outside a header guard
  • An error is returned when some composed preprocessor statements (#if, #else, etc.) are not being closed or don't have a start (e.g #else without an #if)
  • "Argumented" preprocessor statements (#define, #if, etc.) now need a space after identifier (e.g #include <stdio.h>)
  • A proper error is returned when the macro defining the guard header is ok, but not in uppercase
  • Add an error when macro functions are being declared
  • Add to preprocessors be allowed only in global scope
  • Add an error when multiple header protection in given
  • Add a proper error when the guard of header protection is not defined

Fixes

Notes

...

@NiumXp NiumXp mentioned this pull request Jul 3, 2023
@NiumXp NiumXp changed the title [DRAFT] fix #396 [Help] Improve preprocessors related stuff Jul 10, 2023
@NiumXp
Copy link
Contributor Author

NiumXp commented Jul 10, 2023

The current failing test is about the file ok_ifdef.c, norminette is considering the IsFuncDeclaration as IsDeclaration, I don't know what I changed for this bug to happen, it looks like a similar bug happens in #322.

Anyway, I need help here anyone?

Solved in 00ecd0d.

@NiumXp NiumXp changed the title [Help] Improve preprocessors related stuff Enhances functionality related to preprocessors Jul 11, 2023
@NiumXp
Copy link
Contributor Author

NiumXp commented Jul 11, 2023

@matthieu42Network, could you please review it?

@matthieu42Network
Copy link
Contributor

Hello, I will ask for a 2nd approve for a PR this big then merge :)

@matthieu42Network matthieu42Network merged commit 725a1b8 into 42School:master Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants