Mercurial > projects > dil
changeset 219:0d14a09227a4
- Simplified parseScopeStatement().
- Added check for T.Semicolon in parseNoScopeStatement().
- Simplified parseVolatileStatement().
- Fixed parseVersionStatement().
author | aziz |
---|---|
date | Thu, 26 Jul 2007 13:40:02 +0000 |
parents | 6c0d274e0f3f |
children | 0c647e319b8e |
files | trunk/src/Parser.d |
diffstat | 1 files changed, 12 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Parser.d Thu Jul 26 12:07:02 2007 +0000 +++ b/trunk/src/Parser.d Thu Jul 26 13:40:02 2007 +0000 @@ -1566,27 +1566,11 @@ /+ ScopeStatement: - NonEmptyStatement - BlockStatement - BlockStatement: - { } - { StatementList } + NoScopeStatement +/ Statement parseScopeStatement() { - Statement s; - if (token.type == T.LBrace) - { - nT(); - auto ss = new Statements(); - while (token.type != T.RBrace && token.type != T.EOF) - ss ~= parseStatement(); - require(T.RBrace); - s = ss; - } - else - s = parseStatement(); - return new ScopeStatement(s); + return new ScopeStatement(parseNoScopeStatement()); } /+ @@ -1609,6 +1593,12 @@ require(T.RBrace); s = ss; } + else if (token.type == T.Semicolon) + { + error(MID.ExpectedButFound, "non-empty statement", ";"); + s = new EmptyStatement(); + nT(); + } else s = parseStatement(); return s; @@ -1978,7 +1968,7 @@ else if (token.type == T.LBrace) volatileBody = parseScopeStatement(); else - volatileBody = parseNoScopeStatement(); + volatileBody = parseStatement(); return new VolatileStatement(volatileBody); } @@ -2120,13 +2110,15 @@ void parseIdentOrInt(ref string ident, ref int level) { - nT(); if (token.type == T.Int32) level = token.int_; else if (token.type == T.Identifier) ident = token.identifier; else + { expected(T.Identifier); // TODO: better error msg + return; + } nT(); }