docs icon indicating copy to clipboard operation
docs copied to clipboard

Request and comment.

Open renerod opened this issue 4 years ago • 6 comments

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.

renerod avatar Jan 27 '22 15:01 renerod

adding @jcouv @333fred

BillWagner avatar Jan 31 '22 14:01 BillWagner

From the spec, the filename isn't optional. Tagging @cston since he's the owner for the new #line directive

jcouv avatar Jan 31 '22 18:01 jcouv

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.

cston avatar Jan 31 '22 18:01 cston

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: 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?

renerod avatar Jan 31 '22 22:01 renerod

Closing as the original concern was addressed in dotnet/csharplang#5710.

@renerod I'm tagging @cston here to answer your follow up question.

BillWagner avatar Feb 01 '22 16:02 BillWagner

@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.

cston avatar Feb 01 '22 16:02 cston