changeset 253:4279b638c63e

- Changed some string types to Token*. Adapted parser accordingly.
author aziz
date Wed, 01 Aug 2007 18:39:02 +0000
parents 788398655d24
children eb6e3f1fbfee
files trunk/src/Expressions.d trunk/src/Parser.d trunk/src/Statements.d trunk/src/Types.d
diffstat 4 files changed, 20 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/Expressions.d	Wed Aug 01 17:07:02 2007 +0000
+++ b/trunk/src/Expressions.d	Wed Aug 01 18:39:02 2007 +0000
@@ -590,10 +590,10 @@
 class IsExpression : Expression
 {
   Type type;
-  string ident;
+  Token* ident;
   Token* opTok, specTok;
   Type specType;
-  this(Type type, string ident, Token* opTok, Token* specTok, Type specType)
+  this(Type type, Token* ident, Token* opTok, Token* specTok, Type specType)
   {
     this.type = type;
     this.ident = ident;
--- a/trunk/src/Parser.d	Wed Aug 01 17:07:02 2007 +0000
+++ b/trunk/src/Parser.d	Wed Aug 01 18:39:02 2007 +0000
@@ -1804,7 +1804,7 @@
     nT();
 
     Type type;
-    string ident;
+    Token* ident;
     Expression condition;
     Statement ifBody, elseBody;
 
@@ -1813,7 +1813,7 @@
     if (token.type == T.Auto)
     {
       nT();
-      ident = requireIdentifier();
+      ident = requireId();
       require(T.Assign);
     }
     else
@@ -1904,7 +1904,7 @@
       auto paramBegin = token;
       Token* stcTok;
       Type type;
-      string ident;
+      Token* ident;
 
       switch (token.type)
       {
@@ -1916,7 +1916,7 @@
         auto next = peekNext();
         if (next == T.Comma || next == T.Semicolon || next == T.RParen)
         {
-          ident = token.identifier;
+          ident = token;
           nT();
           break;
         }
@@ -2090,7 +2090,7 @@
       if (token.type == T.LParen)
       {
         nT();
-        string ident;
+        Token* ident;
         auto type = parseDeclarator(ident);
         param = new Parameter(null, type, ident, null);
         require(T.RParen);
@@ -2958,7 +2958,7 @@
       requireNext(T.LParen);
 
       Type type, specType;
-      string ident; // optional Identifier
+      Token* ident; // optional Identifier
       Token* opTok, specTok;
 
       type = parseDeclarator(ident, true);
@@ -3261,14 +3261,13 @@
     return t;
   }
 
-  Type parseDeclarator(ref string ident, bool identOptional = false)
+  Type parseDeclarator(ref Token* ident, bool identOptional = false)
   {
     auto t = parseType();
 
-    // TODO: change type of ident to Token*
     if (token.type == T.Identifier)
     {
-      ident = token.identifier;
+      ident = token;
       nT();
       t = parseDeclaratorSuffix(t);
     }
@@ -3349,7 +3348,7 @@
         params ~= set(new Parameter(stcTok, null, null, null), paramBegin);
         break; // Exit loop.
       default:
-        string ident;
+        Token* ident;
         auto type = parseDeclarator(ident, true);
 
         Expression assignExpr;
@@ -3430,7 +3429,7 @@
     while (1)
     {
       TP tp;
-      string ident;
+      Token* ident;
       Type valueType;
       Type specType, defType;
       Expression specValue, defValue;
@@ -3442,7 +3441,7 @@
         //         alias Identifier
         tp = TP.Alias;
         nT(); // Skip alias keyword.
-        ident = requireIdentifier();
+        ident = requireId();
         // : SpecializationType
         if (token.type == T.Colon)
         {
@@ -3457,7 +3456,7 @@
         }
         break;
       case T.Identifier:
-        ident = token.identifier;
+        ident = token;
         switch (peekNext())
         {
         case T.Ellipses:
--- a/trunk/src/Statements.d	Wed Aug 01 17:07:02 2007 +0000
+++ b/trunk/src/Statements.d	Wed Aug 01 18:39:02 2007 +0000
@@ -89,11 +89,11 @@
 class IfStatement : Statement
 {
   Type type;
-  string ident;
+  Token* ident;
   Expression condition;
   Statement ifBody;
   Statement elseBody;
-  this(Type type, string ident, Expression condition, Statement ifBody, Statement elseBody)
+  this(Type type, Token* ident, Expression condition, Statement ifBody, Statement elseBody)
   {
     this.type = type;
     this.ident = ident;
--- a/trunk/src/Types.d	Wed Aug 01 17:07:02 2007 +0000
+++ b/trunk/src/Types.d	Wed Aug 01 18:39:02 2007 +0000
@@ -44,10 +44,10 @@
   StorageClass stc;
   Token* stcTok;
   Type type;
-  string ident;
+  Token* ident;
   Expression assignExpr;
 
-  this(Token* stcTok, Type type, string ident, Expression assignExpr)
+  this(Token* stcTok, Type type, Token* ident, Expression assignExpr)
   {
     super(NodeType.Other);
 
@@ -144,10 +144,10 @@
 {
   TP tp;
   Type valueType;
-  string ident;
+  Token* ident;
   Type specType, defType;
   Expression specValue, defValue;
-  this(TP tp, Type valueType, string ident, Type specType, Type defType, Expression specValue, Expression defValue)
+  this(TP tp, Type valueType, Token* ident, Type specType, Type defType, Expression specValue, Expression defValue)
   {
     this.tp = tp;
     this.valueType = valueType;