D grammar overhaul

Rainer Schuetze r.sagitario at gmx.de
Fri Apr 8 00:18:38 PDT 2011



Trass3r wrote:
>> I hope, we agree on !in and !is, as the current lexing introduces the 
>> shown parsing problems. But !is needs to be added to the IsExpression 
>> rules then.
> 
> Hmm what if you have something like Templ!is(T:int)

This is not allowed, template arguments without parenthesis are limited 
to a specific list of single tokens.

> 
> Is http://d.puremagic.com/issues/show_bug.cgi?id=5785 fixable with 
> grammar changes other that !is being one token?

 >>    if (s.x !in a) {}
 >>    if (b !in a) {} // but this compiles!?

The second line works because it is special cased for PrimaryExpression 
in the dmd parser by checking whether '!' is followed by 'in' or 'is', 
while PostfixExpression only checks 'is'. I've added a patch to the 
bugreport.

> I haven't had a look yet how UFCS is expressed and how it could affect 
> this.


More information about the Digitalmars-d mailing list