changeset 151:aeeef0dea14e

Merge
author Anders Halager <halager@gmail.com>
date Mon, 21 Jul 2008 21:18:18 +0200
parents 6c5a3c0bb4fb (current diff) 6ec686d9c87d (diff)
children 893f23a9de93
files parser/Parser.d
diffstat 6 files changed, 529 insertions(+), 524 deletions(-) [+]
line wrap: on
line diff
--- a/basic/Attribute.d	Mon Jul 21 20:35:03 2008 +0200
+++ b/basic/Attribute.d	Mon Jul 21 21:18:18 2008 +0200
@@ -104,8 +104,8 @@
     bool getAbstract()  { return att & Abstract ? true : false; }
     void setOverride()  { att |= Override; }
     bool getOverride()  { return att & Override ? true : false; }
-    void setDepracted() { att |= Depracted; }
-    bool getDepracted() { return att & Depracted ? true : false; }
+    void setDeprecated(){ att |= Deprecated; }
+    bool getDeprecated(){ return att & Deprecated ? true : false; }
     void setAuto()      { att |= Auto; }
     bool getAuto()      { return att & Auto ? true : false; }
 
@@ -123,6 +123,6 @@
     static const uint Const         = 1<<7;
     static const uint Abstract      = 1<<8;
     static const uint Override      = 1<<9;
-    static const uint Depracted     = 1<<10;
+    static const uint Deprecated    = 1<<10;
     static const uint Auto          = 1<<11;
 }
--- a/basic/SourceLocation.d	Mon Jul 21 20:35:03 2008 +0200
+++ b/basic/SourceLocation.d	Mon Jul 21 21:18:18 2008 +0200
@@ -1,5 +1,7 @@
 module basic.SourceLocation;
 
+import Integer = tango.text.convert.Integer;
+
 /// Shorter alias for SourceLocation
 public alias SourceLocation SLoc;
 
@@ -77,6 +79,10 @@
         return res;
     }
 
