: logical_end_of_line
opt_option_directives
opt_imports_directives
- opt_global_attributes
+ opt_attributes
opt_declarations
EOF
{
| OPEN_PARENS CLOSE_PARENS { $$ = Parameters.EmptyReadOnlyParameters; }
| OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS { $$ = $2; }
;
-
-opt_global_attributes
+
+opt_attributes
: /* empty */
- | global_attribute_sections { $$ = $1; }
+ | attribute_sections { $$ = $1; }
;
-global_attribute_sections
- : global_attribute_section
+attribute_sections
+ : attribute_section
{
AttributeSection sect = (AttributeSection) $1;
otherwise an exception should be thrown since VB.NET
only allows one attribute section
*/
- | global_attribute_section global_attribute_sections
+ | attribute_sections attribute_section
{
Attributes attrs = null;
AttributeSection sect = (AttributeSection) $2;
$$ = attrs;
}
;
-
-attribute_begin
- : OP_LT
- ;
-
-attribute_end
- : OP_GT
- ;
-
-global_attribute_begin
- : OP_LT attribute_target_specifier
- {
- $$ = $2;
- }
-
-global_attribute_section
- : global_attribute_begin attribute_list attribute_end
+
+attribute_section
+ : OP_LT attribute_target_specifier attribute_list OP_GT
{
string target = null;
- if ($1 != null)
- target = (string) $1;
+ if ($2 != null)
+ target = (string) $2;
$$ = new AttributeSection (target, (ArrayList) $3);
}
+ | OP_LT attribute_list OP_GT
+ {
+ $$ = new AttributeSection (null, (ArrayList) $2);
+ }
;
attribute_target_specifier
CheckAttributeTarget ((string) $1);
$$ = $1;
}
+ | EVENT { $$ = "event"; }
+ | RETURN { $$ = "return"; }
;
-
-
-opt_attributes
- : /* empty */
- | attribute_sections { $$ = $1; }
- ;
-
-attribute_sections
- : attribute_section
- {
- AttributeSection sect = (AttributeSection) $1;
-
- if (sect.Target == "assembly")
- RootContext.AddGlobalAttributeSection (current_container, sect);
-
- $$ = new Attributes ((AttributeSection) $1, lexer.Location);
-
- }
- /*
- FIXME: we should check if extended syntax is enabled;
- otherwise an exception should be thrown since VB.NET
- only allows one attribute section
- */
- | attribute_sections attribute_section
- {
- Attributes attrs = null;
- AttributeSection sect = (AttributeSection) $2;
-
- if (sect.Target == "assembly")
- RootContext.AddGlobalAttributeSection (current_container, sect);
-
- if ($1 != null) {
- attrs = (Attributes) $1;
- attrs.AddAttributeSection (sect);
- }
-
- $$ = attrs;
- }
- ;
-
-attribute_section
- : attribute_begin attribute_list attribute_end
- {
- $$ = new AttributeSection (null, (ArrayList) $2);
- }
- ;
-
attribute_list
: attribute
{
switch (a) {
- case "assembly" :
- case "module" :
+ case "assembly" : case "field" : case "method" : case "param" : case "property" : case "type" :
return;
default :