Author: manjula
Date: 2005-04-18 04:49:03 -0400 (Mon, 18 Apr 2005)
New Revision: 43203

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/mb-parser.jay
Log:
Support Conditional Constant Directives


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-04-18 08:32:55 UTC (rev 43202)
+++ trunk/mcs/mbas/ChangeLog    2005-04-18 08:49:03 UTC (rev 43203)
@@ -1,3 +1,7 @@
+2005-04-18 Manjula GHM <[EMAIL PROTECTED]>
+       * mb-parser.jay:
+               Support Conditional Constant Directives
+
 2005-04-13 Manjula GHM <[EMAIL PROTECTED]>
        * expression.cs : To support  'Or' argument of AttributeTargets in 
AttributeUsage
 2005-04-12 Satya Sudha K <[EMAIL PROTECTED]>

Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay        2005-04-18 08:32:55 UTC (rev 43202)
+++ trunk/mcs/mbas/mb-parser.jay        2005-04-18 08:49:03 UTC (rev 43203)
@@ -245,8 +245,12 @@
                // A stack for With expressions.
                //
                Stack with_stack;
-       
                
+               //      
+               // Hash table for const preprocessing directive
+               //
+               public static Hashtable constPreDir = new Hashtable();
+               
                static public bool InitialOptionExplicit = false;
                static public bool InitialOptionStrict = false;
                static public bool InitialOptionCompareBinary = true;
@@ -272,6 +276,7 @@
                TokenizerController tokenizerController;
                IfElseStateMachine ifElseStateMachine;
 
+
                
                public class IfElseStateMachine {
                        
@@ -4771,6 +4776,21 @@
        | DOUBLE        { $$ = TypeManager.system_double_expr; }
        ;
 
+directive_exp 
+       : boolean_literal
+       | IDENTIFIER _mark_  //FIXME: Fix for constant expression
+        {
+               if(constPreDir.Contains ((string) ($1))) {
+                       $$ = (BoolLiteral)constPreDir [$1];
+
+               }
+               else {
+                               Report.Error (30580, (Location)$2, "value of 
Const used is not set");
+                   }
+        }
+       ;       
+               
+
 pp_directive
        : HASH IDENTIFIER OPEN_PARENS LITERAL_STRING COMMA LITERAL_INTEGER 
CLOSE_PARENS _mark_ EOL
          { 
@@ -4826,8 +4846,7 @@
          {
                if(tokenizerController.IsAcceptingTokens)
                {
-                       //TODO;
-                       //FIXME;
+                       constPreDir.Add($3,$5);
                }
          }
        | HASH IF _mark_   
@@ -4841,8 +4860,10 @@
                        throw new MBASException(ifElseStateMachine.Error, 
(Location)$3, ifElseStateMachine.ErrString);
                }
          }
-          boolean_literal opt_then  EOL 
+         directive_exp opt_then  EOL 
          {
+               //FIXME: Fix for constant expression
+
                HandleConditionalDirective(IfElseStateMachine.Token.IF, 
(BoolLiteral)$5);
          }
        | HASH opt_elseif _mark_ 
@@ -4855,8 +4876,10 @@
                              throw new MBASException(ifElseStateMachine.Error, 
(Location)$3, ifElseStateMachine.ErrString);
                      }
          }
-          boolean_literal opt_then  EOL 
-         { 
+         directive_exp opt_then  EOL 
+         {
+                 //FIXME: Fix for constant expression
+ 
                  HandleConditionalDirective(IfElseStateMachine.Token.ELSEIF, 
(BoolLiteral)$5);
          }
        | HASH ELSE _mark_ 

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

Reply via email to