diff options
author | Anirban Bhattacharjee <anirban@mono-cvs.ximian.com> | 2004-06-03 08:54:28 +0400 |
---|---|---|
committer | Anirban Bhattacharjee <anirban@mono-cvs.ximian.com> | 2004-06-03 08:54:28 +0400 |
commit | 0361e88e464b97a97588ac98d0c9310c0c4d24cb (patch) | |
tree | a4df84edaf171d4ee57229a54334e97f55b0da95 | |
parent | b03dd37b8ffda880aacca5f494c2b2a22147d3cc (diff) |
mb-parser.jay: Improved event declaration grammar
svn path=/trunk/mcs/; revision=28736
-rw-r--r-- | mcs/mbas/ChangeLog | 3 | ||||
-rw-r--r-- | mcs/mbas/mb-parser.jay | 45 |
2 files changed, 37 insertions, 11 deletions
diff --git a/mcs/mbas/ChangeLog b/mcs/mbas/ChangeLog index 94b3f1ceed0..74aa83e4f43 100644 --- a/mcs/mbas/ChangeLog +++ b/mcs/mbas/ChangeLog @@ -1,3 +1,6 @@ +2004-06-01 Anirban Bhattacharjee <banirban@novell.com> + * mb-parser.jay: Improved event declaration grammar + 2004/05/31 Rafael Teixeira <rafaelteixeirabr@hotmail.com> * AssemblyInfo.cs : Anirban is and author too diff --git a/mcs/mbas/mb-parser.jay b/mcs/mbas/mb-parser.jay index 4693a0e2cd5..5081797ba44 100644 --- a/mcs/mbas/mb-parser.jay +++ b/mcs/mbas/mb-parser.jay @@ -1241,12 +1241,34 @@ event_declaration CheckDef (current_container.AddEvent (e), e.Name, e.Location); } -// | EVENT identifier OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS EOL -// { -// throw new NotSupportedException(); -// } - ; + | EVENT identifier opt_event_params EOL + { + string delName = (string) $2; + delName = delName + "EventHandler"; + Console.WriteLine(delName); + Mono.MonoBASIC.Delegate del = new Mono.MonoBASIC.Delegate + (current_container, TypeManager.system_void_expr, + (int) current_modifiers, MakeName(delName), (Parameters) $3, + (Attributes) current_attributes, lexer.Location); + + del.Namespace = current_namespace; + CheckDef (current_container.AddDelegate (del), del.Name, lexer.Location); + + Event e = new Event (DecomposeQI (delName, lexer.Location), + (string) $2, + null, current_modifiers, null, null, + current_attributes, lexer.Location); + CheckDef (current_container.AddEvent (e), e.Name, e.Location); + } + ; + +opt_event_params + : /* empty */ { $$ = Parameters.EmptyReadOnlyParameters; } + | OPEN_PARENS CLOSE_PARENS { $$ = Parameters.EmptyReadOnlyParameters; } + | OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS { $$ = $2; } + ; + enum_declaration : ENUM identifier opt_type_spec EOL opt_enum_member_declarations @@ -1793,9 +1815,10 @@ delegate_declaration if (implicit_modifiers && ((current_modifiers & Modifiers.STATIC) != 0)) current_modifiers = (current_modifiers & ~Modifiers.STATIC); - Mono.MonoBASIC.Delegate del = new Mono.MonoBASIC.Delegate (current_container, TypeManager.system_void_expr, + Mono.MonoBASIC.Delegate del = new Mono.MonoBASIC.Delegate (current_container, + TypeManager.system_void_expr, (int) current_modifiers, - MakeName ((string) $3), (Parameters) $5, + MakeName ((string) $3), (Parameters) $5, (Attributes) current_attributes, l); del.Namespace = current_namespace; @@ -3722,14 +3745,14 @@ assignment_expression { $$ = new Assign ((Expression) $1, (Expression) $3, lexer.Location); } -/* | prefixed_unary_expression ASSIGN ADDRESSOF argument_list + | prefixed_unary_expression ASSIGN ADDRESSOF expression { // fixme: this is not working // d = AddressOf F // type of d has to get resolved somewhere - $$ = new New ((Expression) $1, (ArrayList) $4, lexer.Location); - $$ = new Assign ((Expression) $1, (Expression) n, lexer.Location); - }*/ + //$$ = new New ((Expression) $1, (ArrayList) $4, lexer.Location); + $$ = new Assign ((Expression) $1, (Expression) $4, lexer.Location); + } | prefixed_unary_expression OP_MULT_ASSIGN expression { Location l = lexer.Location; |