diff trunk/src/Parser.d @ 158:759f437313f9

- Moved enum Protection and class BaseClass to module Types. - Fixed parseBaseClasses(). T.Dot token can lead off (global scope operator) and template instances are handled by parseBasicType().
author aziz
date Fri, 13 Jul 2007 11:42:04 +0000
parents fdbd47d72614
children 5aa877506db0
line wrap: on
line diff
--- a/trunk/src/Parser.d	Fri Jul 13 11:05:01 2007 +0000
+++ b/trunk/src/Parser.d	Fri Jul 13 11:42:04 2007 +0000
@@ -512,30 +512,24 @@
     while (1)
     {
       Protection prot = Protection.Public;
-      string name;
       switch (token.type)
       {
-      case T.Identifier: goto LisIdentifier;
+      // TODO: What about class Foo : typeof(new Bar)?
+      case T.Identifier, T.Dot/+, Typeof+/: goto LparseBasicType;
       case T.Private:   prot = Protection.Private;   break;
       case T.Protected: prot = Protection.Protected; break;
       case T.Package:   prot = Protection.Package;   break;
       case T.Public:  /*prot = Protection.Public;*/  break;
-      //case T.Dot: // TODO: What about "class Foo : .Bar"?
       default:
         // TODO: issue error msg
         return bases;
       }
-      nT();
-      if (token.type == T.Identifier)
-      {
-      LisIdentifier:
-        name = token.identifier;
-        nT();
-        // TODO: handle template instantiations: class Foo : Bar!(int)
-      }
-      else
-        expected(T.Identifier);
-      bases ~= new BaseClass(prot, name);
+      nT(); // Skip protection attribute.
+    LparseBasicType:
+      auto type = parseBasicType();
+      //if (type.tid != TID.DotList)
+        // TODO: issue error msg. base classes can only be one or more identifiers or template instances separated by dots.
+      bases ~= new BaseClass(prot, type);
       if (token.type != T.Comma)
         break;
     }