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
On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote:
Is that ok or it's a lexer bug?
Yes. The lexer just eats whitespace and the parser accepts way
too much.
On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote:
Is that ok or it's a lexer bug?
@ (12) does exactly what I would expect. @nogc I always assumed
was a single token, but the spec says otherwise. I suppose that
makes sense.
#line is dicier as it is not part of the grammar proper;
On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote:
Also, this works also for #line, even if the specification
tells us that all tokens must be on the same line
Where does it say that?
On Thursday, 25 November 2021 at 10:10:25 UTC, Dennis wrote:
On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote:
Also, this works also for #line, even if the specification
tells us that all tokens must be on the same line
Where does it say that?
Well:
```
#line IntegerLiteral Filesp
On Thursday, 25 November 2021 at 10:41:05 UTC, Rumbu wrote:
I am not asking this questions out of thin air, I am trying to
write a conforming lexer and this is one of the ambiguities.
I think it is easier to just look at the lexer in the dmd source.
The D language does not really have a proper
On Thursday, 25 November 2021 at 10:41:05 UTC, Rumbu wrote:
Well:
```
#line IntegerLiteral Filespec? EndOfLine
```
Having EndOfLine at the end means for me that there are no
other EOLs between, otherwise this syntax should pass but it's
not (DMD last):
```d
#line 12
"source.d"
```
The lex
On Thursday, 25 November 2021 at 08:06:27 UTC, rumbu wrote:
#
//this works
line
I hate `#`.
On Thursday, 25 November 2021 at 11:25:49 UTC, Ola Fosheim
Grøstad wrote:
On Thursday, 25 November 2021 at 10:41:05 UTC, Rumbu wrote:
I am not asking this questions out of thin air, I am trying to
write a conforming lexer and this is one of the ambiguities.
I think it is easier to just look at
On Thursday, 25 November 2021 at 12:09:55 UTC, Dennis wrote:
This should also be fixed in the spec.
Filed as:
Issue 22543 - [spec] grammar blocks use unspecified notation:
https://issues.dlang.org/show_bug.cgi?id=22543
Issue 22544 - [spec] C++ and Objective-C are not single tokens
https://iss
On Thursday, 25 November 2021 at 12:16:50 UTC, rumbu wrote:
I try to base my reasoning on specification, dmd is not always
a good source of information, the lexer is polluted by old
features or right now by the ImportC feature, trying to lex D
an C in the same time.
Alright. I haven't looked
11 matches
Mail list logo