This repository has been archived by the owner on Feb 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Close #356 - Add whitespace token for preprocessor #437
Merged
Merged
Changes from 12 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
295337d
Added whitespace token and made -E keep spacing, TODO consume whitespace
hdamron17 1514108
Filtered whitespace before parser, TODO debug a lot of test cases
hdamron17 33f9f12
Fix some bugs in whitespace handling
jyn514 dd628bf
Merge branch 'master' into preprocessor-whitespace
hdamron17 30be8d9
Add a oneline whitespace consumtion after #ifdef, #ifndef, #undef
hdamron17 60db031
Consume whitespace between function macro args
hdamron17 30eac7f
Fixed most of lex::tests::*
hdamron17 f0c146e
Handle lex::tests::test_no_newline
hdamron17 8e0509e
Changed analyze::test::lol to not have leading newline
hdamron17 01f040b
Added whitespace between hash and directive
hdamron17 d51af7e
Remove trailing newline for -E
hdamron17 f671f65
Handle spaces in defines and whitespace in comments
hdamron17 36b7fc3
Handle lex::tests::test_no_newline (again)
hdamron17 675989b
Fix error messages for macros and #ifdef
hdamron17 1d5578f
Rework whitespace in tokens_until_newline
hdamron17 c1aa84a
De Morgan
hdamron17 81d47d9
cargo fmt
hdamron17 bbbb3ab
Add a few tests for preprocess only with exact matching
hdamron17 46b4943
Make Whitespace matches consistently use ..
hdamron17 78ad8fc
Fixed issue with whitespace at beginning of analyze::test::lol in `pa…
hdamron17 8c4f568
Clean up filter_map thanks to @jyn514
hdamron17 0e055b9
Get tokens_until_newline to do what it's name suggests and other whit…
hdamron17 3a9cd4a
More preprocess_only tests
hdamron17 6d084cd
Merge two versions of `is_not_whitespace`
hdamron17 0d03378
Do not assume there is whitespace between define id and body
hdamron17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do you add these spaces here in the define? Does
tokens_until_newline
not return whitespace tokens?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.
tokens_until_newline
(at the moment) does not include whitespace tokens. I did not want to change it since it is somewhat separate from the preprocessor. I can try adding whitespace tokens to it and see what happens now that it is in a stable state. I did notice thatclang
only puts one space when replacing preprocessor defines, regardless of the original spacing.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.
Hmm interesting ... I suppose since the behavior is correct we can try to go back and improve the spacing later.
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.
Also, please add a comment to this effect either here or at
tokens_until_newline
.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 actually went back and did it the proper way by changing tokens_until_newline. Unfortunately I had to rework some stuff for boolean_expr because whitespace show up in the replacement stage. I'll push as soon as I double check the tests. Also, I think the rework will be much less of an eyesore.