# HG changeset patch # User aziz # Date 1182846960 0 # Node ID 3c7210a722f7542b559d69889eba00361a51af8b # Parent c470b9356e356134676e62f5c745b4cf0e242940 - Added code for parsing LorEorG, LorG, LessEqual, LessThan, LShiftAssign and LShift tokens. - Added comments to case statements. diff -r c470b9356e35 -r 3c7210a722f7 trunk/src/Lexer.d --- a/trunk/src/Lexer.d Tue Jun 26 07:57:00 2007 +0000 +++ b/trunk/src/Lexer.d Tue Jun 26 08:36:00 2007 +0000 @@ -387,9 +387,36 @@ if (c == '`') return scanRawStringLiteral(t); - - switch(c) + switch (c) { + case '<': /* < <= <> <>= << <<= */ + c = *++p; + switch (c) + { + case '=': + t.type = TOK.LessEqual; + goto Lcommon; + case '<': + if (p[1] == '=') { + ++p; + t.type = TOK.LShiftAssign; + } + else + t.type = TOK.LShift; + goto Lcommon; + case '>': + if (p[1] == '=') { + ++p; + t.type = TOK.LorEorG; + } + else + t.type = TOK.LorG; + goto Lcommon; + default: + t.type = TOK.LessThan; + goto Lcommon2; + } + assert(0); case '!': c = *++p; switch (c) @@ -431,7 +458,7 @@ goto Lcommon2; } assert(0); - case '.': + case '.': /* . .. ... */ if (p[1] == '.') { ++p; @@ -445,7 +472,7 @@ else t.type = TOK.Dot; goto Lcommon; - case '|': + case '|': /* | || |= */ c = *++p; if (c == '=') t.type = TOK.OrAssign; @@ -456,7 +483,7 @@ goto Lcommon2; } goto Lcommon; - case '&': + case '&': /* & && &= */ c = *++p; if (c == '=') t.type = TOK.AndAssign; @@ -467,7 +494,7 @@ goto Lcommon2; } goto Lcommon; - case '+': + case '+': /* + ++ += */ c = *++p; if (c == '=') t.type = TOK.PlusAssign; @@ -478,7 +505,7 @@ goto Lcommon2; } goto Lcommon; - case '-': + case '-': /* - -- -= */ c = *++p; if (c == '=') t.type = TOK.MinusAssign; @@ -489,7 +516,7 @@ goto Lcommon2; } goto Lcommon; - case '=': + case '=': /* = == */ if (p[1] == '=') { ++p; t.type = TOK.Equal; @@ -497,7 +524,7 @@ else t.type = TOK.Assign; goto Lcommon; - case '~': + case '~': /* ~ ~= */ if (p[1] == '=') { ++p; t.type = TOK.CatAssign; @@ -505,7 +532,7 @@ else t.type = TOK.Tilde; goto Lcommon; - case '*': + case '*': /* * *= */ if (p[1] == '=') { ++p; t.type = TOK.MulAssign; @@ -513,7 +540,7 @@ else t.type = TOK.Mul; goto Lcommon; - case '^': + case '^': /* ^ ^= */ if (p[1] == '=') { ++p; t.type = TOK.XorAssign; @@ -521,7 +548,7 @@ else t.type = TOK.Xor; goto Lcommon; - case '%': + case '%': /* % %= */ if (p[1] == '=') { ++p; t.type = TOK.ModAssign; diff -r c470b9356e35 -r 3c7210a722f7 trunk/src/Token.d --- a/trunk/src/Token.d Tue Jun 26 07:57:00 2007 +0000 +++ b/trunk/src/Token.d Tue Jun 26 08:36:00 2007 +0000 @@ -17,7 +17,8 @@ String, Character, Number, -/* Braces */ + + // Brackets LParen, RParen, LBracket, @@ -27,14 +28,20 @@ Dot, Slice, Ellipses, + // Floating point operators Unordered, UorE, UorG, UorGorE, UorL, UorLorE, + LorEorG, + LorG, + // Normal operators Assign, Equal, NotEqual, Not, + LessEqual, LessThan, + LShiftAssign, LShift, OrAssign, OrLogical, OrBinary, AndAssign, AndLogical, AndBinary, PlusAssign, PlusPlus, Plus,