Mercurial > projects > dang
diff parser/Parser.d @ 68:381975d76baf new_gen
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Thu, 01 May 2008 19:25:49 +0200 |
parents | 78a6808b2e0f |
children | 010f46b6641c |
line wrap: on
line diff
--- a/parser/Parser.d Tue Apr 29 20:15:22 2008 +0200 +++ b/parser/Parser.d Thu May 01 19:25:49 2008 +0200 @@ -373,6 +373,8 @@ return iden; } } + else if (next.type == Tok.Cast) + return parseCast(); else if (next.type == Tok.Integer) return action.actOnNumericConstant(next); @@ -380,6 +382,18 @@ assert(0, "Should not happen"); } + Exp parseCast() + { + require(Tok.OpenParentheses); + auto next = lexer.next; + if(!next.isBasicType && !next.isIdentifier) + throw error(__LINE__, "Expected cast type, not "~next.get).tok(next); + + require(Tok.CloseParentheses); + auto exp = P(); + return action.actOnCastExpr(Id(next), exp); + } + struct UnOp { Tok tokenType;