+    char[] toString()
+    {
+        return Integer.toString(val);
+    }
     /**
       Used for invalid/unknown locations. (also the default value, but this is
       more explicit)
--- a/lexer/Keyword.d	Mon Jul 21 20:35:03 2008 +0200
+++ b/lexer/Keyword.d	Mon Jul 21 21:18:18 2008 +0200
@@ -73,9 +73,9 @@
         "const"     : Tok.Const,
         "abstract"  : Tok.Abstract,
         "override"  : Tok.Override,
-        "depracted" : Tok.Depracted,
+        "deprecated": Tok.Deprecated,
         "auto"      : Tok.Auto,
-        "extern"      : Tok.Extern,
+        "extern"    : Tok.Extern,
 
         // exceptions
         "assert"    : Tok.Assert,
--- a/lexer/Token.d	Mon Jul 21 20:35:03 2008 +0200
+++ b/lexer/Token.d	Mon Jul 21 21:18:18 2008 +0200
@@ -214,7 +214,7 @@
     Const,
     Abstract,
     Override,
-    Depracted,
+    Deprecated,
     Auto,
     Extern,
 
@@ -307,7 +307,7 @@
         Tok.Const:"Const",
         Tok.Abstract:"Abstract",
         Tok.Override:"Override",
-        Tok.Depracted:"Depracted",
+        Tok.Deprecated:"Deprecated",
         Tok.Auto:"Auto",
         Tok.Extern:"Extern"
     ];
--- a/parser/Parser.d	Mon Jul 21 20:35:03 2008 +0200
+++ b/parser/Parser.d	Mon Jul 21 21:18:18 2008 +0200
@@ -37,7 +37,7 @@
         Module m;
         if ( isa(Tok.Module) )
         {
-            Token _module = next;
+            Token _module = next();
             ModuleName name = parseModuleName();
             m = action.actOnModule(_module, sm.getText(name.asRange()));
             require(Tok.Seperator);
@@ -88,7 +88,7 @@
                 iden = Id(require(Tok.Identifier));
                 if ( isa(Tok.Seperator) )
                 {
-                    Token sep = next;
+                    Token sep = next();
                     return action.actOnDeclarator(type, iden, null, att);
                 }
                 else if ( isa(Tok.Assign) )
@@ -101,36 +101,36 @@
                 else if ( isa(Tok.OpenParentheses) )
                     return parseFunc(type, iden, att);
                 else
-                    messages.report(UnexpectedTok, next.location).arg(next.getType);
+                    messages.report(UnexpectedTok, next().location).arg(next().getType);
                 return null;
             }
             t = peek(len);
             messages.report(InvalidDeclType, t.location)
                 .arg(sm.getText(t.asRange));
             while(len--)
-                next;
+                next();
             while(peek.type != Tok.Identifier)
-                next;
+                next();
             type = Id(peek);
             goto parseDeclAfterInvalidType;
         }
         else if (t.type == Tok.Struct)
         {
-            Id type = Id(next);
+            Id type = Id(next());
             Id iden = Id(require(Tok.Identifier));
             
             return parseStruct(type, iden, att);
         }
         else if (t.type == Tok.Class)
         {
-            Id type = Id(next);
+            Id type = Id(next());
             Id iden = Id(require(Tok.Identifier));
             
             return parseClass(type, iden, att);
         }
         else if (t.type == Tok.Interface)
         {
-            Id type = Id(next);
+            Id type = Id(next());
             Id iden = Id(require(Tok.Identifier));
             
             return parseInterface(type, iden, att);
@@ -147,7 +147,7 @@
         if(peek(1).type != Tok.OpenParentheses)
             return e;
 
-        next; next;
+        next(); next();
 
         Token t = require(Tok.Identifier);
 
@@ -270,7 +270,7 @@
         if (peek.type == Tok.Colon)
             // SuperInterfaces
         {
-            next; // Remove colon.
+            next(); // Remove colon.
 
             Id identifier;
 
@@ -282,7 +282,7 @@
             // We should now have an optional list of items, each starting ','
             while (peek.type == Tok.Comma)
             {
-                next; // Remove comma
+                next(); // Remove comma
 
                 // The identifier
                 identifier = Id(require(Tok.Identifier));
@@ -320,14 +320,14 @@
         if (peek.type == Tok.Colon)
             // BaseClassList - Super class and interfaces(in that order)
         {
-            next; // Remove colon.
+            next(); // Remove colon.
 
             Token protection;
             Id    identifier;
 
             // First we expect an optional protection level.
             if (peek.isBaseClassProtection)
-                protection = next;
+                protection = next();
             // Then the identifier
             identifier = Id(require(Tok.Identifier));
 
@@ -336,11 +336,11 @@
             // We should now have an optional list of items, each starting ','
             while (peek.type == Tok.Comma)
             {
-                next; // Remove comma
+                next(); // Remove comma
 
                 // First we expect an optional protection level.
                 if (peek.isBaseClassProtection)
-                    protection = next;
+                    protection = next();
                 // Then the identifier
                 identifier = Id(require(Tok.Identifier));
 
@@ -413,7 +413,7 @@
                 if( nes[$-1].nested == Scope )
                 {
                     nes.length = nes.length - 1;
-                    next;
+                    next();
                     break;
                 }
                 nes.length = nes.length - 1;
@@ -462,8 +462,8 @@
                 case Tok.Override:
                     a.a.setOverride;
                     break;
-                case Tok.Depracted:
-                    a.a.setDepracted;
+                case Tok.Deprecated:
+                    a.a.setDeprecated;
                     break;
                 case Tok.Auto:
                     a.a.setAuto;
@@ -473,7 +473,7 @@
                     a.a.setExtern(e);
                     break;
             }
-            next;
+            next();
 
             return a;
         }
@@ -488,18 +488,23 @@
         if (peek.type == Tok.Colon)
         {
             a.nested = All;
-            next;
+            next();
         }
         else if  (peek.type == Tok.OpenBrace)
         {
             a.nested = Scope;
-            next;
+            next();
         }
 
         return a;
     }
 
-enum : uint { Single, Scope, All }
+enum : uint 
+       { 
+           Single, 
+           Scope, 
+           All 
+       }
 
        struct Att
        {
@@ -518,7 +523,7 @@
 
            if (t.isReturn)
            {
-               Token ret = next;
+               Token ret = next();
                Exp exp;
                if (peek.type != Tok.Seperator)
                    exp = parseExpression();
@@ -546,571 +551,565 @@
                // something than can be passed along
                Token _else = _if;
                Stmt elseB;
-            if (peek.type == Tok.Else)
-            {
-                _else = next;
-                elseB = parseSingleOrCompoundStatement();
-            }
+               if (peek.type == Tok.Else)
+               {
+                   _else = next();
+                   elseB = parseSingleOrCompoundStatement();
+               }
 
-            return action.actOnIfStmt(_if, cond, thenB, _else, elseB);
+               return action.actOnIfStmt(_if, cond, thenB, _else, elseB);
 
-            /*
-               while (cond)
-               single statement | compound statement
-             */
-        }
-        else if (t.isWhile)
-        {
-            Token _while = next;
-            require(Tok.OpenParentheses);
-            Exp cond = parseExpression();
-            require(Tok.CloseParentheses);
-            Stmt bodyStmt = parseSingleOrCompoundStatement();
-            return action.actOnWhileStmt(_while, cond, bodyStmt);
+               /*
+                  while (cond)
+                  single statement | compound statement
+                */
+           }
+           else if (t.isWhile)
+           {
+               Token _while = next();
+               require(Tok.OpenParentheses);
+               Exp cond = parseExpression();
+               require(Tok.CloseParentheses);
+               Stmt bodyStmt = parseSingleOrCompoundStatement();
+               return action.actOnWhileStmt(_while, cond, bodyStmt);
 
-            /*
-               One of four things:
-               A declaration of a function/variable `type id ...`
-               A direct assignment `id = exp;`
-               An indirect assignment `id.id = exp`
-               Some sort of free standing expression
+               /*
+                  One of four things:
+                  A declaration of a function/variable `type id ...`
+                  A direct assignment `id = exp;`
+                  An indirect assignment `id.id = exp`
+                  Some sort of free standing expression
 
-               The assignments should be handled as binary expressions?
-             */
-        }
-        else if (t.isFor)
-        {
-            Token _for = next;
-            require(Tok.OpenParentheses);
-            Stmt init = parseStatement();
+                  The assignments should be handled as binary expressions?
+                */
+           }
+           else if (t.isFor)
+           {
+               Token _for = next();
+               require(Tok.OpenParentheses);
+               Stmt init;
+               if ( isa(Tok.Seperator))
+                   require(Tok.Seperator);
+               else
+                   init = parseStatement();
 
-            Exp cond;
-            if ( !isa(Tok.Seperator))
-                cond = parseExpression();
-            require(Tok.Seperator);
+               Exp cond;
+               if ( !isa(Tok.Seperator))
+                   cond = parseExpression();
+               require(Tok.Seperator);
 
-            Exp incre;
-            if ( !isa(Tok.CloseParentheses))
-                incre = parseExpression();
-            require(Tok.CloseParentheses);
-
-            Stmt bodyStmt = parseSingleOrCompoundStatement();
-            return action.actOnForStmt(_for, init, cond, incre, bodyStmt);
+               Exp incre;
+               if ( !isa(Tok.CloseParentheses))
+                   incre = parseExpression();
+               require(Tok.CloseParentheses);
 
-            /*
-               One of four things:
-               A declaration of a function/variable `type id ...`
-               A direct assignment `id = exp;`
-               An indirect assignment `id.id = exp`
-               Some sort of free standing expression
+               Stmt bodyStmt = parseSingleOrCompoundStatement();
+               return action.actOnForStmt(_for, init, cond, incre, bodyStmt);
+           }
+           else if (t.isBasicType || t.isIdentifier)
+           {
+               Token iden = peek;
+               Token n = peek(1);
+               // Must be an decl, if we start with a basic type, or two
+               // identifiers in a row
+               if ( n.type == Tok.Star || n.type == Tok.OpenBracket)
+               {
+                   int len = peekParseType;
+                   if(peek(len).type == Tok.Identifier && len != 0)
+                       return action.actOnDeclStmt(parseVarDecl());
 
-               The assignments should be handled as binary expressions?
-             */
-        }
-        else if (t.isBasicType || t.isIdentifier)
-        {
-            Token iden = peek;
-            Token n = peek(1);
-            // Must be an decl, if we start with a basic type, or two
-            // identifiers in a row
-            if ( n.type == Tok.Star || n.type == Tok.OpenBracket)
-            {
-                int len = peekParseType;
-                if(peek(len).type == Tok.Identifier && len != 0)
-                    return action.actOnDeclStmt(parseVarDecl());
+                   Exp exp = parseExpression();
+                   require(Tok.Seperator);
+                   return action.actOnExprStmt(exp);
+               }
 
-                Exp exp = parseExpression();
-                require(Tok.Seperator);
-                return action.actOnExprStmt(exp);
+               if (n.isIdentifier())
+                   return action.actOnDeclStmt(parseVarDecl());
+
+               // Expression: a.b, a = b, a(b) etc.
+               Exp exp = parseExpression();
+               require(Tok.Seperator);
+               return action.actOnExprStmt(exp);
             }
