Mercurial > projects > dang
annotate lexer/Keyword.d @ 42:4e879f82dd64 new_gen
Added some docs for the lexer - now you can understand _some_ of the madness going on here :)
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Tue, 22 Apr 2008 22:25:07 +0200 |
parents | 858b9805843d |
children | 381975d76baf |
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 | |
12
6282db07115f
Added some ekstra tests, and allowed bool as a type
Anders Halager <halager@gmail.com>
parents:
11
diff
changeset
|
25 "bool" : Tok.Bool, |
6282db07115f
Added some ekstra tests, and allowed bool as a type
Anders Halager <halager@gmail.com>
parents:
11
diff
changeset
|
26 |
1 | 27 "float" : Tok.Float, |
28 "double" : Tok.Double, | |
29 | |
37 | 30 "void" : Tok.Void, |
31 | |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
32 // type related |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
33 "struct" : Tok.Struct, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
34 |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
35 // control flow |
5
2c5a8f4c254a
Added very simple if support.
Anders Halager <halager@gmail.com>
parents:
1
diff
changeset
|
36 "if" : Tok.If, |
11
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
37 "else" : Tok.Else, |
642c6a998fd9
Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents:
5
diff
changeset
|
38 "while" : Tok.While, |
36
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
39 "switch" : Tok.Switch, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
40 "case" : Tok.Case, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
41 "default" : Tok.Default, |
ce17bea8e9bd
Switch statements support
Anders Halager <halager@gmail.com>
parents:
22
diff
changeset
|
42 "return" : Tok.Return |
1 | 43 ]; |
44 } |