* mb-parser.jay: Changed Delegate instantiation grammar to get it working
authorAnirban Bhattacharjee <anirban@mono-cvs.ximian.com>
Thu, 27 May 2004 10:48:04 +0000 (10:48 -0000)
committerAnirban Bhattacharjee <anirban@mono-cvs.ximian.com>
Thu, 27 May 2004 10:48:04 +0000 (10:48 -0000)
svn path=/trunk/mcs/; revision=28247

mcs/mbas/ChangeLog
mcs/mbas/mb-parser.jay

index ba46168ed707acd0e5998018c43d992a82e629a0..87e604069f2d427233353cd728be0166d846b8bb 100644 (file)
@@ -1,3 +1,6 @@
+2004-05-27 Anirban Bhattacharjee <banirban@novell.com>
+       * mb-parser.jay: Changed Delegate instantiation grammar to get it working
+
 2004-05-26 Anirban Bhattacharjee <banirban@novell.com>
        * mb-parser.jay:
        * class.cs:
index 48d85ed67f3de4e904bf8b9aa98f8c3859f5d548..a1912e50237231305a967fcc1de6469565f4cf86 100644 (file)
@@ -2859,9 +2859,20 @@ array_creation_expression
          }
        ;       
 
+delegate_creation_expression
+       : NEW type OPEN_PARENS ADDRESSOF opt_argument_list CLOSE_PARENS
+         {
+               New n = new New ((Expression) $2, (ArrayList) $5, lexer.Location);
+               if (n==null)
+                       Console.WriteLine("empty");
+               $$ = n;
+         }
+       ;
+
 new_expression
        : object_creation_expression
        | array_creation_expression
+       | delegate_creation_expression
        ;
 
 declaration_statement
@@ -2873,7 +2884,6 @@ declaration_statement
                        $$ = declare_local_variables ((Expression) de.Key, (ArrayList) de.Value, lexer.Location);
                }
          }
-
        | local_constant_declaration 
          {
                if ($1 != null){
@@ -3141,7 +3151,12 @@ opt_type_decl
                New n = new New ((Expression)$3, (ArrayList) $5, lexer.Location);
                $$ = (Expression) n;
          }
-       ;
+       | AS NEW type OPEN_PARENS ADDRESSOF opt_argument_list CLOSE_PARENS 
+         {
+               New n = new New ((Expression)$3, (ArrayList) $6, lexer.Location);
+               $$ = (Expression) n;
+         }
+       ;
                
 opt_array_name_modifier
        : /* empty */                           { $$ = null; }
@@ -3551,12 +3566,6 @@ prefixed_unary_expression
          {
                $$ = new Unary (Unary.Operator.UnaryNegation, (Expression) $2, lexer.Location);
          }
-       | ADDRESSOF prefixed_unary_expression
-         {
-               // FIXME: We should generate an error if AddressOf is NOT used
-               // during delegate creation
-               $$ = $2;
-         }       
        ;
 
 multiplicative_expression
@@ -3706,6 +3715,15 @@ assignment_expression
          { 
                $$ = new Assign ((Expression) $1, (Expression) $3, lexer.Location);
          }
+       /*| prefixed_unary_expression ASSIGN ADDRESSOF argument_list
+         { 
+                       // fixme: this is not working
+                       // d = AddressOf F
+                       // type of d has to  get resolved somewhere
+                       Console.WriteLine("right");
+                       New n = new New ((Expression) $1, (ArrayList) $4, lexer.Location);
+                       $$ = new Assign ((Expression) $1, (Expression) n, lexer.Location);
+         }*/
        | prefixed_unary_expression OP_MULT_ASSIGN expression
          {
                Location l = lexer.Location;