-
Notifications
You must be signed in to change notification settings - Fork 86
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
Correct 2 x grammar rules for compilation unit name in #line #1120
base: draft-v8
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1488,12 +1488,12 @@ fragment PP_Line_Indicator | |
; | ||
|
||
fragment PP_Compilation_Unit_Name | ||
: '"' PP_Compilation_Unit_Name_Character+ '"' | ||
: '"' PP_Compilation_Unit_Name_Character* '"' | ||
; | ||
|
||
fragment PP_Compilation_Unit_Name_Character | ||
// Any Input_Character except " | ||
: ~('\u000D' | '\u000A' | '\u0085' | '\u2028' | '\u2029' | '#') | ||
: ~('\u000D' | '\u000A' | '\u0085' | '\u2028' | '\u2029' | '"') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The However §22.5.6.3 defines the format of the compilation unit name/file path as “implementation-dependent”. So this section might need a semantic rule saying this arbitrary string must conform to the same implementation-dependent rules §22.5.6.3, or that is does not need to (i.e. not be valid as a file path). |
||
; | ||
``` | ||
|
||
|
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.
We should check this is by design before making this change. Regardless of the answer there is probably some work to do:
A.cs
andB.cs
and refers to them as two compilation units.#line
directives ([§6.5.8]”.#line
allows the setting of the “compilation unit name”What already exists isn’t overly clear and this change seeks to allow the compilation unit name to be the empty string, which is probably not a valid implementation-dependent path on any implementation… So if this
observed compiler behaviour is by design then it surely needs to have a defined meaning in the Standard.
If this change is to be made, and even if not, this all needs to tided up – either in this PR or spin it all off into a new one.
I might ask what the intended use of an empty file path/compilation unit name is but I might know – it was requested by the NSA so that the file names in NSA distributed software is not leaked and so endanger National Security! I’m only partially joking here, but that’s a story for another time ;-)
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.
@BillWagner told me that allowing an empty string was indeed a conscious decision, so I propose keeping that edit.
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.
@Nigel-Ecma
§6.1 Programs states:
I propose appending to this, the following:
I'm deliberately avoiding using any of the following terms: