diff trunk/src/Parser.d @ 121:030933c6b5f0

- Added parseUnittestDeclaration(). - Added class UnittestDeclaration.
author aziz
date Mon, 09 Jul 2007 17:54:03 +0000
parents e5329dac0405
children 9849a263f148
line wrap: on
line diff
--- a/trunk/src/Parser.d	Mon Jul 09 17:48:03 2007 +0000
+++ b/trunk/src/Parser.d	Mon Jul 09 17:54:03 2007 +0000
@@ -146,6 +146,9 @@
     case T.Invariant:
       decl = parseInvariantDeclaration();
       break;
+    case T.Unittest:
+      decl = parseUnittestDeclaration();
+      break;
     case T.Module:
       // Error: module is optional and can only appear once at the top of the source file.
       break;
@@ -542,6 +545,17 @@
     return new InvariantDeclaration(statements);
   }
 
+  Declaration parseUnittestDeclaration()
+  {
+    assert(token.type == T.Unittest);
+
+    nT();
+    require(T.LBrace);
+    auto statements = parseStatements();
+    require(T.RBrace);
+    return new UnittestDeclaration(statements);
+  }
+
   /+++++++++++++++++++++++++++++
   + Expression parsing methods +
   +++++++++++++++++++++++++++++/