diff trunk/src/Parser.d @ 159:5aa877506db0

- Added enum Linkage. - Changed type of linkage member in ExternDeclaration to Linkage. - Parsing LinkageType correctly now.
author aziz
date Fri, 13 Jul 2007 12:15:00 +0000
parents 759f437313f9
children c21192e8be2b
line wrap: on
line diff
--- a/trunk/src/Parser.d	Fri Jul 13 11:42:04 2007 +0000
+++ b/trunk/src/Parser.d	Fri Jul 13 12:15:00 2007 +0000
@@ -240,11 +240,34 @@
     {
     case T.Extern:
       nT();
-      string linkage;
+      Linkage linkage;
       if (token.type == T.LParen)
       {
         nT();
-        linkage = requireIdentifier();
+        auto ident = requireIdentifier();
+        switch (ident)
+        {
+        case "C":
+          if (token.type == T.PlusPlus)
+          {
+            nT();
+            linkage = Linkage.Cpp;
+            break;
+          }
+          linkage = Linkage.C;
+          break;
+        case "D":
+          linkage = Linkage.D;
+          break;
+        case "Windows":
+          linkage = Linkage.Windows;
+          break;
+        case "Pascal":
+          linkage = Linkage.Pascal;
+          break;
+        default:
+          // TODO: issue error msg. Unrecognized LinkageType.
+        }
         require(T.RParen);
       }
       decl = new ExternDeclaration(linkage, parseDeclarationsBlock());
@@ -1050,6 +1073,7 @@
     Expression[] templateIdent;
     string mixinIdent;
 
+    // This code is similar to parseDotListType().
     if (token.type == T.Dot)
     {
       nT();