Attributes (lexical)

rumbu rumbu at rumbu.ro
Thu Nov 25 08:06:27 UTC 2021


Just playing around with attributes.

This is valid D code:

```d

@


nogc: //yes, this is @nogc in fact, even some lines are between


@

/* i can put some comments
*/

/** even some documentation
*/

// single line comments also

(12)

// yes, comments and newlines are allowed between attribute and 
declaration


int x; //@(12) is attached to declaration
```

Is that ok or it's a lexer bug?


Also, this works also for #line, even if the specification tells 
us that all tokens must be on the same line


```d

#

//this works

line

/* this too */

12

//this is #line 12


```


More information about the Digitalmars-d-learn mailing list