Mercurial > projects > ddmd
diff dmd/Lexer.d @ 168:ceed63f310fb
stringtable, stringbuffer and freelist moved to Global
author | korDen |
---|---|
date | Thu, 30 Sep 2010 12:57:13 +0400 |
parents | fe932c1a9563 |
children | e7769d53e750 |
line wrap: on
line diff
--- a/dmd/Lexer.d Thu Sep 30 12:13:49 2010 +0400 +++ b/dmd/Lexer.d Thu Sep 30 12:57:13 2010 +0400 @@ -37,7 +37,7 @@ bool isUniAlpha(uint u) { - static ushort table[][2] = + enum ushort table[][2] = [ [ 0x00AA, 0x00AA ], [ 0x00B5, 0x00B5 ], @@ -344,10 +344,6 @@ class Lexer { - static StringTable stringtable; - static OutBuffer stringbuffer; - static Token* freelist; - Loc loc; // for error messages ubyte* base; // pointer to start of buffer @@ -358,17 +354,6 @@ int doDocComment; // collect doc comment information int anyToken; // !=0 means seen at least one token int commentToken; // !=0 means comments are TOKcomment's - - static this() - { - stringtable = new StringTable(); - stringbuffer = new OutBuffer(); - } - - static ~this() - { - //delete stringtable; - } this(Module mod, ubyte* base, uint begoffset, uint endoffset, int doDocComment, int commentToken) { @@ -692,7 +677,17 @@ cmtable[c] |= CMidchar; } } - + + static StringTable stringtable() + { + return global.stringtable; + } + + static OutBuffer stringbuffer() + { + return global.stringbuffer; + } + static void initKeywords() { uint nkeywords = keywords.length; @@ -838,8 +833,7 @@ static Identifier uniqueId(string s) { - static int num; - return uniqueId(s, ++num); + return uniqueId(s, ++global.num); } /********************************************* @@ -864,8 +858,8 @@ { t = token.next; memcpy(&token, t, Token.sizeof); - t.next = freelist; - freelist = t; + t.next = global.freelist; + global.freelist = t; } else {