annotate lexer/Keyword.d @ 154:0ea5d2f3e96b

Parsing "this" as constructor. Also removed regex from the test run program(seg fault - dmd???)
author Anders Johnsen <skabet@gmail.com>
date Mon, 21 Jul 2008 21:45:54 +0200
parents 6ec686d9c87d
children 57b0b4464a0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
1 module lexer.Keyword;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
2
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
3 import lexer.Token;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
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
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
9 Tok[char[]] keywords;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
10
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
11 static this ()
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
12 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
13 keywords =
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
14 [
36
ce17bea8e9bd Switch statements support
Anders Halager <halager@gmail.com>
parents: 22
diff changeset
15 // types
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
16 "byte"[] : Tok.Byte,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
17 "ubyte" : Tok.Ubyte,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
18 "short" : Tok.Short,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
19 "ushort" : Tok.Ushort,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
20 "int" : Tok.Int,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
21 "uint" : Tok.Uint,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
22 "long" : Tok.Long,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
23 "ulong" : Tok.Ulong,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
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
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
31 "float" : Tok.Float,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
32 "double" : Tok.Double,
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
33
37
858b9805843d Bug-fixes
Anders Halager <halager@gmail.com>
parents: 36
diff changeset
34 "void" : Tok.Void,
858b9805843d Bug-fixes
Anders Halager <halager@gmail.com>
parents: 36
diff changeset
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,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
38 "function" : Tok.Function,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
39 "delegate" : Tok.Delegate,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
40 "class" : Tok.Class,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
41 "interface" : Tok.Interface,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
42 "union" : Tok.Union,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
43 "typedef" : Tok.Typedef,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
44 "typeid" : Tok.Typeid,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
45 "typeof" : Tok.Typeof,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
46 "sizeof" : Tok.Sizeof,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
47 "alias" : Tok.Alias,
154
0ea5d2f3e96b Parsing "this" as constructor. Also removed regex from the test run program(seg fault - dmd???)
Anders Johnsen <skabet@gmail.com>
parents: 148
diff changeset
48 "this" : Tok.This,
0ea5d2f3e96b Parsing "this" as constructor. Also removed regex from the test run program(seg fault - dmd???)
Anders Johnsen <skabet@gmail.com>
parents: 148
diff changeset
49 // "super" : Tok.Super,
36
ce17bea8e9bd Switch statements support
Anders Halager <halager@gmail.com>
parents: 22
diff changeset
50
ce17bea8e9bd Switch statements support
Anders Halager <halager@gmail.com>
parents: 22
diff changeset
51 // control flow
5
2c5a8f4c254a Added very simple if support.
Anders Halager <halager@gmail.com>
parents: 1
diff changeset
52 "if" : Tok.If,
11
642c6a998fd9 Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents: 5
diff changeset
53 "else" : Tok.Else,
642c6a998fd9 Support for while statements and fixed scope for if
Anders Halager <halager@gmail.com>
parents: 5
diff changeset
54 "while" : Tok.While,
146
8c09fdaa724e Parsing for-loop.
Anders Johnsen <skabet@gmail.com>
parents: 140
diff changeset
55 "for" : Tok.For,
36
ce17bea8e9bd Switch statements support
Anders Halager <halager@gmail.com>
parents: 22
diff changeset
56 "switch" : Tok.Switch,
ce17bea8e9bd Switch statements support
Anders Halager <halager@gmail.com>
parents: 22
diff changeset
57 "case" : Tok.Case,
ce17bea8e9bd Switch statements support
Anders Halager <halager@gmail.com>
parents: 22
diff changeset
58 "default" : Tok.Default,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
59 "break" : Tok.Break,
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
60 "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
61 "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
62
48bb2287c035 Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents: 68
diff changeset
63 // 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
64 "module" : Tok.Module,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
65 "import" : Tok.Import,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
66
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
67 // attributse
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
68 "public" : Tok.Public,
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 126
diff changeset
69 "private" : Tok.Private,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
70 "protected" : Tok.Protected,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
71 "package" : Tok.Package,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
72 "export" : Tok.Export,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
73 "static" : Tok.Static,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
74 "final" : Tok.Final,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
75 "const" : Tok.Const,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
76 "abstract" : Tok.Abstract,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
77 "override" : Tok.Override,
148
6ec686d9c87d Fixed some for parsing, and removed a little ugly bug.
Anders Johnsen <skabet@gmail.com>
parents: 146
diff changeset
78 "deprecated": Tok.Deprecated,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
79 "auto" : Tok.Auto,
148
6ec686d9c87d Fixed some for parsing, and removed a little ugly bug.
Anders Johnsen <skabet@gmail.com>
parents: 146
diff changeset
80 "extern" : Tok.Extern,
126
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
81
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
82 // exceptions
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
83 "assert" : Tok.Assert,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
84 "throw" : Tok.Throw,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
85 "try" : Tok.Try,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
86 "catch" : Tok.Catch,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
87 "finally" : Tok.Finally,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
88
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
89 // functions
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
90 "in" : Tok.In,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
91 "out" : Tok.Out,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
92 "body" : Tok.Body,
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
93
c3b24e7e8cf8 Carius changes to the parser. Parsing attributes, lexing many keywords(not all yet).
Anders Johnsen <skabet@gmail.com>
parents: 103
diff changeset
94 "asm" : Tok.Asm
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
95 ];
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
96 }