-
-            if (n.isIdentifier())
-                return action.actOnDeclStmt(parseVarDecl());
+            else if (t.isSwitch)
+            {
+                next();
+                require(Tok.OpenParentheses);
+                auto target = parseExpression();
+                auto res = action.actOnStartOfSwitchStmt(t, target);
+                require(Tok.CloseParentheses);
+                require(Tok.OpenBrace);
+                while (true)
+                {
+                    Stmt[] statements;
+                    if (isa(Tok.Default))
+                    {
+                        Token _default = next();
+                        require(Tok.Colon);
+                        statements.length = 0;
+                        while (peek.type != Tok.Case
+                                && peek.type != Tok.Default
+                                && peek.type != Tok.CloseBrace)
+                            statements ~= parseStatement();
+                        action.actOnDefaultStmt(res, _default, statements);
+                        continue;
+                    }
 
-            // Expression: a.b, a = b, a(b) etc.
-            Exp exp = parseExpression();
-            require(Tok.Seperator);
-            return action.actOnExprStmt(exp);
-        }
-        else if (t.isSwitch)
-        {
-            next();
-            require(Tok.OpenParentheses);
-            auto target = parseExpression();
-            auto res = action.actOnStartOfSwitchStmt(t, target);
-            require(Tok.CloseParentheses);
-            require(Tok.OpenBrace);
-            while (true)
-            {
-                Stmt[] statements;
-                if (isa(Tok.Default))
-                {
-                    Token _default = next();
+                    Token _case = peek;
+                    if (_case.type != Tok.Case)
+                        break;
+                    next();
+
+                    Exp[] literals;
+                    do
+                    {
+                        Exp e = parseExpression();
+                        literals ~= e;
+                    }
+                    while (skip(Tok.Comma));
                     require(Tok.Colon);
-                    statements.length = 0;
+
                     while (peek.type != Tok.Case
                             && peek.type != Tok.Default
                             && peek.type != Tok.CloseBrace)
                         statements ~= parseStatement();
-                    action.actOnDefaultStmt(res, _default, statements);
-                    continue;
-                }
 
-                Token _case = peek;
-                if (_case.type != Tok.Case)
-                    break;
-                next();
-
-                Exp[] literals;
-                do
-                {
-                    Exp e = parseExpression();
-                    literals ~= e;
-                }
-                while (skip(Tok.Comma));
-                require(Tok.Colon);
+                    action.actOnCaseStmt(res, _case, literals, statements);
 
-                while (peek.type != Tok.Case
-                        && peek.type != Tok.Default
-                        && peek.type != Tok.CloseBrace)
-                    statements ~= parseStatement();
-
-                action.actOnCaseStmt(res, _case, literals, statements);
-
-                if (peek.type == Tok.CloseBrace)
-                    break;
-            }
-            require(Tok.CloseBrace);
-            return res;
-        }
-        else
-        {
-            if (t.type == Tok.Star)
-            {
-                auto exp = parseExpression();
-                require(Tok.Seperator);
-                return action.actOnExprStmt(exp);
+                    if (peek.type == Tok.CloseBrace)
+                        break;
+                }
+                require(Tok.CloseBrace);
+                return res;
             }
-            messages.report(UnexpectedBeginStmt, peek.location).arg(next.getType);
-            return null;
-        }
-        messages.report(UnexpectedTok, t.location);
-        return null;
-    }
+           else
+           {
+               if (t.type == Tok.Star)
+               {
+                   auto exp = parseExpression();
+                   require(Tok.Seperator);
+                   return action.actOnExprStmt(exp);
+               }
+               messages.report(UnexpectedBeginStmt, t.location).arg(t.getType);
+               return null;
+           }
+           messages.report(UnexpectedTok, t.location);
+           return null;
+       }
 
