diff dmd2/parse.c @ 847:356e65836fb5

Merged DMD 2.021 frontend. Removed generated files from dmd/dmd2 dirs.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sat, 13 Dec 2008 16:14:37 +0100
parents f04dde6e882c
children 638d16625da2
line wrap: on
line diff
--- a/dmd2/parse.c	Sat Dec 13 13:15:31 2008 +0100
+++ b/dmd2/parse.c	Sat Dec 13 16:14:37 2008 +0100
@@ -70,8 +70,26 @@
     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 @@
 		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 @@
 		}
 		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 @@
 	    }
 	    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 @@
 
 /*************************
  * Collect argument list.
- * Assume current token is '(' or '['.
+ * Assume current token is ',', '(' or '['.
  */
 
 Expressions *Parser::parseArguments()