mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-12 06:49:02 +02:00
Merged DMD 2.021 frontend.
Removed generated files from dmd/dmd2 dirs.
This commit is contained in:
26
dmd2/parse.c
26
dmd2/parse.c
@@ -70,8 +70,26 @@ Array *Parser::parseModule()
|
||||
if (token.value == TOKmodule)
|
||||
{
|
||||
unsigned char *comment = token.blockComment;
|
||||
bool safe = FALSE;
|
||||
|
||||
nextToken();
|
||||
if (token.value == TOKlparen)
|
||||
{
|
||||
nextToken();
|
||||
if (token.value != TOKidentifier)
|
||||
{ error("module (safe) identifier expected");
|
||||
goto Lerr;
|
||||
}
|
||||
Identifier *id = token.ident;
|
||||
|
||||
if (id == Id::system)
|
||||
safe = TRUE;
|
||||
else
|
||||
error("(safe) expected, not %s", id->toChars());
|
||||
nextToken();
|
||||
check(TOKrparen);
|
||||
}
|
||||
|
||||
if (token.value != TOKidentifier)
|
||||
{ error("Identifier expected following module");
|
||||
goto Lerr;
|
||||
@@ -95,7 +113,7 @@ Array *Parser::parseModule()
|
||||
id = token.ident;
|
||||
}
|
||||
|
||||
md = new ModuleDeclaration(a, id);
|
||||
md = new ModuleDeclaration(a, id, safe);
|
||||
|
||||
if (token.value != TOKsemicolon)
|
||||
error("';' expected following module declaration instead of %s", token.toChars());
|
||||
@@ -445,7 +463,7 @@ Array *Parser::parseDeclDefs(int once)
|
||||
}
|
||||
ident = token.ident;
|
||||
nextToken();
|
||||
if (token.value == TOKcomma)
|
||||
if (token.value == TOKcomma && peekNext() != TOKrparen)
|
||||
args = parseArguments(); // pragma(identifier, args...)
|
||||
else
|
||||
check(TOKrparen); // pragma(identifier)
|
||||
@@ -3429,7 +3447,7 @@ Statement *Parser::parseStatement(int flags)
|
||||
}
|
||||
ident = token.ident;
|
||||
nextToken();
|
||||
if (token.value == TOKcomma)
|
||||
if (token.value == TOKcomma && peekNext() != TOKrparen)
|
||||
args = parseArguments(); // pragma(identifier, args...);
|
||||
else
|
||||
check(TOKrparen); // pragma(identifier);
|
||||
@@ -5557,7 +5575,7 @@ Expression *Parser::parseExpression()
|
||||
|
||||
/*************************
|
||||
* Collect argument list.
|
||||
* Assume current token is '(' or '['.
|
||||
* Assume current token is ',', '(' or '['.
|
||||
*/
|
||||
|
||||
Expressions *Parser::parseArguments()
|
||||
|
||||
Reference in New Issue
Block a user