2002-05-13 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Mon, 13 May 2002 17:17:46 +0000 (17:17 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Mon, 13 May 2002 17:17:46 +0000 (17:17 -0000)
* cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
(pp_expr): do not abort on unknown input, just return.
(eval): abort if there are pending chars.

svn path=/trunk/mcs/; revision=4598

mcs/mcs/ChangeLog
mcs/mcs/cs-tokenizer.cs

index 4e503578ddaaf68abad1a190492d47b9de0676a2..fe7e2faf16297ef26ddfcb28c6b65aa29cc4b740 100755 (executable)
@@ -1,5 +1,9 @@
 2002-05-13  Miguel de Icaza  <miguel@ximian.com>
 
+       * cs-tokenizer.cs: (pp_primary): Eat the ')' at the end.
+       (pp_expr): do not abort on unknown input, just return.
+       (eval): abort if there are pending chars.
+
        * attribute.cs (Attribute.Resolve): Positional parameters are
        optional.  Deal with that case.
 
index 017485d530e6722ab5886028749439db56fc39c0..6adc9209f844102b19c40fc38b92c93e038fbfb9 100755 (executable)
@@ -997,8 +997,10 @@ namespace Mono.CSharp
                                if (c == '('){\r
                                        s = s.Substring (1);\r
                                        bool val = pp_expr (ref s);\r
-                                       if (s.Length > 0 && s [0] == ')')\r
+                                       if (s.Length > 0 && s [0] == ')'){\r
+                                               s = s.Substring (1);\r
                                                return val;\r
+                                       }\r
                                        Error_InvalidDirective ();\r
                                        return false;\r
                                }\r
@@ -1104,7 +1106,9 @@ namespace Mono.CSharp
                        s = s.Trim ();\r
                        int len = s.Length;\r
                        if (len > 0){\r
-                               if (s [0] == '|'){\r
+                               char c = s [0];\r
+                               \r
+                               if (c == '|'){\r
                                        if (len > 2 && s [1] == '|'){\r
                                                s = s.Substring (2);\r
                                                return va || pp_and (ref s);\r
@@ -1112,10 +1116,7 @@ namespace Mono.CSharp
                                                Error_InvalidDirective ();\r
                                                return false;\r
                                        }\r
-                               } else {\r
-                                       Error_InvalidDirective ();\r
-                                       return false;\r
-                               }\r
+                               } \r
                        }\r
 \r
                        return va;\r
@@ -1124,6 +1125,11 @@ namespace Mono.CSharp
                bool eval (string s)\r
                {\r
                        bool v = pp_expr (ref s);\r
+                       s = s.Trim ();\r
+                       if (s.Length != 0){\r
+                               Error_InvalidDirective ();\r
+                               return false;\r
+                       }\r
 \r
                        return v;\r
                }\r