Where is pragma Declaration in the grammar?
Paul Backus
snarwin at gmail.com
Sat Dec 5 02:59:58 UTC 2020
On Saturday, 5 December 2020 at 00:57:04 UTC, Stefan Koch wrote:
> Hi,
>
> today I've been dusting my SDC fork and implemented a
> rudimentary version of pragma(msg).
>
> I could pragmaStatement
>
> as in void f()
> {
> pragma(msg, typeof(f));
> }
>
> but not a declaration as in
> pragma(msg, typeof(f))
> without a function body.
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
;
More information about the Digitalmars-d-learn
mailing list