token rename

This commit is contained in:
Hackerpilot 2013-02-27 21:01:46 +00:00
parent 9b0d3d78d1
commit 16ac572ad5
1 changed files with 14 additions and 14 deletions

View File

@ -818,7 +818,7 @@ private:
lexComment!false(); lexComment!false();
return; return;
case '=': case '=':
current.type = TokenType.divEquals; current.type = TokenType.divEqual;
current.value = "/="; current.value = "/=";
src.popFront(); src.popFront();
return; return;
@ -2116,7 +2116,7 @@ private:
else else
return c == 0x20 || (c >= 0x09 && c <= 0x0d); return c == 0x20 || (c >= 0x09 && c <= 0x0d);
} }
bool isLongWhite() bool isLongWhite()
{ {
assert(src.front & 0x80); // only non-ascii assert(src.front & 0x80); // only non-ascii
@ -2170,7 +2170,7 @@ private:
*/ */
pure nothrow bool isOperator(const TokenType t) pure nothrow bool isOperator(const TokenType t)
{ {
return t >= TokenType.assign && t <= TokenType.xorEquals; return t >= TokenType.assign && t <= TokenType.xorEqual;
} }
/** /**
@ -2342,7 +2342,7 @@ enum TokenType: ushort
comma, /// , comma, /// ,
decrement, /// -- decrement, /// --
div, /// / div, /// /
divEquals, /// /= divEqual, /// /=
dollar, /// $ dollar, /// $
dot, /// . dot, /// .
equals, /// == equals, /// ==
@ -2403,6 +2403,7 @@ enum TokenType: ushort
char_, /// $(D_KEYWORD char) char_, /// $(D_KEYWORD char)
creal_, /// $(D_KEYWORD creal) creal_, /// $(D_KEYWORD creal)
dchar_, /// $(D_KEYWORD dchar) dchar_, /// $(D_KEYWORD dchar)
delegate_, /// $(D_KEYWORD delegate)
double_, /// $(D_KEYWORD double) double_, /// $(D_KEYWORD double)
float_, /// $(D_KEYWORD float) float_, /// $(D_KEYWORD float)
function_, /// $(D_KEYWORD function) function_, /// $(D_KEYWORD function)
@ -2454,7 +2455,6 @@ enum TokenType: ushort
continue_, /// $(D_KEYWORD continue) continue_, /// $(D_KEYWORD continue)
debug_, /// $(D_KEYWORD debug) debug_, /// $(D_KEYWORD debug)
default_, /// $(D_KEYWORD default) default_, /// $(D_KEYWORD default)
delegate_, /// $(D_KEYWORD delegate)
delete_, /// $(D_KEYWORD delete) delete_, /// $(D_KEYWORD delete)
do_, /// $(D_KEYWORD do) do_, /// $(D_KEYWORD do)
else_, /// $(D_KEYWORD else) else_, /// $(D_KEYWORD else)
@ -2619,6 +2619,7 @@ immutable(string[TokenType.max + 1]) tokenValues = [
"char", "char",
"creal", "creal",
"dchar", "dchar",
"delegate",
"double", "double",
"float", "float",
"function", "function",
@ -2668,7 +2669,6 @@ immutable(string[TokenType.max + 1]) tokenValues = [
"continue", "continue",
"debug", "debug",
"default", "default",
"delegate",
"delete", "delete",
"do", "do",
"else", "else",
@ -3059,12 +3059,12 @@ struct StringCache
if(isRandomAccessRange!R if(isRandomAccessRange!R
&& is(Unqual!(ElementType!R) : const(ubyte))) && is(Unqual!(ElementType!R) : const(ubyte)))
{ {
uint h = hash(range); uint h = hash(range);
uint bucket = h % mapSize; uint bucket = h % mapSize;
Slot *s = &index[bucket]; Slot *s = &index[bucket];
//1st slot not yet initialized? //1st slot not yet initialized?
if(s.value.ptr == null) if(s.value.ptr == null)
{ {
*s = Slot(putIntoCache(range), null, h); *s = Slot(putIntoCache(range), null, h);
return s.value; return s.value;
@ -3077,7 +3077,7 @@ struct StringCache
insSlot = s; insSlot = s;
s = s.next; s = s.next;
if(s == null) break; if(s == null) break;
} }
string str = putIntoCache(range); string str = putIntoCache(range);
insertIntoSlot(insSlot, str, h); insertIntoSlot(insSlot, str, h);
return str; return str;
@ -3097,14 +3097,14 @@ private:
} }
enum mapSize = 2048; enum mapSize = 2048;
struct Slot struct Slot
{ {
string value; string value;
Slot* next; Slot* next;
uint hash; uint hash;
}; };
void insertIntoSlot(Slot* tgt, string val, uint hash) void insertIntoSlot(Slot* tgt, string val, uint hash)
{ {
auto slice = allocateInCache(Slot.sizeof); auto slice = allocateInCache(Slot.sizeof);
@ -3112,14 +3112,14 @@ private:
*newSlot = Slot(val, null, hash); *newSlot = Slot(val, null, hash);
tgt.next = newSlot; tgt.next = newSlot;
} }
Slot[mapSize] index; Slot[mapSize] index;
// leave some slack for alloctors/GC meta-data // leave some slack for alloctors/GC meta-data
enum chunkSize = 16*1024 - size_t.sizeof*8; enum chunkSize = 16*1024 - size_t.sizeof*8;
ubyte*[] chunkS; ubyte*[] chunkS;
size_t next = chunkSize; size_t next = chunkSize;
ubyte[] allocateInCache(size_t size) ubyte[] allocateInCache(size_t size)
{ {
import core.memory; import core.memory;