Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
846:bc982f1ad106 | 847:356e65836fb5 |
---|---|
68 | 68 |
69 // ModuleDeclation leads off | 69 // ModuleDeclation leads off |
70 if (token.value == TOKmodule) | 70 if (token.value == TOKmodule) |
71 { | 71 { |
72 unsigned char *comment = token.blockComment; | 72 unsigned char *comment = token.blockComment; |
73 bool safe = FALSE; | |
73 | 74 |
74 nextToken(); | 75 nextToken(); |
76 if (token.value == TOKlparen) | |
77 { | |
78 nextToken(); | |
79 if (token.value != TOKidentifier) | |
80 { error("module (safe) identifier expected"); | |
81 goto Lerr; | |
82 } | |
83 Identifier *id = token.ident; | |
84 | |
85 if (id == Id::system) | |
86 safe = TRUE; | |
87 else | |
88 error("(safe) expected, not %s", id->toChars()); | |
89 nextToken(); | |
90 check(TOKrparen); | |
91 } | |
92 | |
75 if (token.value != TOKidentifier) | 93 if (token.value != TOKidentifier) |
76 { error("Identifier expected following module"); | 94 { error("Identifier expected following module"); |
77 goto Lerr; | 95 goto Lerr; |
78 } | 96 } |
79 else | 97 else |
93 goto Lerr; | 111 goto Lerr; |
94 } | 112 } |
95 id = token.ident; | 113 id = token.ident; |
96 } | 114 } |
97 | 115 |
98 md = new ModuleDeclaration(a, id); | 116 md = new ModuleDeclaration(a, id, safe); |
99 | 117 |
100 if (token.value != TOKsemicolon) | 118 if (token.value != TOKsemicolon) |
101 error("';' expected following module declaration instead of %s", token.toChars()); | 119 error("';' expected following module declaration instead of %s", token.toChars()); |
102 nextToken(); | 120 nextToken(); |
103 addComment(mod, comment); | 121 addComment(mod, comment); |
443 { error("pragma(identifier expected"); | 461 { error("pragma(identifier expected"); |
444 goto Lerror; | 462 goto Lerror; |
445 } | 463 } |
446 ident = token.ident; | 464 ident = token.ident; |
447 nextToken(); | 465 nextToken(); |
448 if (token.value == TOKcomma) | 466 if (token.value == TOKcomma && peekNext() != TOKrparen) |
449 args = parseArguments(); // pragma(identifier, args...) | 467 args = parseArguments(); // pragma(identifier, args...) |
450 else | 468 else |
451 check(TOKrparen); // pragma(identifier) | 469 check(TOKrparen); // pragma(identifier) |
452 | 470 |
453 if (token.value == TOKsemicolon) | 471 if (token.value == TOKsemicolon) |
3427 { error("pragma(identifier expected"); | 3445 { error("pragma(identifier expected"); |
3428 goto Lerror; | 3446 goto Lerror; |
3429 } | 3447 } |
3430 ident = token.ident; | 3448 ident = token.ident; |
3431 nextToken(); | 3449 nextToken(); |
3432 if (token.value == TOKcomma) | 3450 if (token.value == TOKcomma && peekNext() != TOKrparen) |
3433 args = parseArguments(); // pragma(identifier, args...); | 3451 args = parseArguments(); // pragma(identifier, args...); |
3434 else | 3452 else |
3435 check(TOKrparen); // pragma(identifier); | 3453 check(TOKrparen); // pragma(identifier); |
3436 if (token.value == TOKsemicolon) | 3454 if (token.value == TOKsemicolon) |
3437 { nextToken(); | 3455 { nextToken(); |
5555 } | 5573 } |
5556 | 5574 |
5557 | 5575 |
5558 /************************* | 5576 /************************* |
5559 * Collect argument list. | 5577 * Collect argument list. |
5560 * Assume current token is '(' or '['. | 5578 * Assume current token is ',', '(' or '['. |
5561 */ | 5579 */ |
5562 | 5580 |
5563 Expressions *Parser::parseArguments() | 5581 Expressions *Parser::parseArguments() |
5564 { // function call | 5582 { // function call |
5565 Expressions *arguments; | 5583 Expressions *arguments; |