Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[lex.pptoken] Separate out placeholder keywords #7381

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlisdairM
Copy link
Contributor

The preprocessing-token term is defined as one of another set of grammar productions, with the three placeholder tokens standing out as specific single tokens.

Moving the placeholder tokens into their own production simplifies both the preprocessing-token and keyword grammar productions, plus it guarantees a consistency for the set of placeholder between both places. IT also makes it easier for [cpp] to directly cross-reference where needed.

Pedantically, the term placeholder token itself is problematic as tokens are a phase 7 concern, where they become keywords. Within the earlier phases where these placeholders are used the correct term is a preprocessing token, so strictly these should be placeholder preprocessing tokens, which is a mouthful. So renaming the term to placeholder keyword, which is hopefully less of a concern as there are no keywords in phase 3--6 to confuse with phase 7 keywords.

Finally, clean up the informative list in text of the various kinds of preprocessing tokens, rendering as a list in the source (one kind per line) and adding a cross-reference to each such item.

The _preprocessing-token_ term is defined as one of another set of
grammar productions, with the three placeholder tokens standing out
as specific single tokens.

Moving the placeholder tokens into their own production simplifies
both the _preprocessing-token_ and _keyword_ grammar productions,
plus it guarantees a consistency for the set of placeholder between
both places.  IT also makes it easier for [cpp] to directly
cross-reference where needed.

Pedantically, the term placeholder token itself is problematic as
tokens are a phase 7 concern, where they become keywords.  Within
the earlier phases where these placeholders are used the correct
term is a preprocessing token, so strictly these should be
placeholder preprocessing tokens, which is a mouthful.  So renaming
the term to placeholder keyword, which is hopefully less of a
concern as there are no keywords in phase 3--6 to confuse with
phase 7 keywords.

Finally, clean up the informative list in text of the various kinds
of preprocessing tokens, rendering as a list in the source (one kind
per line) and adding a cross-reference to each such item.
@jensmaurer
Copy link
Member

Are these "placeholder keywords" or rather "keyword placeholders"?

@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Nov 11, 2024
@AlisdairM
Copy link
Contributor Author

Are these "placeholder keywords" or rather "keyword placeholders"?

That is a good question. In phases 3 and 4 the emphasis is on placeholder. In phase 7 the emphasis is on keyword. In both cases we are dealing with the same ephemeral. notion of token-but-not-otherwise-representable-in-the-grammar.

I believe the refactoring of my PR is helpful, and am happy if we find better vocabulary to revise it.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants