comparison trunk/src/dil/lexer/TokensEnum.d @ 597:4d50267f59c9

Moved dil.TokensEnum to dil.lexer.TokensEnum.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 06 Jan 2008 00:28:26 +0100
parents trunk/src/dil/TokensEnum.d@3bc7801c207e
children c5fd3b7bfcab
comparison
equal deleted inserted replaced
596:39fac5531b85 597:4d50267f59c9
1 /++
2 Author: Aziz Köksal
3 License: GPL3
4 +/
5 module dil.lexer.TokensEnum;
6
7 import common;
8
9 enum TOK : ushort
10 {
11 Invalid,
12
13 Illegal,
14 Comment,
15 Shebang,
16 HashLine,
17 Filespec,
18 Newline,
19 Empty,
20
21 Identifier,
22 String,
23 CharLiteral,
24
25 // Special tokens
26 FILE,
27 LINE,
28 DATE,
29 TIME,
30 TIMESTAMP,
31 VENDOR,
32 VERSION,
33
34 // Number literals
35 Int32, Int64, Uint32, Uint64,
36 // Floating point number scanner relies on this order. (FloatXY + 3 == ImaginaryXY)
37 Float32, Float64, Float80,
38 Imaginary32, Imaginary64, Imaginary80,
39
40
41 // Brackets
42 LParen,
43 RParen,
44 LBracket,
45 RBracket,
46 LBrace,
47 RBrace,
48
49 Dot, Slice, Ellipses,
50
51 // Floating point number operators
52 Unordered,
53 UorE,
54 UorG,
55 UorGorE,
56 UorL,
57 UorLorE,
58 LorEorG,
59 LorG,
60
61 // Normal operators
62 Assign, Equal, NotEqual, Not,
63 LessEqual, Less,
64 GreaterEqual, Greater,
65 LShiftAssign, LShift,
66 RShiftAssign,RShift,
67 URShiftAssign, URShift,
68 OrAssign, OrLogical, OrBinary,
69 AndAssign, AndLogical, AndBinary,
70 PlusAssign, PlusPlus, Plus,
71 MinusAssign, MinusMinus, Minus,
72 DivAssign, Div,
73 MulAssign, Mul,
74 ModAssign, Mod,
75 XorAssign, Xor,
76 CatAssign,
77 Tilde,
78
79 Colon,
80 Semicolon,
81 Question,
82 Comma,
83 Dollar,
84
85 /* Keywords:
86 NB.: Token.isKeyword() depends on this list being contiguous.
87 */
88 Abstract, Alias, Align, Asm, Assert, Auto, Body,
89 Break, Case, Cast, Catch,
90 Class, Const, Continue,
91 Debug, Default, Delegate, Delete, Deprecated, Do,
92 Else, Enum, Export, Extern, False, Final,
93 Finally, For, Foreach, Foreach_reverse, Function, Goto,
94 If, Import, In, Inout,
95 Interface, Invariant, Is, Lazy, Macro/+D2.0+/,
96 Mixin, Module, New, Null, Out, Override, Package,
97 Pragma, Private, Protected, Public, Ref/+D2.0+/, Return,
98 Scope, Static, Struct, Super, Switch, Synchronized,
99 Template, This, Throw, Traits/+D2.0+/, True, Try, Typedef, Typeid,
100 Typeof, Union, Unittest,
101 Version, Volatile, While, With,
102 // Integral types.
103 Char, Wchar, Dchar, Bool,
104 Byte, Ubyte, Short, Ushort,
105 Int, Uint, Long, Ulong,
106 Cent, Ucent,
107 Float, Double, Real,
108 Ifloat, Idouble, Ireal,
109 Cfloat, Cdouble, Creal, Void,
110
111 HEAD, // start of linked list
112 EOF,
113 MAX
114 }
115
116 alias TOK.Abstract KeywordsBegin;
117 alias TOK.Void KeywordsEnd;
118 alias TOK.Char IntegralTypeBegin;
119 alias TOK.Void IntegralTypeEnd;
120 alias TOK.FILE SpecialTokensBegin;
121 alias TOK.VERSION SpecialTokensEnd;
122
123 /// A table mapping each TOK to a string.
124 const string[] tokToString = [
125 "Invalid",
126
127 "Illegal",
128 "Comment",
129 "#! /shebang/",
130 "#line",
131 `"filespec"`,
132 "Newline",
133 "Empty",
134
135 "Identifier",
136 "String",
137 "CharLiteral",
138
139 "__FILE__",
140 "__LINE__",
141 "__DATE__",
142 "__TIME__",
143 "__TIMESTAMP__",
144 "__VENDOR__",
145 "__VERSION__",
146
147 "Int32", "Int64", "Uint32", "Uint64",
148 "Float32", "Float64", "Float80",
149 "Imaginary32", "Imaginary64", "Imaginary80",
150
151 "(",
152 ")",
153 "[",
154 "]",
155 "{",
156 "}",
157
158 ".", "..", "...",
159
160 "!<>=", // Unordered
161 "!<>", // UorE
162 "!<=", // UorG
163 "!<", // UorGorE
164 "!>=", // UorL
165 "!>", // UorLorE
166 "<>=", // LorEorG
167 "<>", // LorG
168
169 "=", "==", "!=", "!",
170 "<=", "<",
171 ">=", ">",
172 "<<=", "<<",
173 ">>=",">>",
174 ">>>=", ">>>",
175 "|=", "||", "|",
176 "&=", "&&", "&",
177 "+=", "++", "+",
178 "-=", "--", "-",
179 "/=", "/",
180 "*=", "*",
181 "%=", "%",
182 "^=", "^",
183 "~=",
184 "~",
185
186 ":",
187 ";",
188 "?",
189 ",",
190 "$",
191
192 "abstract","alias","align","asm","assert","auto","body",
193 "break","case","cast","catch",
194 "class","const","continue",
195 "debug","default","delegate","delete","deprecated","do",
196 "else","enum","export","extern","false","final",
197 "finally","for","foreach","foreach_reverse","function","goto",
198 "if","import","in","inout",
199 "interface","invariant","is","lazy","macro",
200 "mixin","module","new","null","out","override","package",
201 "pragma","private","protected","public","ref","return",
202 "scope","static","struct","super","switch","synchronized",
203 "template","this","throw","__traits","true","try","typedef","typeid",
204 "typeof","union","unittest",
205 "version","volatile","while","with",
206 // Integral types.
207 "char", "wchar", "dchar", "bool",
208 "byte", "ubyte", "short", "ushort",
209 "int", "uint", "long", "ulong",
210 "cent", "ucent",
211 "float", "double", "real",
212 "ifloat", "idouble", "ireal",
213 "cfloat", "cdouble", "creal", "void",
214
215 "HEAD",
216 "EOF"
217 ];
218 static assert(tokToString.length == TOK.EOF+1);