On 06/06/10 03:26, Ellery Newcomer wrote:
On 06/05/2010 08:22 AM, Bernard Helyer wrote:
I may be trying to write a D2 compiler in D2 (you can't prove
anything!),
ditto, except mine is in java
Awesome! :)
http://www.digitalmars.com/d/2.0/module.html#ImportDeclaration
"static import ImportList ;"
is listed specifically, but static can be found under
http://www.digitalmars.com/d/2.0/attribute.html#AttributeSpecifier
which can have a DeclarationBlock afterward, which would include a
single import statement, so surely the former is tautological?
from my reading, I don't think this is the case in dmd. It does
literally parse 'static import'. same with static if, static assert, and
maybe some others. I don't know, but I suspect that stuff like
static public import blah;
wouldn't give you a static import. I also don't know whether it would be
reasonable to make it work like that. The trouble is static means
something else for other declarations.
Something like
static:
...
import blah;
In the parser that I currently have, it would be rather obnoxious to
tell the difference between that and 'static import blah;'. Well, maybe
not.
Okay, I see.
---
http://www.digitalmars.com/d/2.0/lex.html#keyword
where do the @keywords fall?
'@' is a token which should be followed by an identifier
I did not know that. Thanks!
http://www.digitalmars.com/d/2.0/expression.html#PostfixExpression
"PostfixExpression . NewExpression"
Where is that valid?
I remember thinking the same thing.
class A{
class B{
string s;
}
int i;
}
void main(){
//A.B b = new A.B; //Error: outer class A 'this' needed to 'new' nested
class B
A a = new A;
A.B b = a.new B;
}
Funky. Thank you for the example.
---
http://www.digitalmars.com/d/2.0/expression.html#UnaryExpression
"( Type ) . Identifier"
why is that significant?
---
I suppose it's a bid to reduce the amount of incorrect parsing that
would result from
Type . Identifier
And to its credit, I don't think I have come across any trouble with it.
Maybe I'm having a slow morning, but I can't really grok that. Could you
elaborate? Speak slowly. :)