-    Decl parseVarDecl()
-    {
-        // manually hardcoded to only support "type id [= exp];"
-        // as that is the only thing the codegen understands
-        Id type = parseType;
-        Id id = Id(next);
-        Exp init;
-        if (skip(Tok.Assign))
-            init = parseExpression();
-        require(Tok.Seperator);
-        Attribute att;
-        Decl d = action.actOnDeclarator(type, id, init, att);
-        return d;
-    }
+       Decl parseVarDecl()
+       {
+           // manually hardcoded to only support "type id [= exp];"
+           // as that is the only thing the codegen understands
+           Id type = parseType;
+           Id id = Id(next());
+           Exp init;
+           if (skip(Tok.Assign))
+               init = parseExpression();
+           require(Tok.Seperator);
+           Attribute att;
+           Decl d = action.actOnDeclarator(type, id, init, att);
+           return d;
+       }
 
-    /**
-      Parses a function/method given the already parsed return type and name
-     */
-    Decl parseFunc(ref Id type, ref Id name, Attribute att)
-    {
-        Decl func = action.actOnStartOfFunctionDef(type, name, att);
-        parseFuncArgs(func);
+       /**
+         Parses a function/method given the already parsed return type and name
+        */
+       Decl parseFunc(ref Id type, ref Id name, Attribute att)
+       {
+           Decl func = action.actOnStartOfFunctionDef(type, name, att);
+           parseFuncArgs(func);
 
-        if(peek.type == Tok.Seperator)
-        {
-            next;
-            return func;
-        }
-        Stmt stmt = parseCompoundStatement();
+           if(peek.type == Tok.Seperator)
+           {
+               next();
+               return func;
+           }
+           Stmt stmt = parseCompoundStatement();
 
-        return action.actOnEndOfFunction(func, stmt);
-    }
+           return action.actOnEndOfFunction(func, stmt);
+       }
+
+       /**
+         Parse the function arguments, assumes current token is (.
+
+         Both the intitial paren and the ending paren is consumed.
+        */
+       void parseFuncArgs(Decl func)
+       {
+           require(Tok.OpenParentheses); // Remove the "(" token.
 
-    /**
-      Parse the function arguments, assumes current token is (.
+           while(peek.type != Tok.CloseParentheses)
+           {
+               auto t = parseType();
+               Id i;
+               if(peek.type == Tok.Identifier)
+                   i = parseIdentifier();
+               action.addFuncArg(func, t, i);
 
-      Both the intitial paren and the ending paren is consumed.
-     */
-    void parseFuncArgs(Decl func)
-    {
-        require(Tok.OpenParentheses); // Remove the "(" token.
+               if(peek.type == Tok.Comma)
+                   next();
+           }
 
-        while(peek.type != Tok.CloseParentheses)
-        {
-            auto t = parseType();
-            Id i;
-            if(peek.type == Tok.Identifier)
-                i = parseIdentifier();
-            action.addFuncArg(func, t, i);
+           require(Tok.CloseParentheses); // Remove the ")"
+       }
 
-            if(peek.type == Tok.Comma)
-                next;
-        }
-
-        require(Tok.CloseParentheses); // Remove the ")"
-    }
+       /**
+         Parse either a block, or a single statement as allowed after if, while
+         and for.
+        */
+       Stmt parseSingleOrCompoundStatement()
+       {
+           if (peek.type == Tok.OpenBrace)
+               return parseCompoundStatement();
+           return parseStatement();
+       }
 
