Mercurial > projects > ldc
annotate dmd/parse.h @ 1602:a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
---
dmd/aggregate.h | 24 ++++-
dmd/attrib.c | 63 ++++++----
dmd/attrib.h | 10 +-
dmd/declaration.h | 5 +-
dmd/func.c | 337 ++++++++++++++++++++++-------------------------------
dmd/mars.c | 2 +-
dmd/mars.h | 7 +
dmd/mtype.h | 13 ++-
dmd/parse.c | 32 ++++-
dmd/parse.h | 14 ++-
dmd/scope.h | 2 +-
11 files changed, 263 insertions(+), 246 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:19 -0300 |
parents | 8026319762be |
children | 1b24e9c7cc26 |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
336
diff
changeset
|
3 // Copyright (c) 1999-2009 by Digital Mars |
1 | 4 // All Rights Reserved |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_PARSE_H | |
12 #define DMD_PARSE_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "arraytypes.h" | |
19 #include "lexer.h" | |
20 #include "enum.h" | |
21 | |
22 struct Type; | |
336 | 23 struct TypeQualified; |
1 | 24 struct Expression; |
25 struct Declaration; | |
26 struct Statement; | |
27 struct Import; | |
28 struct Initializer; | |
29 struct FuncDeclaration; | |
30 struct CtorDeclaration; | |
336 | 31 struct PostBlitDeclaration; |
1 | 32 struct DtorDeclaration; |
33 struct StaticCtorDeclaration; | |
34 struct StaticDtorDeclaration; | |
35 struct ConditionalDeclaration; | |
36 struct InvariantDeclaration; | |
37 struct UnitTestDeclaration; | |
38 struct NewDeclaration; | |
39 struct DeleteDeclaration; | |
40 struct Condition; | |
41 struct Module; | |
42 struct ModuleDeclaration; | |
43 struct TemplateDeclaration; | |
44 struct TemplateInstance; | |
45 struct StaticAssert; | |
46 | |
47 /************************************ | |
48 * These control how parseStatement() works. | |
49 */ | |
50 | |
51 enum ParseStatementFlags | |
52 { | |
53 PSsemi = 1, // empty ';' statements are allowed | |
54 PSscope = 2, // start a new scope | |
55 PScurly = 4, // { } statement is required | |
56 PScurlyscope = 8, // { } starts a new scope | |
57 }; | |
58 | |
59 | |
60 struct Parser : Lexer | |
61 { | |
62 ModuleDeclaration *md; | |
63 enum LINK linkage; | |
64 Loc endloc; // set to location of last right curly | |
65 int inBrackets; // inside [] of array index or slice | |
66 | |
67 Parser(Module *module, unsigned char *base, unsigned length, int doDocComment); | |
68 | |
69 Array *parseModule(); | |
70 Array *parseDeclDefs(int once); | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
71 Array *parseAutoDeclarations(StorageClass storageClass, unsigned char *comment); |
1 | 72 Array *parseBlock(); |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
73 void composeStorageClass(StorageClass stc); |
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
74 Expression *parseConstraint(); |
1 | 75 TemplateDeclaration *parseTemplateDeclaration(); |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
76 TemplateParameters *parseTemplateParameterList(int flag = 0); |
1 | 77 Dsymbol *parseMixin(); |
78 Objects *parseTemplateArgumentList(); | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
79 Objects *parseTemplateArgumentList2(); |
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
80 Objects *parseTemplateArgument(); |
1 | 81 StaticAssert *parseStaticAssert(); |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
82 TypeQualified *parseTypeof(); |
1 | 83 enum LINK parseLinkage(); |
84 Condition *parseDebugCondition(); | |
85 Condition *parseVersionCondition(); | |
86 Condition *parseStaticIfCondition(); | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
87 Dsymbol *parseCtor(); |
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
88 PostBlitDeclaration *parsePostBlit(); |
1 | 89 DtorDeclaration *parseDtor(); |
90 StaticCtorDeclaration *parseStaticCtor(); | |
91 StaticDtorDeclaration *parseStaticDtor(); | |
92 InvariantDeclaration *parseInvariant(); | |
93 UnitTestDeclaration *parseUnitTest(); | |
94 NewDeclaration *parseNew(); | |
95 DeleteDeclaration *parseDelete(); | |
96 Arguments *parseParameters(int *pvarargs); | |
97 EnumDeclaration *parseEnum(); | |
98 Dsymbol *parseAggregate(); | |
99 BaseClasses *parseBaseClasses(); | |
100 Import *parseImport(Array *decldefs, int isstatic); | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
101 Type *parseType(Identifier **pident = NULL, TemplateParameters **tpl = NULL); |
1 | 102 Type *parseBasicType(); |
103 Type *parseBasicType2(Type *t); | |
104 Type *parseDeclarator(Type *t, Identifier **pident, TemplateParameters **tpl = NULL); | |
105 Array *parseDeclarations(); | |
106 void parseContracts(FuncDeclaration *f); | |
107 Statement *parseStatement(int flags); | |
108 Initializer *parseInitializer(); | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1367
diff
changeset
|
109 Expression *parseDefaultInitExp(); |
1 | 110 void check(Loc loc, enum TOK value); |
111 void check(enum TOK value); | |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
336
diff
changeset
|
112 void check(enum TOK value, const char *string); |
1 | 113 int isDeclaration(Token *t, int needId, enum TOK endtok, Token **pt); |
114 int isBasicType(Token **pt); | |
115 int isDeclarator(Token **pt, int *haveId, enum TOK endtok); | |
116 int isParameters(Token **pt); | |
117 int isExpression(Token **pt); | |
118 int isTemplateInstance(Token *t, Token **pt); | |
119 int skipParens(Token *t, Token **pt); | |
120 | |
121 Expression *parseExpression(); | |
122 Expression *parsePrimaryExp(); | |
123 Expression *parseUnaryExp(); | |
124 Expression *parsePostExp(Expression *e); | |
125 Expression *parseMulExp(); | |
126 Expression *parseAddExp(); | |
127 Expression *parseShiftExp(); | |
128 Expression *parseRelExp(); | |
129 Expression *parseEqualExp(); | |
130 Expression *parseCmpExp(); | |
131 Expression *parseAndExp(); | |
132 Expression *parseXorExp(); | |
133 Expression *parseOrExp(); | |
134 Expression *parseAndAndExp(); | |
135 Expression *parseOrOrExp(); | |
136 Expression *parseCondExp(); | |
137 Expression *parseAssignExp(); | |
138 | |
139 Expressions *parseArguments(); | |
140 | |
141 Expression *parseNewExp(Expression *thisexp); | |
142 | |
143 void addComment(Dsymbol *s, unsigned char *blockComment); | |
144 }; | |
145 | |
146 #endif /* DMD_PARSE_H */ |