94
|
1 /++
|
|
2 Author: Aziz Köksal
|
|
3 License: GPL2
|
|
4 +/
|
|
5 module Types;
|
|
6 import Token;
|
|
7 import Expressions;
|
|
8
|
95
|
9 enum StorageClass
|
|
10 {
|
|
11 None = 0,
|
|
12 Abstract = 1,
|
|
13 Auto = 1<<2,
|
|
14 Const = 1<<3,
|
|
15 Deprecated = 1<<4,
|
|
16 Extern = 1<<5,
|
|
17 Final = 1<<6,
|
|
18 Invariant = 1<<7,
|
|
19 Override = 1<<8,
|
|
20 Scope = 1<<9,
|
|
21 Static = 1<<10,
|
|
22 Synchronized = 1<<11,
|
|
23 In = 1<<12,
|
|
24 Out = 1<<13,
|
|
25 Ref = 1<<14,
|
|
26 Lazy = 1<<15,
|
|
27 Variadic = 1<<16,
|
|
28 }
|
|
29
|
94
|
30 class Type
|
|
31 {
|
|
32 TOK type;
|
95
|
33 Type next;
|
|
34
|
94
|
35 this(TOK type)
|
95
|
36 { this(type, null); }
|
|
37
|
|
38 this(TOK type, Type next)
|
94
|
39 {
|
|
40 this.type = type;
|
95
|
41 this.next = next;
|
94
|
42 }
|
|
43 }
|
|
44
|
|
45 class IdentifierType : Type
|
|
46 {
|
|
47 string[] idents;
|
|
48
|
|
49 this(string[] idents)
|
|
50 {
|
95
|
51 super(TOK.Identifier, null);
|
94
|
52 this.idents = idents;
|
|
53 }
|
|
54
|
|
55 this(TOK type)
|
|
56 {
|
95
|
57 super(type, null);
|
94
|
58 }
|
|
59
|
|
60 void opCatAssign(string ident)
|
|
61 {
|
|
62 this.idents ~= ident;
|
|
63 }
|
|
64 }
|
|
65
|
|
66 class TypeofType : IdentifierType
|
|
67 {
|
|
68 Expression e;
|
|
69 this(Expression e)
|
|
70 {
|
|
71 super(TOK.Typeof);
|
|
72 this.e = e;
|
|
73 }
|
|
74 }
|
95
|
75
|
|
76 class PointerType : Type
|
|
77 {
|
|
78 this(Type t)
|
|
79 {
|
|
80 super(TOK.Mul, t);
|
|
81 }
|
|
82 }
|
|
83
|
|
84 class ArrayType : Type
|
|
85 {
|
|
86 Expression e;
|
|
87 this(Type t, Expression e)
|
|
88 {
|
|
89 super(TOK.Invalid, t);
|
|
90 this.e = e;
|
|
91 }
|
|
92 }
|
100
|
93
|
|
94 class SpecializationType : Type
|
|
95 {
|
|
96 TOK specTok; // T.Colon|T.Equal
|
|
97 Type type;
|
|
98 TOK tokType; // T.Typedef|T.Struct|T.Union|T.Class|T.Interface|
|
|
99 // T.Enum| T.Function|T.Delegate|T.Super|T.Return
|
|
100
|
|
101 this(TOK specTok, TOK tokType)
|
|
102 {
|
|
103 super(TOK.Invalid, null);
|
|
104 this.specTok = specTok;
|
|
105 this.tokType = tokType;
|
|
106 }
|
|
107
|
|
108 this(TOK specTok, Type type)
|
|
109 {
|
|
110 super(TOK.Invalid, null);
|
|
111 this.specTok = specTok;
|
|
112 this.type = type;
|
|
113 }
|
|
114 }
|