Mercurial > projects > dang
annotate lexer/Keyword.d @ 103:09b4d74cb3f5 new_gen
Parsing char, wchar and dchar as basic types.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Thu, 08 May 2008 10:54:29 +0200 |
parents | 48bb2287c035 |
children | c3b24e7e8cf8 |
rev | line source |
---|---|
1 | 1 module lexer.Keyword; |
2 | |
3 import lexer.Token; | |
4 | |
42
4e879f82dd64
Added some docs for the lexer - now you can understand _some_ of the madness going on here :)
Anders Johnsen <skabet@gmail.com>
parents:
37
diff
changeset
|
5 /** |
4e879f82dd64
Added some docs for the lexer - now you can understand _some_ of the madness going on here :)
Anders Johnsen <skabet@gmail.com>
parents:
37
diff
changeset
|
6 A list of keywords in an associative array that link a string |
4e879f82dd64
Added some docs for the lexer - now you can understand _some_ of the madness going on here :)
Anders Johnsen <skabet@gmail.com>
parents:
37
diff
changeset
|
7 representation of the keyword to a Tok |
4e879f82dd64
Added some docs for the lexer - now you can understand _some_ of the madness going on here :)
Anders Johnsen <skabet@gmail.com>
parents:
37
diff
changeset
|
8 */ |
1 | 9 Tok[char[]] keywords; |
10 | |
11 static this () | |
12 { | |
13 keywords = | |
14 [ | |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
15 // types |
1 | 16 "byte"[] : Tok.Byte, |
17 "ubyte" : Tok.Ubyte, | |
18 "short" : Tok.Short, | |
19 "ushort" : Tok.Ushort, | |
20 "int" : Tok.Int, | |
21 "uint" : Tok.Uint, | |
22 "long" : Tok.Long, | |
23 "ulong" : Tok.Ulong, | |
24 | |
103
09b4d74cb3f5
Parsing char, wchar and dchar as basic types.
Anders Johnsen <skabet@gmail.com>
parents:
94
diff
changeset
|
25 "char" : Tok.Char, |
09b4d74cb3f5
Parsing char, wchar and dchar as basic types.
Anders Johnsen <skabet@gmail.com>
parents:
94
diff
changeset
|
26 "wchar" : Tok.Wchar, |
09b4d74cb3f5
Parsing char, wchar and dchar as basic types.
Anders Johnsen <skabet@gmail.com>
parents:
94
diff
changeset
|
27 "dchar" : Tok.Dchar, |
09b4d74cb3f5
Parsing char, wchar and dchar as basic types.
Anders Johnsen <skabet@gmail.com>
parents:
94
diff
changeset
|
28 |
12
6282db07115f
Added some ekstra tests, and allowed bool as a type
Anders Halager <halager@gmail.com>
parents:
11
diff
changeset
|
29 "bool" : Tok.Bool, |
6282db07115f
Added some ekstra tests, and allowed bool as a type
Anders Halager <halager@gmail.com>
parents:
11
diff
changeset
|
30 |
1 | 31 "float" : Tok.Float, |
32 "double" : Tok.Double, | |
33 | |
37 | 34 "void" : Tok.Void, |
35 | |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
36 // type related |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
37 "struct" : Tok.Struct, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
38 |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
39 // control flow |
5
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
40 "if" : Tok.If, |
11
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
41 "else" : Tok.Else, |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
42 "while" : Tok.While, |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
43 "switch" : Tok.Switch, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
44 "case" : Tok.Case, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
45 "default" : Tok.Default, |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
42
diff
changeset
|
46 "return" : Tok.Return, |
94
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
47 "cast" : Tok.Cast, |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
48 |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
49 // modules |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
50 "module" : Tok.Module, |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
68
diff
changeset
|
51 "import" : Tok.Import |
1 | 52 ]; |
53 } |