changeset 231:6846138a0e24

- Fixed parseEnumDeclaration(). - Fix: skip T.Semicolon in parseStatement().
author aziz
date Fri, 27 Jul 2007 11:19:00 +0000
parents 8f1790d16753
children 2a4e2c8ca094
files trunk/src/Parser.d
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/Parser.d	Fri Jul 27 10:38:05 2007 +0000
+++ b/trunk/src/Parser.d	Fri Jul 27 11:19:00 2007 +0000
@@ -709,7 +709,12 @@
     bool hasBody;
 
     nT(); // Skip enum keyword.
-    enumName = requireIdentifier();
+
+    if (token.type == T.Identifier)
+    {
+      enumName = token.identifier;
+      nT();
+    }
 
     if (token.type == T.Colon)
     {
@@ -719,8 +724,8 @@
 
     if (token.type == T.Semicolon)
     {
-      //if (ident.length == 0)
-        // TODO: issue error msg
+      if (enumName.length == 0)
+        expected(T.Identifier);
       nT();
     }
     else if (token.type == T.LBrace)
@@ -749,6 +754,8 @@
       } while (token.type != T.RBrace)
       nT();
     }
+    else
+      error(MID.ExpectedButFound, "enum declaration", token.srcText);
 
     return new EnumDeclaration(enumName, baseType, members, values, hasBody);
   }
@@ -1547,6 +1554,7 @@
       s = parseScopeStatement();
       break;
     case T.Semicolon:
+      nT();
       s = new EmptyStatement();
       break;
     default: