[svn] r6890: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2: CodeModel/ScanLexer.n Tests/Tests...

IT svnadmin at nemerle.org
Wed Nov 15 00:01:16 CET 2006


Log:
Fixed colorizing of comments following an operator.

Author: IT
Date: Wed Nov 15 00:01:13 2006
New Revision: 6890

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
   vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ScanLexer.n	Wed Nov 15 00:01:13 2006
@@ -385,6 +385,8 @@
 
       try
       {
+        def last_col = col;
+
         def tok = base.GetToken();
 
         def (tp, color, trigger) = match (tok)
@@ -394,9 +396,20 @@
         | Identifier
         | IdentifierToComplete      => (TP.Identifier, C.Identifier, TR.None)
         | Comma                     => (TP.Operator,   C.Operator,   TR.ParameterNext)
-        | Operator(n) when n == "." => (TP.Delimiter,  C.Operator,   TR.MemberSelect)
-        | Semicolon
-        | Operator                  => (TP.Operator,   C.Operator,   TR.None)
+        | Semicolon                 => (TP.Operator,   C.Operator,   TR.None)
+        | Operator(nm)              =>
+
+          // This fixes the eating comment following the operator ( :/* */ ).
+          //
+          when (nm.Length  < col - last_col)
+          {
+            col = last_col + nm.Length;
+            pos = col - 1;
+          }
+
+          if (nm == ".") (TP.Delimiter, C.Operator, TR.MemberSelect)
+          else           (TP.Operator,  C.Operator, TR.None)
+
         //| StringLiteral             => (TP.String,     C.String,     TR.None)
         | CharLiteral               => (TP.Literal,    C.String,     TR.None)
         | IntegerLiteral

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Tests.n	Wed Nov 15 00:01:13 2006
@@ -505,7 +505,6 @@
 
       Assert.IsNotNull(result, "result is null");
       WriteLine(result.Text);
-      Assert.AreEqual (result.Text.Split('\n')[0], "internal sealed variant TestVariant2.CValue");
     }
   }
 }



More information about the svn mailing list