Added support for lexing >= and <=
authorMichael Welch <michaelgwelch@gmail.com>
Thu, 28 Dec 2006 22:29:20 +0000 (22:29 +0000)
committerMichael Welch <michaelgwelch@gmail.com>
Thu, 28 Dec 2006 22:29:20 +0000 (22:29 +0000)
mbasic/Lexer.cs

index 29d4e56..7ae9d05 100644 (file)
@@ -130,9 +130,25 @@ namespace mbasic
                             reader.Advance();
                             return Token.NotEquals;
                         }
+                        else if (ch == '=')
+                        {
+                            reader.Advance();
+                            return Token.LessThanEqual;
+                        }
                         else return Token.LessThan;
                     }
 
+                    if (ch == '>')
+                    {
+                        ch = reader.Read();
+                        if (ch == '=')
+                        {
+                            reader.Advance();
+                            return Token.GreaterThanEqual;
+                        }
+                        else return Token.GreaterThan;
+                    }
+
                     switch (ch)
                     {
                         case ',':
@@ -140,7 +156,6 @@ namespace mbasic
                         case '/':
                         case '+':
                         case '-':
-                        case '>':
                         case '=':
                         case '&':
                         case '^':