[svn] r6541: nemerle/trunk/ncc: CompilationOptions.n parsing/Lexer.n testsuite/positive/pragma.n testsuite...

nazgul svnadmin at nemerle.org
Thu Aug 17 00:25:43 CEST 2006


Log:
Handle comments after preprocessor directives

Author: nazgul
Date: Thu Aug 17 00:25:39 2006
New Revision: 6541

Modified:
   nemerle/trunk/ncc/CompilationOptions.n
   nemerle/trunk/ncc/parsing/Lexer.n
   nemerle/trunk/ncc/testsuite/positive/pragma.n
   nemerle/trunk/ncc/testsuite/positive/preprocessor.n

Modified: nemerle/trunk/ncc/CompilationOptions.n
==============================================================================
--- nemerle/trunk/ncc/CompilationOptions.n	(original)
+++ nemerle/trunk/ncc/CompilationOptions.n	Thu Aug 17 00:25:39 2006
@@ -723,7 +723,7 @@
     
     levels : array [array [int]] = array [
       array [], // level 0
-      array [183, 184, 602, 626, 1633, 5000], // level 1
+      array [183, 184, 602, 626, 1633, 1696, 5000], // level 1
 
       // level 2
       array [108, 114, 162, 251, 252, 253, 618], 

Modified: nemerle/trunk/ncc/parsing/Lexer.n
==============================================================================
--- nemerle/trunk/ncc/parsing/Lexer.n	(original)
+++ nemerle/trunk/ncc/parsing/Lexer.n	Thu Aug 17 00:25:39 2006
@@ -1070,8 +1070,17 @@
     mutable c = ' ';
     def line = StringBuilder (80);
     while (c != '\n') {
+      if (c == '/') {
+        c = read_or_eol ();
+        unless (c == '/')
+          Message.Warning (1696, "Single-line comment or end-of-line expected");
+        while (c != '\n') 
+          c = read_or_eol ();
+      }
+      else {
       ignore (line.Append (c));
       c = read_or_eol ();
+      }
     };
     line.ToString ()
   }

Modified: nemerle/trunk/ncc/testsuite/positive/pragma.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/pragma.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/pragma.n	Thu Aug 17 00:25:39 2006
@@ -14,7 +14,7 @@
     _ = "foo" :> string;
   }
 }
-#pragma warning restore 10001
+#pragma warning restore 10001  // comment
 
 
 class M3 {

Modified: nemerle/trunk/ncc/testsuite/positive/preprocessor.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/preprocessor.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/preprocessor.n	Thu Aug 17 00:25:39 2006
@@ -10,7 +10,7 @@
 
 #if true && (false || !(true && !(false)) && false)
   class D
-#elif false || test
+#elif false || test  // comment
   class A { b : int; }
 #else
   class H
@@ -24,7 +24,7 @@
 
  # line 666  
 
-#region mogdule G
+#region mogdule G   // ddd
 public module G {
 
 }



More information about the svn mailing list