Where is pragma Declaration in the grammar?
Paul Backus
snarwin at gmail.com
Sat Dec 5 04:47:39 UTC 2020
On Saturday, 5 December 2020 at 03:55:52 UTC, Stefan Koch wrote:
> On Saturday, 5 December 2020 at 02:59:58 UTC, Paul Backus wrote:
>>
>> They're under Attribute:
>>
>> https://dlang.org/spec/grammar.html#Attribute
>>
>> The syntax tree for `pragma(msg, typeof(f))` in a declaration
>> context would be:
>>
>> DeclDef
>> AttributeSpecifier
>> Attribute
>> Pragma
>> pragma(msg, typeof(f))
>> DeclarationBlock
>> DeclDef
>> ;
>
> The Decldef is not optional.
> This is for pragmas like pragma mangle that affect symbols.
That's what I thought at first too, but according to the official
grammar, the DeclDef can be a single semicolon (i.e., empty):
https://dlang.org/spec/grammar.html#DeclDef
More information about the Digitalmars-d-learn
mailing list