[cpp.line] Simplify specification of line directives#8354
Draft
AlisdairM wants to merge 1 commit into
Draft
Conversation
This change set addresses a variety of concerns to produce a simpler and clearer specification for line directives. The first issue to address is that the specification refers to a _string-literal_ that is not present in the grammar. Howeer, the constraints on that string literal are sufficient to replace that quoted _s-char-sequence_ in the grammar production with _string-literal_. The line directive itself is given its own grammar production that formally states what used to be described in text restrictions and interprettions of the generic sequence of preprocessing tokens. Refactoring the grammar as its own production provides a simpler way for incoming proposals to refer to line directives, such as https://wg21.link/P3868.
Member
|
Remark (not necessarily dispositive): The status quo still has a good match with the C phrasing; this change would kill that correspondence. Other than that, the funny presentation of the preprocessor grammar in the status quo has at least two useful properties that we would lose with the reformulation:
|
Contributor
Author
|
The grammar is disambiguated the same way that we do for The control-line issue is a genuine issue that I missed and should consider more carefully. That should also be a concern for #8249. |
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.
This change set addresses a variety of concerns to produce a simpler and clearer specification for line directives. It makes no functional changes, but changes words sufficiently to require a Core review. A motivation behind this PR is to simplify the changes for the proposal to allow line directives before the global module fragment, https://wg21.link/P3868.
The line directive is given its own grammar production that formally states what used to be described in text restrictions and interpretations of the generic sequence of preprocessing tokens.
The other issue to address is that the specification refers to a string-literal that is not present in the grammar. However, the constraints on that string literal are sufficient to replace that quoted s-char-sequence in the grammar production with string-literal.