-    /**
-      Parse either a block, or a single statement as allowed after if, while
-      and for.
-     */
-    Stmt parseSingleOrCompoundStatement()
-    {
-        if (peek.type == Tok.OpenBrace)
-            return parseCompoundStatement();
-        return parseStatement();
-    }
+       /**
+         Parses a function-body or similar, expects an opening brace to be the
+         current token.
 
-    /**
-      Parses a function-body or similar, expects an opening brace to be the
-      current token.
-      
-      Will consume both the starting { and ending }
-     */
-    Stmt parseCompoundStatement()
-    {
-        Token lbrace = require(Tok.OpenBrace);
-        SmallArray!(Stmt, 32) stmts; // Try to use the stack only
-        while (peek.type != Tok.CloseBrace)
-            stmts ~= parseStatement();
-        Token rbrace = require(Tok.CloseBrace);
-        return action.actOnCompoundStmt(lbrace, rbrace, stmts.unsafe());
-    }
+         Will consume both the starting { and ending }
+        */
+       Stmt parseCompoundStatement()
+       {
+           Token lbrace = require(Tok.OpenBrace);
+           SmallArray!(Stmt, 32) stmts; // Try to use the stack only
+           while ( !isa(Tok.CloseBrace) && !isa(Tok.EOF) )
+               stmts ~= parseStatement();
+           Token rbrace = require(Tok.CloseBrace);
+           return action.actOnCompoundStmt(lbrace, rbrace, stmts.unsafe());
+       }
 
-    Id parseIdentifier()
-    {
-        Token tok = next;
+       Id parseIdentifier()
+       {
+           Token tok = next();
 
-        if (tok.type is Tok.Identifier)
-            return Id(tok);
+           if (tok.type is Tok.Identifier)
+               return Id(tok);
 
-        messages.report(UnexpectedTokSingle, tok.location)
-            .arg(tok.getType)
-            .arg(Tok.Identifier);
-    }
+           messages.report(UnexpectedTokSingle, tok.location)
+               .arg(tok.getType)
+               .arg(Tok.Identifier);
+       }
 
-    ModuleName parseModuleName()
-    {
-        auto id = parseIdentifier();
-        ModuleName mod;
-        while (skip(Tok.Dot))
-        {
-            mod.packages ~= id;
-            if (peek.type != Tok.Identifier) {
-                messages.report(ExpectedIdAfterPackage, peek.location);
-                goto Lerror;
-            }
-            id = parseIdentifier();
-        }
-        mod.id = id;
-        return mod;
+       ModuleName parseModuleName()
+       {
+           auto id = parseIdentifier();
+           ModuleName mod;
+           while (skip(Tok.Dot))
+           {
+               mod.packages ~= id;
+               if (peek.type != Tok.Identifier) {
+                   messages.report(ExpectedIdAfterPackage, peek.location);
+                   goto Lerror;
+               }
+               id = parseIdentifier();
+           }
+           mod.id = id;
+           return mod;
 Lerror:
-        while (!skip(Tok.Seperator))
-            next();
-        return mod;
-    }
+           while (!skip(Tok.Seperator))
+               next();
+           return mod;
+       }
 
 
-    /**
-      Parse a type - this includes pointer and array(at some point) types.
-     */
-    Id parseType()
-    {
-        Token type = next;
+       /**
+         Parse a type - this includes pointer and array(at some point) types.
+        */
+       Id parseType()
+       {
+           Token type = next();
 
-        Id currentType;
+           Id currentType;
 
-        if ( !(type.isBasicType || type.type == Tok.Identifier) )
-            messages.report(InvalidType, type.location);
+           if ( !(type.isBasicType || type.type == Tok.Identifier) )
+               messages.report(InvalidType, type.location);
 
-        currentType = Id(type);
-        type = peek;
+           currentType = Id(type);
+           type = peek;
 
-        while(type.type == Tok.Star || type.type == Tok.OpenBracket)
-        {
-            if(type.type == Tok.Star)
-            {
-                currentType = PointerId(currentType);
-                next;
-            }
-            else
-            {
-                next;
-                if(peek.type == Tok.Integer)
-                    currentType = StaticArrayId(
-                            currentType, 
-                            action.actOnNumericConstant(
-                                require(Tok.Integer)));
-                require(Tok.CloseBracket);
-                
-            }
-            type = peek;
-        }
+           while(type.type == Tok.Star || type.type == Tok.OpenBracket)
+           {
+               if(type.type == Tok.Star)
+               {
+                   currentType = PointerId(currentType);
+                   next();
+               }
+               else
+               {
+                   next();
+                   if(peek.type == Tok.Integer)
+                       currentType = StaticArrayId(
+                               currentType, 
+                               action.actOnNumericConstant(
+                                   require(Tok.Integer)));
+                   require(Tok.CloseBracket);
 
-        return currentType;
-    }
+               }
+               type = peek;
+           }
+
+           return currentType;
+       }
 
