changeset 762:c909a3d3fa52

Fixed vararg issue with gdc.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 16 Feb 2008 00:52:43 +0100
parents 307905dadf5d
children f26f13b5a3a3
files trunk/src/dil/Messages.d trunk/src/dil/lexer/Lexer.d trunk/src/dil/parser/Parser.d
diffstat 3 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/dil/Messages.d	Sat Feb 16 00:12:13 2008 +0100
+++ b/trunk/src/dil/Messages.d	Sat Feb 16 00:52:43 2008 +0100
@@ -18,7 +18,7 @@
   // #line
   ExpectedIdentifierSTLine,
   ExpectedIntegerAfterSTLine,
-  ExpectedFilespec,
+  ExpectedFilespec, // Deprecated.
   UnterminatedFilespec,
   UnterminatedSpecialToken,
   // ""
--- a/trunk/src/dil/lexer/Lexer.d	Sat Feb 16 00:12:13 2008 +0100
+++ b/trunk/src/dil/lexer/Lexer.d	Sat Feb 16 00:52:43 2008 +0100
@@ -2272,10 +2272,10 @@
     t.setWhitespaceFlag();
 
     MID mid;
-    auto errorAtColumn = p;
+    char* errorAtColumn = p;
 
     ++p;
-    if (p[0] != 'l' || p[1] != 'i' || p[2] != 'n' || p[3] != 'e')
+    if (!(p[0] == 'l' && p[1] == 'i' && p[2] == 'n' && p[3] == 'e'))
     {
       mid = MID.ExpectedIdentifierSTLine;
       goto Lerr;
@@ -2288,7 +2288,7 @@
     { /+Space,+/ Integer, Filespec, End }
 
     State state = State.Integer;
-
+    char* tokenEnd = p + 1;
     while (!isEndOfLine(++p))
     {
       if (isspace(*p))
@@ -2303,6 +2303,7 @@
         }
         t.tokLineNum = new Token;
         scan(*t.tokLineNum);
+        tokenEnd = p;
         if (t.tokLineNum.kind != TOK.Int32 && t.tokLineNum.kind != TOK.Uint32)
         {
           errorAtColumn = t.tokLineNum.start;
@@ -2312,14 +2313,14 @@
         --p; // Go one back because scan() advanced p past the integer.
         state = State.Filespec;
       }
-      else if (state == State.Filespec)
-      {
-        if (*p != '"')
-        {
-          errorAtColumn = p;
-          mid = MID.ExpectedFilespec;
-          goto Lerr;
-        }
+      else if (state == State.Filespec && *p == '"')
+      { // MID.ExpectedFilespec is eprecated.
+        // if (*p != '"')
+        // {
+        //   errorAtColumn = p;
+        //   mid = MID.ExpectedFilespec;
+        //   goto Lerr;
+        // }
         t.tokLineFilespec = new Token;
         t.tokLineFilespec.start = p;
         t.tokLineFilespec.kind = TOK.Filespec;
@@ -2331,6 +2332,7 @@
             errorAtColumn = t.tokLineFilespec.start;
             mid = MID.UnterminatedFilespec;
             t.tokLineFilespec.end = p;
+            tokenEnd = p;
             goto Lerr;
           }
           isascii(*p) || decodeUTF8();
@@ -2338,6 +2340,7 @@
         auto start = t.tokLineFilespec.start +1; // +1 skips '"'
         t.tokLineFilespec.str = start[0 .. p - start];
         t.tokLineFilespec.end = p + 1;
+        tokenEnd = p + 1;
         state = State.End;
       }
       else/+ if (state == State.End)+/
@@ -2362,11 +2365,13 @@
       if (t.tokLineFilespec)
         newFilePath(t.tokLineFilespec.str);
     }
-    t.end = p;
+    p = tokenEnd;
+    t.end = tokenEnd;
 
     return;
   Lerr:
-    t.end = p;
+    p = tokenEnd;
+    t.end = tokenEnd;
     error(errorAtColumn, mid);
   }
 
@@ -2410,7 +2415,7 @@
   }
 
   void error_(uint lineNum, char* lineBegin, char* columnPos, MID mid,
-              TypeInfo[] _arguments, void* _argptr)
+              TypeInfo[] _arguments, Arg _argptr)
   {
     lineNum = this.errorLineNumber(lineNum);
     auto errorPath = this.filePaths.setPath;
--- a/trunk/src/dil/parser/Parser.d	Sat Feb 16 00:12:13 2008 +0100
+++ b/trunk/src/dil/parser/Parser.d	Sat Feb 16 00:52:43 2008 +0100
@@ -4133,7 +4133,7 @@
     error_(this.token, GetMsg(mid), _arguments, _argptr);
   }
 
-  void error_(Token* token, char[] formatMsg, TypeInfo[] _arguments, void* _argptr)
+  void error_(Token* token, char[] formatMsg, TypeInfo[] _arguments, Arg _argptr)
   {
     if (trying)
     {