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

Implement parser for #include preprocessor directive #110

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

ChAoSUnItY
Copy link
Collaborator

@ChAoSUnItY ChAoSUnItY commented Feb 21, 2024

  • Implement actual parser for #include preprocessor directive to avoid potential syntax error.
    • While the parser is implemented, the actual "including" functionality is still implemented in other place.

@jserv jserv requested a review from vacantron February 21, 2024 02:52
jserv

This comment was marked as outdated.

@ChAoSUnItY ChAoSUnItY requested a review from jserv February 21, 2024 03:35
@ChAoSUnItY ChAoSUnItY changed the title Enhance preprocessor directive parsing Implement parser for #include preprocessor directive & constant evaluation for #if and #elif Feb 22, 2024
@jserv
Copy link
Collaborator

jserv commented Feb 22, 2024

Can you decouple "Implement parser for #include preprocessor directive & constant evaluation for #if and #elif" into two pull requests? So that, it is more straightforward for reviewing.

tests/driver.sh Outdated Show resolved Hide resolved
src/parser.c Outdated Show resolved Hide resolved
@ChAoSUnItY ChAoSUnItY changed the title Implement parser for #include preprocessor directive & constant evaluation for #if and #elif Implement parser for #include preprocessor directive Feb 23, 2024
Copy link
Collaborator

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve the git commit message. You should address the limitation of the proposed change.

@jserv jserv requested a review from vacantron February 23, 2024 00:25
Copy link
Collaborator

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't indent git commit messages. For example, instead of writing "- This syntax parser can parse 2 forms," simply write "This syntax parser can parse 2 forms." without the leading - .
  2. Avoid using backticks in git commit messages. Instead, use (double) quotation marks. This approach ensures compatibility with most editors.

This syntax parser can parse 2 forms of #include, including '#include
"header.h"' (string path form) and '#include <header.h>' (system
defined path form), the former one is guaranteed to be always parsed,
however, the later one is not guaranteed will be always successfully
parsed due to lack of platform support.
@jserv jserv merged commit 23701e3 into sysprog21:master Feb 23, 2024
4 checks passed
@jserv
Copy link
Collaborator

jserv commented Feb 23, 2024

Thank @ChAoSUnItY for contributing!

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.

3 participants