Author: duncan
Date: 2005-05-11 16:55:56 -0400 (Wed, 11 May 2005)
New Revision: 44411

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/cs-tokenizer.cs
Log:
2005-05-11  Duncan Mak  <[EMAIL PROTECTED]>

        * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
        continuing to process for 'arg'.
        (handle_preprocessing_directive): Check the argument of the #endif
        directive and report error CS1025 if there are any trailing
        characters.

        According to the C# spec, having even whitespace after the #endif
        directive is illegal; however, because we call arg.TrimEnd ()
        beforehand, we have the same behavior as csc, allowing whitespace
        after the directive.

        Fixes #74892.

Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2005-05-11 20:27:00 UTC (rev 44410)
+++ trunk/mcs/mcs/ChangeLog     2005-05-11 20:55:56 UTC (rev 44411)
@@ -1,3 +1,18 @@
+2005-05-11  Duncan Mak  <[EMAIL PROTECTED]>
+
+       * cs-tokenizer.cs (get_cmd_arg): Check that 'c' is not -1 before
+       continuing to process for 'arg'.
+       (handle_preprocessing_directive): Check the argument of the #endif
+       directive and report error CS1025 if there are any trailing
+       characters.
+
+       According to the C# spec, having even whitespace after the #endif
+       directive is illegal; however, because we call arg.TrimEnd ()
+       beforehand, we have the same behavior as csc, allowing whitespace
+       after the directive.
+
+       Fixes #74892.
+
 2005-05-11  Marek Safar  <[EMAIL PROTECTED]>
 
        Fix #74863.

Modified: trunk/mcs/mcs/cs-tokenizer.cs
===================================================================
--- trunk/mcs/mcs/cs-tokenizer.cs       2005-05-11 20:27:00 UTC (rev 44410)
+++ trunk/mcs/mcs/cs-tokenizer.cs       2005-05-11 20:55:56 UTC (rev 44411)
@@ -1196,6 +1196,9 @@
                        } else if (c == '\r'){
                                col = 0;
                                return;
+                       } else if (c == -1){
+                               arg = "";
+                               return;
                        }
                        
                        static_cmd_arg.Length = 0;
@@ -1628,6 +1631,11 @@
                                        else if (!region_directive && ((pop & 
REGION) != 0))
                                                Report.Error (1038, Location, 
"#endregion directive expected");
                                        
+                                       if (!region_directive && arg.Length != 
0) {
+                                               Report.Error (1025, Location, 
+                                                       "Single line comment, 
or end-of-line expected");
+                                       }
+                                       
                                        if (ifstack.Count == 0)
                                                return true;
                                        else {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to