Mercurial > projects > dil
diff trunk/src/Parser.d @ 151:2e959f67000b
- Added code for parsing mixin expression declarations.
author | aziz |
---|---|
date | Thu, 12 Jul 2007 19:18:02 +0000 |
parents | 753bc07bf3a0 |
children | fe2e36eb4b45 |
line wrap: on
line diff
--- a/trunk/src/Parser.d Thu Jul 12 18:06:02 2007 +0000 +++ b/trunk/src/Parser.d Thu Jul 12 19:18:02 2007 +0000 @@ -914,6 +914,7 @@ /* TemplateMixin: + mixin ( AssignExpression ) ; mixin TemplateIdentifier ; mixin TemplateIdentifier MixinIdentifier ; mixin TemplateIdentifier !( TemplateArgumentList ) ; @@ -924,6 +925,16 @@ assert(token.type == T.Mixin); nT(); // Skip mixin keyword. + if (token.type == T.LParen) + { + // TODO: What about mixin(...).ident;? + nT(); + auto e = parseAssignExpression(); + require(T.RParen); + require(T.Semicolon); + return new MixinDeclaration(e); + } + Expression[] templateIdent; string mixinIdent; @@ -938,7 +949,7 @@ string ident = requireIdentifier(); if (token.type == T.Not) // Identifier !( TemplateArguments ) { - // No need to peek for T.RParen. This must be a template instance. + // No need to peek for T.LParen. This must be a template instance. nT(); templateIdent ~= new TemplateInstanceExpression(ident, parseTemplateArguments()); }