-    int peekParseType()
-    {
-        int i;
-        Token type = peek(i);
+       int peekParseType()
+       {
+           int i;
+           Token type = peek(i);
 
-        Id currentType;
+           Id currentType;
 
-        if ( !(type.isBasicType || type.type == Tok.Identifier) )
-            return 0;
+           if ( !(type.isBasicType || type.type == Tok.Identifier) )
+               return 0;
 
-        currentType = Id(type);
-        type = peek(++i);
+           currentType = Id(type);
+           type = peek(++i);
 
-        while(type.type == Tok.Star || type.type == Tok.OpenBracket)
-        {
-            if(type.type == Tok.Star)
-            {
-                i++;
-            }
-            else
-            {
-                if(peek(i++).type != Tok.OpenBracket)
-                    return 0;
-                if(peek(i).type == Tok.Integer)
-                {
-                    i++;
-                    if(peek(i++).type != Tok.CloseBracket)    
-                        return 0;
-                }
-                else
-                    if(peek(i++).type != Tok.CloseBracket)
-                        return 0;
-                
-            }
-            type = peek(i);
-        }
+           while(type.type == Tok.Star || type.type == Tok.OpenBracket)
+           {
+               if(type.type == Tok.Star)
+               {
+                   i++;
+               }
+               else
+               {
+                   if(peek(i++).type != Tok.OpenBracket)
+                       return 0;
+                   if(peek(i).type == Tok.Integer)
+                   {
+                       i++;
+                       if(peek(i++).type != Tok.CloseBracket)    
+                           return 0;
+                   }
+                   else
+                       if(peek(i++).type != Tok.CloseBracket)
+                           return 0;
 
-        return i;
-    }
+               }
+               type = peek(i);
+           }
+
+           return i;
+       }
 
 private:
-    // -- Expression parsing -- //
-    Exp parsePostfixExp(Exp target)
-    {
-        switch(peek.type)
-        {
-            case Tok.Dot:
-                switch(peek(1).type)
-                {
-                    case Tok.Identifier:
-                        Token op = next;
-                        Id member = Id(next);
-                        Exp exp = action.actOnMemberReference(target, op.location, member);
-                        return parsePostfixExp(exp);
-                    default:
-                        Token t = peek(1);
-                        messages.report(ExpectedIdAfterDot, t.location);
-                }
-            case Tok.OpenBracket:
-                Token open = next;
-                Exp index = parseExpression();
-                Token close = require(Tok.CloseBracket);
-                return action.actOnIndexEpr(target, open, index, close);
-            default:
-                return target;
-        }
-    }
+       // -- Expression parsing -- //
+       Exp parsePostfixExp(Exp target)
+       {
+           switch(peek.type)
+           {
+               case Tok.Dot:
+                   switch(peek(1).type)
+                   {
+                       case Tok.Identifier:
+                           Token op = next();
+                           Id member = Id(next());
+                           Exp exp = action.actOnMemberReference(target, op.location, member);
+                           return parsePostfixExp(exp);
+                       default:
+                           Token t = peek(1);
+                           messages.report(ExpectedIdAfterDot, t.location);
+                   }
+               case Tok.OpenBracket:
+                   Token open = next();
+                   Exp index = parseExpression();
+                   Token close = require(Tok.CloseBracket);
+                   return action.actOnIndexEpr(target, open, index, close);
+               default:
+                   return target;
+           }
+       }
 
-    Exp parseExpression(int p = 0)
-    {
-        auto exp = P();
-        Token n = peek();
-        BinOp* op = null;
-        while ((op = binary(n.type)) != null && op.prec >= p)
-        {
-            next();
-            int q = op.leftAssoc? 1 + op.prec : op.prec;
-            auto exp2 = parseExpression(q);
-            exp = action.actOnBinaryOp(n.location, op.operator, exp, exp2);
-            n = peek();
-        }
+       Exp parseExpression(int p = 0)
+       {
+           auto exp = P();
+           Token n = peek();
+           BinOp* op = null;
+           while ((op = binary(n.type)) != null && op.prec >= p)
+           {
+               next();
+               int q = op.leftAssoc? 1 + op.prec : op.prec;
+               auto exp2 = parseExpression(q);
+               exp = action.actOnBinaryOp(n.location, op.operator, exp, exp2);
+               n = peek();
+           }
 
-        return exp;
-    }
+           return exp;
+       }
 
