[lex.comment] Add a note that comments are replaced by a single space#8414
Closed
AlisdairM wants to merge 1 commit into
Closed
[lex.comment] Add a note that comments are replaced by a single space#8414AlisdairM wants to merge 1 commit into
AlisdairM wants to merge 1 commit into
Conversation
Add a note about the transience of comments, that are immediately replaced by space characters as they are parsed.
12f80ed to
275b35c
Compare
jensmaurer
requested changes
Dec 6, 2025
Comment on lines
+529
to
+531
| Comments are turned into \unicode{0020}{space} characters in | ||
| phase 3 of translation as part of decomposing a source file into | ||
| preprocessing tokens and sequences of whitespace characters. |
Member
There was a problem hiding this comment.
lex.phases p3 says a bit much in that location.
Maybe it's better to move the normative provision "Each comment (5.4) is replaced by one u+0020 space character." here or into lex.pptoken, possibly as part of the "whitespace grammar" paper.
Contributor
Author
There was a problem hiding this comment.
I was reluctant to touch the phases of translation more than necessary in P3657, the whitespace grammar paper. However, if we prefer that direction I will updated the next revision of that paper and close this PR.
Contributor
Author
|
Will propose more significant changes as part of P3657. |
AlisdairM
added a commit
to AlisdairM/draft
that referenced
this pull request
Dec 9, 2025
The specification of phase 3 of translation says too much about how things are done rather than what is done. Per suggestions on PR cplusplus#8414, move the precise handling of comments to [lex.comment]. As this move relies on the specificatin for whitespace, move the definition of whitespace from [lex.pptoken] to [lex.comment] too.]
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add a note about the transience of comments, that are immediately replaced by space characters as they are parsed.