Mercurial > projects > dil
changeset 632:20dddcc54621
Fixed parsing of AsmPostBracketExpression.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sat, 12 Jan 2008 02:55:17 +0100 |
parents | 2feb88f5c867 |
children | 5fa1886d6aaf |
files | trunk/src/dil/ast/Expressions.d trunk/src/dil/parser/Parser.d |
diffstat | 2 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/dil/ast/Expressions.d Sat Jan 12 01:56:04 2008 +0100 +++ b/trunk/src/dil/ast/Expressions.d Sat Jan 12 02:55:17 2008 +0100 @@ -1140,10 +1140,12 @@ class AsmPostBracketExpression : UnaryExpression { - this(Expression e) + Expression e2; /// Expression in brackets: e [ e2 ] + this(Expression e, Expression e2) { super(e); mixin(set_kind); + addChild(e2); } }
--- a/trunk/src/dil/parser/Parser.d Sat Jan 12 01:56:04 2008 +0100 +++ b/trunk/src/dil/parser/Parser.d Sat Jan 12 02:55:17 2008 +0100 @@ -2336,15 +2336,9 @@ // Identifier Expression[] es; if (token.type != T.Semicolon) - { - while (1) - { + do es ~= parseAsmExpression(); - if (token.type != T.Comma) - break; - nT(); - } - } + while (skipped(T.Comma)) require(T.Semicolon); s = new AsmInstruction(ident, es); break; @@ -2562,11 +2556,9 @@ { auto begin = token; auto e = parseAsmUnaryExpression(); - while (token.type == T.LBracket) + while (skipped(T.LBracket)) { - nT(); - e = parseAsmExpression(); - e = new AsmPostBracketExpression(e); + e = new AsmPostBracketExpression(e, parseAsmExpression()); require(T.RBracket); set(e, begin); } @@ -2623,6 +2615,11 @@ case T.Dot: nT(); e = new ModuleScopeExpression(parseIdentifierExpression()); + while (skipped(TOK.Dot)) + { + e = new DotExpression(e, parseIdentifierExpression()); + set(e, begin); + } break; default: LparseAsmPrimaryExpression: @@ -3174,7 +3171,7 @@ auto begin = token; auto ident = requireIdentifier(MSG.ExpectedAnIdentifier); Expression e; - if (token.type == T.Not && peekNext() == T.LParen) + if (token.type == T.Not /+&& peekNext() == T.LParen+/) { // Identifier !( TemplateArguments ) nT(); // Skip !. auto tparams = parseTemplateArguments();