-    Exp P()
-    {
-        Token n = next();
-        if (auto op = unary(n.type))
-            return action.actOnUnaryOp(n, parseExpression(op.prec));
-        else if (n.type == Tok.OpenParentheses)
-        {
-            auto e = parseExpression(0);
-            require(Tok.CloseParentheses);
-            return e;
-        }
-        else if (n.type == Tok.Identifier)
-        {
-            Exp value = action.actOnIdentifierExp(Id(n));
-            Exp iden = parsePostfixExp(value);
-            switch(peek.type)
-            {
-                case Tok.OpenParentheses:
-                    Token lp = next;
-                    SmallArray!(Exp, 8) args;
-                    while(peek.type != Tok.CloseParentheses)
-                    {
-                        if(peek.type == Tok.Comma)
-                            next;
-                        args ~= parseExpression();
-                    }
+       Exp P()
+       {
+           Token n = next();
+           if (auto op = unary(n.type))
+               return action.actOnUnaryOp(n, parseExpression(op.prec));
+           else if (n.type == Tok.OpenParentheses)
+           {
+               auto e = parseExpression(0);
+               require(Tok.CloseParentheses);
+               return e;
+           }
+           else if (n.type == Tok.Identifier)
+           {
+               Exp value = action.actOnIdentifierExp(Id(n));
+               Exp iden = parsePostfixExp(value);
+               switch(peek.type)
+               {
+                   case Tok.OpenParentheses:
+                       Token lp = next();
+                       SmallArray!(Exp, 8) args;
+                       while(peek.type != Tok.CloseParentheses)
+                       {
+                           if(peek.type == Tok.Comma)
+                               next();
+                           args ~= parseExpression();
+                       }
 
-                    Token rp = next();
-                    return action.actOnCallExpr(iden, lp, args.unsafe(), rp);
+                       Token rp = next();
+                       return action.actOnCallExpr(iden, lp, args.unsafe(), rp);
 
-                default:
-                    return iden;
-            }
-        }
-        else if (n.type == Tok.Cast)
-            return parseCast(n);
-        else if (n.type == Tok.Integer)
-            return action.actOnNumericConstant(n);
-        else if (n.type == Tok.String)
-            return action.actOnStringExp(n);
+                   default:
+                       return iden;
+               }
+           }
+           else if (n.type == Tok.Cast)
+               return parseCast(n);
+           else if (n.type == Tok.Integer)
+               return action.actOnNumericConstant(n);
+           else if (n.type == Tok.String)
+               return action.actOnStringExp(n);
 
-        messages.report(ExpectedExp, n.location)
-            .fatal(ExitLevel.Parser);
-        return null;
-    }
+           messages.report(ExpectedExp, n.location)
+               .fatal(ExitLevel.Parser);
+           return null;
+       }
 
-    Exp parseCast(ref Token _cast)
-    {
-        require(Tok.OpenParentheses);
-        auto n = next;
-        if(!n.isBasicType && !n.isIdentifier)
-            messages.report(ExpectedCastType, n.location);
-        
-        require(Tok.CloseParentheses);
-        auto exp = P();
-        return action.actOnCastExpr(_cast, Id(n), exp);
-    }
+       Exp parseCast(ref Token _cast)
+       {
+           require(Tok.OpenParentheses);
+           auto n = next();
+           if(!n.isBasicType && !n.isIdentifier)
+               messages.report(ExpectedCastType, n.location);
 
-    struct UnOp
-    {
-        Tok tokenType;
-        int prec;
-    }
+           require(Tok.CloseParentheses);
+           auto exp = P();
+           return action.actOnCastExpr(_cast, Id(n), exp);
+       }
+
+       struct UnOp
+       {
+           Tok tokenType;
+           int prec;
+       }
 
-    static const UnOp[] _unary =
-    [
-        {Tok.Minus, 4},
-        {Tok.Star, 4}
-    ];
-    UnOp* unary(Tok t)
-    {
-        foreach (ref op; _unary)
-            if (op.tokenType == t)
-                return &op;
-        return null;
-    }
+       static const UnOp[] _unary =
+           [
+           {Tok.Minus, 4},
+           {Tok.Star, 4}
+       ];
+       UnOp* unary(Tok t)
+       {
+           foreach (ref op; _unary)
+               if (op.tokenType == t)
+                   return &op;
+           return null;
+       }
 
-    struct BinOp
-    {
-        Tok tokenType;
-        int prec;
-        bool leftAssoc;
-        Operator operator;
-    }
+       struct BinOp
+       {
+           Tok tokenType;
+           int prec;
+           bool leftAssoc;
+           Operator operator;
+       }
 
