Request and comment.
1- regarding the syntax of the new #line, you should let file name be optional as in the third line below:
line_indicator : '(' decimal_digit+ ',' decimal_digit+ ')' '-' '(' decimal_digit+ ',' decimal_digit+ ')' decimal_digit+ whitespace file_name | '(' decimal_digit+ ',' decimal_digit+ ')' '-' '(' decimal_digit+ ',' decimal_digit+ ')' file_name | '(' decimal_digit+ ',' decimal_digit+ ')' '-' '(' decimal_digit+ ',' decimal_digit+ ')' | decimal_digit+ whitespace file_name | decimal_digit+ | 'default' | 'hidden' ;
2- the #line examples are BAD. Examples should be syntactically correct. E.g.: #line 1 10 1 15 "a" // 3 <-- should be (1, 10) - (1, 15) "a" A();B( // 4 );C(); // 5 D(); // 6
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 19676f37-72c5-ace5-f1e0-f2693c0ffe46
- Version Independent ID: ee32bc8f-4a21-dba1-5ab4-38852321190e
- Content: Enhanced #line directives - C# 10.0 draft specifications
- Content Source: proposals/csharp-10.0/enhanced-line-directives.md
- Product: dotnet-csharp
- Technology: csharp-spec
- GitHub Login: @dotnet-bot
- Microsoft Alias: wiwagn
adding @jcouv @333fred
From the spec, the filename isn't optional. Tagging @cston since he's the owner for the new #line directive
Thanks @renerod.
As @jcouv mentioned, the file name is not optional in an enhanced #line directive.
I've updated the document to fix the syntax error in the example: https://github.com/dotnet/csharplang/pull/5710.
Thanks @renerod.
As @jcouv mentioned, the file name is not optional in an enhanced
#linedirective.I've updated the document to fix the syntax error in the example: dotnet/csharplang#5710.
Thanks. I understand that in the current syntax file name is not optional. My comment/question is why not, if it was optional in the original #line <digit+> as long as it had already been declared in an earlier #line. Or am I missing something?
Closing as the original concern was addressed in dotnet/csharplang#5710.
@renerod I'm tagging @cston here to answer your follow up question.
@renerod, the expectation is that enhanced #line directives will be generated rather than written by hand, so allowing the file name to be optional, with the value inherited from the previous #line directive, is not necessary.