Mercurial > projects > ldc
comparison dmd/attrib.h @ 1:c53b6e3fe49a trunk
[svn r5] Initial commit. Most things are very rough.
author | lindquist |
---|---|
date | Sat, 01 Sep 2007 21:43:27 +0200 |
parents | |
children | 788401029ecf |
comparison
equal
deleted
inserted
replaced
0:a9e71648e74d | 1:c53b6e3fe49a |
---|---|
1 | |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 by Digital Mars | |
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_ATTRIB_H | |
12 #define DMD_ATTRIB_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "dsymbol.h" | |
19 | |
20 struct Expression; | |
21 struct Statement; | |
22 struct LabelDsymbol; | |
23 struct Initializer; | |
24 struct Module; | |
25 struct Condition; | |
26 #ifdef _DH | |
27 struct HdrGenState; | |
28 #endif | |
29 | |
30 /**************************************************************/ | |
31 | |
32 struct AttribDeclaration : Dsymbol | |
33 { | |
34 Array *decl; // array of Dsymbol's | |
35 | |
36 AttribDeclaration(Array *decl); | |
37 virtual Array *include(Scope *sc, ScopeDsymbol *s); | |
38 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
39 void semantic(Scope *sc); | |
40 void semantic2(Scope *sc); | |
41 void semantic3(Scope *sc); | |
42 void inlineScan(); | |
43 void addComment(unsigned char *comment); | |
44 void emitComment(Scope *sc); | |
45 char *kind(); | |
46 int oneMember(Dsymbol **ps); | |
47 int hasPointers(); | |
48 void checkCtorConstInit(); | |
49 void addLocalClass(ClassDeclarations *); | |
50 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
51 AttribDeclaration *isAttribDeclaration() { return this; } | |
52 | |
53 void toObjFile(); // compile to .obj file | |
54 }; | |
55 | |
56 struct StorageClassDeclaration: AttribDeclaration | |
57 { | |
58 unsigned stc; | |
59 | |
60 StorageClassDeclaration(unsigned stc, Array *decl); | |
61 Dsymbol *syntaxCopy(Dsymbol *s); | |
62 void semantic(Scope *sc); | |
63 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
64 }; | |
65 | |
66 struct LinkDeclaration : AttribDeclaration | |
67 { | |
68 enum LINK linkage; | |
69 | |
70 LinkDeclaration(enum LINK p, Array *decl); | |
71 Dsymbol *syntaxCopy(Dsymbol *s); | |
72 void semantic(Scope *sc); | |
73 void semantic3(Scope *sc); | |
74 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
75 char *toChars(); | |
76 }; | |
77 | |
78 struct ProtDeclaration : AttribDeclaration | |
79 { | |
80 enum PROT protection; | |
81 | |
82 ProtDeclaration(enum PROT p, Array *decl); | |
83 Dsymbol *syntaxCopy(Dsymbol *s); | |
84 void semantic(Scope *sc); | |
85 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
86 }; | |
87 | |
88 struct AlignDeclaration : AttribDeclaration | |
89 { | |
90 unsigned salign; | |
91 | |
92 AlignDeclaration(unsigned sa, Array *decl); | |
93 Dsymbol *syntaxCopy(Dsymbol *s); | |
94 void semantic(Scope *sc); | |
95 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
96 }; | |
97 | |
98 struct AnonDeclaration : AttribDeclaration | |
99 { | |
100 int isunion; | |
101 Scope *scope; // !=NULL means context to use | |
102 int sem; // 1 if successful semantic() | |
103 | |
104 AnonDeclaration(Loc loc, int isunion, Array *decl); | |
105 Dsymbol *syntaxCopy(Dsymbol *s); | |
106 void semantic(Scope *sc); | |
107 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
108 char *kind(); | |
109 }; | |
110 | |
111 struct PragmaDeclaration : AttribDeclaration | |
112 { | |
113 Expressions *args; // array of Expression's | |
114 | |
115 PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); | |
116 Dsymbol *syntaxCopy(Dsymbol *s); | |
117 void semantic(Scope *sc); | |
118 int oneMember(Dsymbol **ps); | |
119 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
120 char *kind(); | |
121 void toObjFile(); // compile to .obj file | |
122 }; | |
123 | |
124 struct ConditionalDeclaration : AttribDeclaration | |
125 { | |
126 Condition *condition; | |
127 Array *elsedecl; // array of Dsymbol's for else block | |
128 | |
129 ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
130 Dsymbol *syntaxCopy(Dsymbol *s); | |
131 int oneMember(Dsymbol **ps); | |
132 void emitComment(Scope *sc); | |
133 Array *include(Scope *sc, ScopeDsymbol *s); | |
134 void addComment(unsigned char *comment); | |
135 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
136 }; | |
137 | |
138 struct StaticIfDeclaration : ConditionalDeclaration | |
139 { | |
140 ScopeDsymbol *sd; | |
141 int addisdone; | |
142 | |
143 StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); | |
144 Dsymbol *syntaxCopy(Dsymbol *s); | |
145 int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
146 void semantic(Scope *sc); | |
147 char *kind(); | |
148 }; | |
149 | |
150 // Mixin declarations | |
151 | |
152 struct CompileDeclaration : AttribDeclaration | |
153 { | |
154 Expression *exp; | |
155 | |
156 ScopeDsymbol *sd; | |
157 | |
158 CompileDeclaration(Loc loc, Expression *exp); | |
159 Dsymbol *syntaxCopy(Dsymbol *s); | |
160 int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); | |
161 void semantic(Scope *sc); | |
162 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
163 }; | |
164 | |
165 #endif /* DMD_ATTRIB_H */ |