# HG changeset patch # User aziz # Date 1184250005 0 # Node ID e46b3415ec162ad9e967bc3f30e277f51d7147d8 # Parent 8180eb84e69c45efe98092f6022e31e9663c8101 - Implemented parsing pragma declarations. - Added class PragmaDeclaration. diff -r 8180eb84e69c -r e46b3415ec16 trunk/src/Declarations.d --- a/trunk/src/Declarations.d Thu Jul 12 13:55:00 2007 +0000 +++ b/trunk/src/Declarations.d Thu Jul 12 14:20:05 2007 +0000 @@ -327,3 +327,17 @@ this.decls = decls; } } + +class PragmaDeclaration : Declaration +{ + string ident; + Expression[] args; + Declaration[] decls; + this(string ident, Expression[] args, Declaration[] decls) + { + super(true); + this.ident = ident; + this.args = args; + this.decls = decls; + } +} diff -r 8180eb84e69c -r e46b3415ec16 trunk/src/Parser.d --- a/trunk/src/Parser.d Thu Jul 12 13:55:00 2007 +0000 +++ b/trunk/src/Parser.d Thu Jul 12 14:20:05 2007 +0000 @@ -266,10 +266,37 @@ decl = new AlignDeclaration(size, parseDeclarationsBlock()); break; case T.Pragma: + // Pragma: + // pragma ( Identifier ) + // pragma ( Identifier , ExpressionList ) + // ExpressionList: + // AssignExpression + // AssignExpression , ExpressionList + nT(); + string ident; + Expression[] args; + Declaration[] decls; + + require(T.LParen); + ident = requireIdentifier(); + + if (token.type == T.Comma) + args = parseArguments(T.RParen); + else + require(T.RParen); + + if (token.type == T.Semicolon) + nT(); + else + decls = parseDeclarationsBlock(); + + decl = new PragmaDeclaration(ident, args, decls); + break; case T.Private: case T.Package: case T.Protected: case T.Public: + break; case T.Export: case T.Override: case T.Deprecated: