Mercurial > projects > dil
diff trunk/src/Parser.d @ 147:e46b3415ec16
- Implemented parsing pragma declarations.
- Added class PragmaDeclaration.
author | aziz |
---|---|
date | Thu, 12 Jul 2007 14:20:05 +0000 |
parents | 8180eb84e69c |
children | e3e4d3314166 |
line wrap: on
line diff
--- 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: