changeset 9:a0a3223a76c3

Merged
author Anders Halager <halager@gmail.com>
date Fri, 18 Apr 2008 12:52:53 +0200
parents 2ce5209f1954 (current diff) 2e1069ee21af (diff)
children 2f493057cf17
files test.td
diffstat 2 files changed, 28 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lexer/Lexer.d	Fri Apr 18 12:50:54 2008 +0200
+++ b/lexer/Lexer.d	Fri Apr 18 12:52:53 2008 +0200
@@ -85,8 +85,20 @@
                 return Token(Tok.Comma, Location(position - 1, this.source), 1);
             case '=':
                 if(source.data[position] == '=')
-                    return Token(Tok.Equals, Location(position++ - 1, this.source), 2);
+                    return Token(Tok.Eq, Location(position++ - 1, this.source), 2);
                 return Token(Tok.Assign, Location(position - 1, this.source), 1);
+            case '!':
+                if(source.data[position] == '=')
+                    return Token(Tok.Ne, Location(position++ - 1, this.source), 2);
+                return Token(Tok.Not, Location(position - 1, this.source), 1);
+            case '<':
+                if(source.data[position] == '=')
+                    return Token(Tok.Le, Location(position++ - 1, this.source), 2);
+                return Token(Tok.Lt, Location(position - 1, this.source), 1);
+            case '>':
+                if(source.data[position] == '=')
+                    return Token(Tok.Ge, Location(position++ - 1, this.source), 2);
+                return Token(Tok.Gt, Location(position - 1, this.source), 1);
             case '+':
                 return Token(Tok.Add, Location(position - 1, this.source), 1);
             case '-':
@@ -200,6 +212,9 @@
             case ';':
             case ',':
             case '=':
+            case '!':
+            case '<':
+            case '>':
             case '+':
             case '-':
             case '*':
--- a/lexer/Token.d	Fri Apr 18 12:50:54 2008 +0200
+++ b/lexer/Token.d	Fri Apr 18 12:52:53 2008 +0200
@@ -59,8 +59,12 @@
     CloseBrace,
     Seperator,
 
-    /* Boolean operators */
-    Equals, NotEquals,
+    /* Comparator operators */
+    Eq, Ne,
+    Lt, Gt,
+    Le, Ge,
+
+    Not,
 
     /* Keywords */
     Byte, Ubyte,
@@ -90,8 +94,12 @@
         Tok.Int:"Int",
         Tok.Long:"Long",
         Tok.Bool:"Bool",
-        Tok.Equals:"Equals",
-        Tok.NotEquals:"NotEquals",
+        Tok.Eq:"Eq",
+        Tok.Ne:"Ne",
+        Tok.Lt:"Lt",
+        Tok.Le:"Le",
+        Tok.Gt:"Gt",
+        Tok.Ge:"Ge",
         Tok.OpenParentheses:"OpenParentheses",
         Tok.CloseParentheses:"CloseParentheses",
         Tok.OpenBrace:"OpenBrace",