Author: manjula
Date: 2005-04-19 23:57:00 -0400 (Tue, 19 Apr 2005)
New Revision: 43309

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/mb-parser.jay
Log:
Support expressions for directives


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-04-20 02:36:19 UTC (rev 43308)
+++ trunk/mcs/mbas/ChangeLog    2005-04-20 03:57:00 UTC (rev 43309)
@@ -1,3 +1,7 @@
+
+2005-04-18 Manjula GHM <[EMAIL PROTECTED]>
+       * mb-parser.jay:
+               Support expressions for Directives
 2005-04-12 Satya Sudha K <[EMAIL PROTECTED]>
        * ecore.cs :
                Fixed conversions from 'object' to double, float, decimal and 
long

Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay        2005-04-20 02:36:19 UTC (rev 43308)
+++ trunk/mcs/mbas/mb-parser.jay        2005-04-20 03:57:00 UTC (rev 43309)
@@ -4778,14 +4778,20 @@
 
 directive_exp 
        : boolean_literal
-       | IDENTIFIER _mark_  //FIXME: Fix for constant expression
+       | constant_expression _mark_  //FIXME: Fix for binary expression
         {
-               if(constPreDir.Contains ((string) ($1))) {
-                       $$ = (BoolLiteral)constPreDir [$1];
-
+               Expression exp = (Expression) $1;
+               if(exp is SimpleName) {
+                       string key = ((SimpleName)exp).Name;    
+                       if(constPreDir.Contains(key)) {
+                               $$ = new BoolLiteral ((bool)constPreDir [key]);
+                       }
                }
                else {
-                               Report.Error (30580, (Location)$2, "value of 
Const used is not set");
+                       object o = ((Constant) exp).GetValue ();
+                       bool temp = Convert.ToBoolean(o);
+                       $$ = new BoolLiteral ((bool)temp);
+                       // Report.Error (30580, (Location)$2, "value of Const 
used is not set");
                    }
         }
        ;       
@@ -4842,11 +4848,17 @@
                        }       
                }
          }
-       | HASH CONST IDENTIFIER ASSIGN boolean_literal _mark_ EOL
+       | HASH CONST IDENTIFIER ASSIGN constant_expression _mark_ EOL
          {
-               if(tokenizerController.IsAcceptingTokens)
                {
-                       constPreDir.Add($3,$5);
+                       Expression express = (Expression) $5;
+                       if (express is Binary) {
+                               // FIXME
+                               // TODO
+                       }       
+                       object o = ((Constant) express).GetValue ();
+                       bool temp = Convert.ToBoolean(o);
+                       constPreDir.Add($3,temp);
                }
          }
        | HASH IF _mark_   

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

Reply via email to