diff trunk/src/dil/Keywords.d @ 502:4e14cd1b24da

Refactored code and added modules related to tabulated Identifiers. Rearranged members of struct Identifier and added new member ID identID. Moved idTableLookup to module dil.IdTable. Renamed module TokenIDs to TokensEnum. Added member Identifier* ident to struct Token. Changed string switchtes in Parser to integer switches using enum ID.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Tue, 11 Dec 2007 14:19:30 +0100
parents 0ffcc4ff82f3
children 39fac5531b85
line wrap: on
line diff
--- a/trunk/src/dil/Keywords.d	Sun Dec 09 23:27:40 2007 +0100
+++ b/trunk/src/dil/Keywords.d	Tue Dec 11 14:19:30 2007 +0100
@@ -8,112 +8,112 @@
 
 /// Table of reserved identifiers.
 static const Identifier[] keywords = [
-  {TOK.Abstract, "abstract"},
-  {TOK.Alias, "alias"},
-  {TOK.Align, "align"},
-  {TOK.Asm, "asm"},
-  {TOK.Assert, "assert"},
-  {TOK.Auto, "auto"},
-  {TOK.Body, "body"},
-  {TOK.Bool, "bool"},
-  {TOK.Break, "break"},
-  {TOK.Byte, "byte"},
-  {TOK.Case, "case"},
-  {TOK.Cast, "cast"},
-  {TOK.Catch, "catch"},
-  {TOK.Cdouble, "cdouble"},
-  {TOK.Cent, "cent"},
-  {TOK.Cfloat, "cfloat"},
-  {TOK.Char, "char"},
-  {TOK.Class, "class"},
-  {TOK.Const, "const"},
-  {TOK.Continue, "continue"},
-  {TOK.Creal, "creal"},
-  {TOK.Dchar, "dchar"},
-  {TOK.Debug, "debug"},
-  {TOK.Default, "default"},
-  {TOK.Delegate, "delegate"},
-  {TOK.Delete, "delete"},
-  {TOK.Deprecated, "deprecated"},
-  {TOK.Do, "do"},
-  {TOK.Double, "double"},
-  {TOK.Else, "else"},
-  {TOK.Enum, "enum"},
-  {TOK.Export, "export"},
-  {TOK.Extern, "extern"},
-  {TOK.False, "false"},
-  {TOK.Final, "final"},
-  {TOK.Finally, "finally"},
-  {TOK.Float, "float"},
-  {TOK.For, "for"},
-  {TOK.Foreach, "foreach"},
-  {TOK.Foreach_reverse, "foreach_reverse"},
-  {TOK.Function, "function"},
-  {TOK.Goto, "goto"},
-  {TOK.Idouble, "idouble"},
-  {TOK.If, "if"},
-  {TOK.Ifloat, "ifloat"},
-  {TOK.Import, "import"},
-  {TOK.In, "in"},
-  {TOK.Inout, "inout"},
-  {TOK.Int, "int"},
-  {TOK.Interface, "interface"},
-  {TOK.Invariant, "invariant"},
-  {TOK.Ireal, "ireal"},
-  {TOK.Is, "is"},
-  {TOK.Lazy, "lazy"},
-  {TOK.Long, "long"},
-  {TOK.Macro, "macro"}, // D2.0
-  {TOK.Mixin, "mixin"},
-  {TOK.Module, "module"},
-  {TOK.New, "new"},
-  {TOK.Null, "null"},
-  {TOK.Out, "out"},
-  {TOK.Override, "override"},
-  {TOK.Package, "package"},
-  {TOK.Pragma, "pragma"},
-  {TOK.Private, "private"},
-  {TOK.Protected, "protected"},
-  {TOK.Public, "public"},
-  {TOK.Real, "real"},
-  {TOK.Ref, "ref"},
-  {TOK.Return, "return"},
-  {TOK.Scope, "scope"},
-  {TOK.Short, "short"},
-  {TOK.Static, "static"},
-  {TOK.Struct, "struct"},
-  {TOK.Super, "super"},
-  {TOK.Switch, "switch"},
-  {TOK.Synchronized, "synchronized"},
-  {TOK.Template, "template"},
-  {TOK.This, "this"},
-  {TOK.Throw, "throw"},
-  {TOK.Traits, "__traits"}, // D2.0
-  {TOK.True, "true"},
-  {TOK.Try, "try"},
-  {TOK.Typedef, "typedef"},
-  {TOK.Typeid, "typeid"},
-  {TOK.Typeof, "typeof"},
-  {TOK.Ubyte, "ubyte"},
-  {TOK.Ucent, "ucent"},
-  {TOK.Uint, "uint"},
-  {TOK.Ulong, "ulong"},
-  {TOK.Union, "union"},
-  {TOK.Unittest, "unittest"},
-  {TOK.Ushort, "ushort"},
-  {TOK.Version, "version"},
-  {TOK.Void, "void"},
-  {TOK.Volatile, "volatile"},
-  {TOK.Wchar, "wchar"},
-  {TOK.While, "while"},
-  {TOK.With, "with"},
+  {"abstract", TOK.Abstract},
+  {"alias", TOK.Alias},
+  {"align", TOK.Align},
+  {"asm", TOK.Asm},
+  {"assert", TOK.Assert},
+  {"auto", TOK.Auto},
+  {"body", TOK.Body},
+  {"bool", TOK.Bool},
+  {"break", TOK.Break},
+  {"byte", TOK.Byte},
+  {"case", TOK.Case},
+  {"cast", TOK.Cast},
+  {"catch", TOK.Catch},
+  {"cdouble", TOK.Cdouble},
+  {"cent", TOK.Cent},
+  {"cfloat", TOK.Cfloat},
+  {"char", TOK.Char},
+  {"class", TOK.Class},
+  {"const", TOK.Const},
+  {"continue", TOK.Continue},
+  {"creal", TOK.Creal},
+  {"dchar", TOK.Dchar},
+  {"debug", TOK.Debug},
+  {"default", TOK.Default},
+  {"delegate", TOK.Delegate},
+  {"delete", TOK.Delete},
+  {"deprecated", TOK.Deprecated},
+  {"do", TOK.Do},
+  {"double", TOK.Double},
+  {"else", TOK.Else},
+  {"enum", TOK.Enum},
+  {"export", TOK.Export},
+  {"extern", TOK.Extern},
+  {"false", TOK.False},
+  {"final", TOK.Final},
+  {"finally", TOK.Finally},
+  {"float", TOK.Float},
+  {"for", TOK.For},
+  {"foreach", TOK.Foreach},
+  {"foreach_reverse", TOK.Foreach_reverse},
+  {"function", TOK.Function},
+  {"goto", TOK.Goto},
+  {"idouble", TOK.Idouble},
+  {"if", TOK.If},
+  {"ifloat", TOK.Ifloat},
+  {"import", TOK.Import},
+  {"in", TOK.In},
+  {"inout", TOK.Inout},
+  {"int", TOK.Int},
+  {"interface", TOK.Interface},
+  {"invariant", TOK.Invariant},
+  {"ireal", TOK.Ireal},
+  {"is", TOK.Is},
+  {"lazy", TOK.Lazy},
+  {"long", TOK.Long},
+  {"macro", TOK.Macro}, // D2.0
+  {"mixin", TOK.Mixin},
+  {"module", TOK.Module},
+  {"new", TOK.New},
+  {"null", TOK.Null},
+  {"out", TOK.Out},
+  {"override", TOK.Override},
+  {"package", TOK.Package},
+  {"pragma", TOK.Pragma},
+  {"private", TOK.Private},
+  {"protected", TOK.Protected},
+  {"public", TOK.Public},
+  {"real", TOK.Real},
+  {"ref", TOK.Ref},
+  {"return", TOK.Return},
+  {"scope", TOK.Scope},
+  {"short", TOK.Short},
+  {"static", TOK.Static},
+  {"struct", TOK.Struct},
+  {"super", TOK.Super},
+  {"switch", TOK.Switch},
+  {"synchronized", TOK.Synchronized},
+  {"template", TOK.Template},
+  {"this", TOK.This},
+  {"throw", TOK.Throw},
+  {"__traits", TOK.Traits}, // D2.0
+  {"true", TOK.True},
+  {"try", TOK.Try},
+  {"typedef", TOK.Typedef},
+  {"typeid", TOK.Typeid},
+  {"typeof", TOK.Typeof},
+  {"ubyte", TOK.Ubyte},
+  {"ucent", TOK.Ucent},
+  {"uint", TOK.Uint},
+  {"ulong", TOK.Ulong},
+  {"union", TOK.Union},
+  {"unittest", TOK.Unittest},
+  {"ushort", TOK.Ushort},
+  {"version", TOK.Version},
+  {"void", TOK.Void},
+  {"volatile", TOK.Volatile},
+  {"wchar", TOK.Wchar},
+  {"while", TOK.While},
+  {"with", TOK.With},
   // Special tokens:
-  {TOK.FILE, "__FILE__"},
-  {TOK.LINE, "__LINE__"},
-  {TOK.DATE, "__DATE__"},
-  {TOK.TIME, "__TIME__"},
-  {TOK.TIMESTAMP, "__TIMESTAMP__"},
-  {TOK.VENDOR, "__VENDOR__"},
-  {TOK.VERSION, "__VERSION__"},
-  {TOK.EOF, "__EOF__"}, // D2.0
+  {"__FILE__", TOK.FILE},
+  {"__LINE__", TOK.LINE},
+  {"__DATE__", TOK.DATE},
+  {"__TIME__", TOK.TIME},
+  {"__TIMESTAMP__", TOK.TIMESTAMP},
+  {"__VENDOR__", TOK.VENDOR},
+  {"__VERSION__", TOK.VERSION},
+  {"__EOF__", TOK.EOF}, // D2.0
 ];