-    static const BinOp[] _binary =
-    [
-        {Tok.Assign,        1, false, Operator.Assign},
-        {Tok.PlusAssign,    1, false, Operator.AddAssign},
-        {Tok.MinusAssign,   1, false, Operator.SubAssign},
-        {Tok.StarAssign,    1, false, Operator.MulAssign},
-        {Tok.SlashAssign,   1, false, Operator.DivAssign},
-        {Tok.PercentAssign, 1, false, Operator.ModAssign},
+       static const BinOp[] _binary =
+           [
+           {Tok.Assign,        1, false, Operator.Assign},
+           {Tok.PlusAssign,    1, false, Operator.AddAssign},
+           {Tok.MinusAssign,   1, false, Operator.SubAssign},
+           {Tok.StarAssign,    1, false, Operator.MulAssign},
+           {Tok.SlashAssign,   1, false, Operator.DivAssign},
+           {Tok.PercentAssign, 1, false, Operator.ModAssign},
 
-        // =, += etc. 1
-        // (need special-case for the ternary operator at this level)
-        // ||, 2
-        // &&, 3
-        // |, 4
-        // &, 5
-        // ^, 6
-        // ==, !=, is, !is, 7
-        // <, <= etc, 7
-        // in, 7
-        // <<, >>, >>>, 8
-        // +, -, ~, 9
-        // *, /, %, 10
-        // unary operators here
+           // =, += etc. 1
+           // (need special-case for the ternary operator at this level)
+           // ||, 2
+           // &&, 3
+           // |, 4
+           // &, 5
+           // ^, 6
+           // ==, !=, is, !is, 7
+           // <, <= etc, 7
+           // in, 7
+           // <<, >>, >>>, 8
+           // +, -, ~, 9
+           // *, /, %, 10
+           // unary operators here
 
-        {Tok.Eq,        2, true, Operator.Eq},
-        {Tok.Ne,        2, true, Operator.Ne},
+           {Tok.Eq,        2, true, Operator.Eq},
+           {Tok.Ne,        2, true, Operator.Ne},
 
-        {Tok.Lt,        2, true, Operator.Lt},
-        {Tok.Le,        2, true, Operator.Le},
-        {Tok.Gt,        2, true, Operator.Gt},
-        {Tok.Ge,        2, true, Operator.Ge},
+           {Tok.Lt,        2, true, Operator.Lt},
+           {Tok.Le,        2, true, Operator.Le},
+           {Tok.Gt,        2, true, Operator.Gt},
+           {Tok.Ge,        2, true, Operator.Ge},
 
-        {Tok.Plus,      3, true, Operator.Add},
-        {Tok.Minus,     3, true, Operator.Sub},
+           {Tok.Plus,      3, true, Operator.Add},
+           {Tok.Minus,     3, true, Operator.Sub},
 
-        {Tok.Star,      5, true, Operator.Mul},
-        {Tok.Slash,     5, true, Operator.Div},
-        {Tok.Percent,   5, true, Operator.Mod},
+           {Tok.Star,      5, true, Operator.Mul},
+           {Tok.Slash,     5, true, Operator.Div},
+           {Tok.Percent,   5, true, Operator.Mod},
 
-        {Tok.LeftShift,             8, true, Operator.LeftShift},
-        {Tok.RightShift,            8, true, Operator.RightShift},
-        {Tok.UnsignedRightShift,    8, true, Operator.UnsignedRightShift}
-    ];
-    BinOp* binary(Tok t)
-    {
-        foreach (ref op; _binary)
-            if (op.tokenType == t)
-                return &op;
-        return null;
-    }
+           {Tok.LeftShift,             8, true, Operator.LeftShift},
+           {Tok.RightShift,            8, true, Operator.RightShift},
+           {Tok.UnsignedRightShift,    8, true, Operator.UnsignedRightShift}
+       ];
+       BinOp* binary(Tok t)
+       {
+           foreach (ref op; _binary)
+               if (op.tokenType == t)
+                   return &op;
+           return null;
+       }
 
 private:
 
-    Token require(Tok t)
-    {
-        if (peek().type != t)
-            messages.report(UnexpectedTokSingle, peek.location)
-                .arg(peek.getType)
-                .arg(t);
-        return next();
-    }
+       Token require(Tok t)
+       {
+           if (peek().type != t)
+               messages.report(UnexpectedTokSingle, peek.location)
+                   .arg(peek.getType)
+                   .arg(t);
+           return next();
+       }
 
-    bool skip(Tok t)
-    {
-        if (peek().type != t)
-            return false;
-        next();
-        return true;
-    }
+       bool skip(Tok t)
+       {
+           if (peek().type != t)
+               return false;
+           next();
+           return true;
+       }
 
-    bool isa(Tok t)
-    {
-        return peek.type == t;
-    }
+       bool isa(Tok t)
+       {
+           return peek.type == t;
+       }
 
-    Token next()
-    {
-        return lexer.next;
-    }
+       Token next()
+       {
+           return lexer.next;
+       }
 
-    Token peek(int i = 0)
-    {
-        return lexer.peek(i);
-    }
+       Token peek(int i = 0)
+       {
+           return lexer.peek(i);
+       }
 
-    Lexer lexer;   
-    SourceManager sm;
+       Lexer lexer;   
+       SourceManager sm;
 }
 
--- a/tools/AstPrinter.d	Mon Jul 21 20:35:03 2008 +0200
+++ b/tools/AstPrinter.d	Mon Jul 21 21:18:18 2008 +0200
@@ -299,8 +299,8 @@
             print("abstract ");
         if ( a.getOverride )
             print("override ");
-        if ( a.getDepracted )
-            print("depracted ");
+        if ( a.getDeprecated )
+            print("deprecated ");
         if ( a.getAuto )
             print("auto ");
     }