[svn] r6257: nemerle/trunk/ncc/parsing/Lexer.n

nazgul svnadmin at nemerle.org
Fri May 12 18:33:08 CEST 2006


Log:
A trivial refactoring

Author: nazgul
Date: Fri May 12 18:33:06 2006
New Revision: 6257

Modified:
   nemerle/trunk/ncc/parsing/Lexer.n

Modified: nemerle/trunk/ncc/parsing/Lexer.n
==============================================================================
--- nemerle/trunk/ncc/parsing/Lexer.n	(original)
+++ nemerle/trunk/ncc/parsing/Lexer.n	Fri May 12 18:33:06 2006
@@ -1356,27 +1356,27 @@
 
   public static IsOperator (str : string) : bool
   {
-    def len = str.Length;
-    mutable is_op = true;
-    for (mutable i = 0; i < len && is_op; ++i) {
+    def len = str.Length - 1;
+    foreach (i in [0 .. len]) {
       def c = str[i];
-      is_op = IsOperatorChar (c);
-      unless (is_op) 
+      if (IsOperatorChar (c))
+        ()
+      else
         match (c) {
-         | '(' | ')' | ';' | '[' | ']' => is_op = true
-         | _ => ()
+         | '(' | ')' | ';' | '[' | ']' => ()
+         | _ => Nemerle.Imperative.Return (false);
         }
     };
-    is_op
+    true
   }
 
   public static HasKeywordChars (str : string) : bool
   {
-    def len = str.Length;
-    mutable is_kw = true;
-    for (mutable i = 0; i < len && is_kw; ++i)
-      is_kw = Char.IsLetter (str[i]) || str[i] == '_';
-    is_kw
+    def len = str.Length - 1;
+    foreach (i in [0 .. len])
+      unless (Char.IsLetter (str[i]) || str[i] == '_')
+        Nemerle.Imperative.Return (false);
+    true
   }
 } // end class LexerBase
 



More information about the svn mailing list