Skip to content

Commit

Permalink
Allow with(...): syntax analogous to attribute declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
schuetzm committed Aug 9, 2014
1 parent c5b285d commit b11368b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -5096,7 +5096,20 @@ Statement *Parser::parseStatement(int flags, const utf8_t** endPtr)
check(TOKlparen);
exp = parseExpression();
check(TOKrparen);
body = parseStatement(PSscope);
if (token.value == TOKcolon)
{
nextToken();
Statements *statements = new Statements();
while (token.value != TOKrcurly && token.value != TOKeof)
{
statements->push(parseStatement(PSsemi | PScurlyscope));
}
body = new CompoundStatement(loc, statements);
}
else
{
body = parseStatement(PSscope);
}
s = new WithStatement(loc, exp, body);
break;
}
Expand Down

0 comments on commit b11368b

Please sign in to comment.