-
Notifications
You must be signed in to change notification settings - Fork 760
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
[lex] Reorganize contents to follow grammar and phases of translation #7193
Conversation
417dbb4
to
4440e73
Compare
Is this kind of internal reorganization of a clause still in scope for C++26? If not, please flag with the C++29 milestone. If only parts are in scope (I am thinking specifically of moving [lex.comment]) I can break them out into separate PRs. |
Also, needs a rebase! |
I think shuffling around stuff inside [lex] is still possible for C++26 if we want to do that. Moving [lex.comment] earlier seems like a no-brainer; we can do that right away if we wanted to. For the rest: @AlisdairM , could you please show the new section order in a comment here, e.g. as a screenshot of the table of contents or so? It's hard to reconstruct that from the github diff view. And I think I want some CWG input (or at least awareness) for the new order. |
Let's land that first then and appraise the remainder of the proposal afterwards. |
See #7315 for moving [lex.comment], I will remove that part before rebasing and pushing this PR again, and presenting the new clause ordering more clearly. per Jens comment above. |
This branch has now been rebased so can lose the "needs rebase" tag. |
I have updated the initial comment with the intended section outline, and an alternative that I prefer that simple adds another level of grouping, with no additional text. |
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.
Ok, trusting the "nothing but text reshuffling" presentation, I think this is an improvement.
The additional subclause nesting suggested in the intro text (but not actually realized in the pull request) seems questionable without also splitting identifier into pp-identifier.
Trust, but verify! |
The clean version of this branch, without discussion of the optional deeper nesting, is rebased and ready for review/landing at #7316 |
This PR purely moves existing words around, and does not create any new content. It would be the precursor to a larger change set that might integrate [cpp] into lex, or move it adjactent, and similarly move [modules] adjactent.
This may be more significant than we want to land in C++26, but I offer it while time is still available, and as inspiration for the C++29 reorg otherwise.
Note in particular that it does a much better job at retaining the floating tables within the relevant text, rather than floating onto the next page and invading a different subclause.
The proposed subclause ordering is now:
A bigger change, similar to introducing 5.3 Characters, would be to introduce two new 2nd level sections to group "Preprocessor tokenization" and "Translation unit tokenization":
This structure would allow for C++29 to tackle some of the more awkward dual-purpose parts of the grammar, such as string and character literals being preprocessor tokens, suggesting they would be extracted into 5.5, and recognizing that just as pp-tokens and tokens are different, we might want to introduce pp-identifier for the preprocessor to distinguish from identifier in the rest of the language.
I have deferred pushing the version with the extra levels unless there is strong interest for C++26, as at a quick glance it appears to be a more radical restructuring than it really is.