@@ -12,10 +12,10 @@ A *class_declaration* is a *type_declaration* ([§13.7](namespaces.md#137-type-d
12
12
13
13
``` ANTLR
14
14
class_declaration
15
- : attributes? class_modifier* 'partial'? 'class' identifier
16
- type_parameter_list? class_base? type_parameter_constraints_clause*
17
- class_body ';'?
18
- ;
15
+ : attributes? class_modifier* 'partial'? 'class' identifier
16
+ type_parameter_list? class_base? type_parameter_constraints_clause*
17
+ class_body ';'?
18
+ ;
19
19
```
20
20
21
21
A * class_declaration* consists of an optional set of * attributes* ([ §21] ( attributes.md#21-attributes ) ), followed by an optional set of * class_modifier* s ([ §14.2.2] ( classes.md#1422-class-modifiers ) ), followed by an optional ` partial ` modifier ([ §14.2.7] ( classes.md#1427-partial-declarations ) ), followed by the keyword ` class ` and an * identifier* that names the class, followed by an optional * type_parameter_list* ([ §14.2.3] ( classes.md#1423-type-parameters ) ), followed by an optional * class_base* specification ([ §14.2.4] ( classes.md#1424-class-base-specification ) ), followed by an optional set of * type_parameter_constraints_clause* s ([ §14.2.5] ( classes.md#1425-type-parameter-constraints ) ), followed by a * class_body* ([ §14.2.6] ( classes.md#1426-class-body ) ), optionally followed by a semicolon.
@@ -147,13 +147,13 @@ A type parameter is a simple identifier that denotes a placeholder for a type ar
147
147
148
148
```ANTLR
149
149
type_parameter_list
150
- : '<' type_parameters '>'
150
+ : '<' type_parameters '>'
151
151
;
152
152
153
153
type_parameters
154
- : attributes ? type_parameter
155
- | type_parameters ',' attributes ? type_parameter
156
- ;
154
+ : attributes ? type_parameter
155
+ | type_parameters ',' attributes ? type_parameter
156
+ ;
157
157
```
158
158
159
159
* type_parameter* is defined in [ §8.5] ( types.md#85-type-parameters ) .
@@ -170,14 +170,14 @@ A class declaration may include a *class_base* specification, which defines the
170
170
171
171
``` ANTLR
172
172
class_base
173
- : ':' class_type
174
- | ':' interface_type_list
175
- | ':' class_type ',' interface_type_list
176
- ;
173
+ : ':' class_type
174
+ | ':' interface_type_list
175
+ | ':' class_type ',' interface_type_list
176
+ ;
177
177
178
178
interface_type_list
179
- : interface_type (',' interface_type)*
180
- ;
179
+ : interface_type (',' interface_type)*
180
+ ;
181
181
```
182
182
183
183
#### 14.2.4.2 Base classes
@@ -638,8 +638,8 @@ The *class_body* of a class defines the members of that class.
638
638
639
639
```ANTLR
640
640
class_body
641
- : '{' class_member_declaration* '}'
642
- ;
641
+ : '{' class_member_declaration* '}'
642
+ ;
643
643
```
644
644
645
645
### 14.2.7 Partial declarations
@@ -3065,9 +3065,9 @@ The *accessor_declarations* of a property specify the executable statements asso
3065
3065
3066
3066
``` ANTLR
3067
3067
accessor_declarations
3068
- : get_accessor_declaration set_accessor_declaration?
3069
- | set_accessor_declaration get_accessor_declaration?
3070
- ;
3068
+ : get_accessor_declaration set_accessor_declaration?
3069
+ | set_accessor_declaration get_accessor_declaration?
3070
+ ;
3071
3071
3072
3072
get_accessor_declaration
3073
3073
: attributes? accessor_modifier? 'get' accessor_body
@@ -3620,38 +3620,38 @@ Events are declared using *event_declaration*s:
3620
3620
3621
3621
```ANTLR
3622
3622
event_declaration
3623
- : attributes ? event_modifier * 'event' type variable_declarators ';'
3624
- | attributes ? event_modifier * 'event' type member_name
3625
- '{' event_accessor_declarations '}'
3626
- ;
3623
+ : attributes ? event_modifier * 'event' type variable_declarators ';'
3624
+ | attributes ? event_modifier * 'event' type member_name
3625
+ '{' event_accessor_declarations '}'
3626
+ ;
3627
3627
3628
3628
event_modifier
3629
- : 'new'
3630
- | 'public'
3631
- | 'protected'
3632
- | 'internal'
3633
- | 'private'
3634
- | 'static'
3635
- | 'virtual'
3636
- | 'sealed'
3637
- | 'override'
3638
- | 'abstract'
3639
- | 'extern'
3640
- | unsafe_modifier // unsafe code support
3641
- ;
3629
+ : 'new'
3630
+ | 'public'
3631
+ | 'protected'
3632
+ | 'internal'
3633
+ | 'private'
3634
+ | 'static'
3635
+ | 'virtual'
3636
+ | 'sealed'
3637
+ | 'override'
3638
+ | 'abstract'
3639
+ | 'extern'
3640
+ | unsafe_modifier // unsafe code support
3641
+ ;
3642
3642
3643
3643
event_accessor_declarations
3644
- : add_accessor_declaration remove_accessor_declaration
3645
- | remove_accessor_declaration add_accessor_declaration
3646
- ;
3644
+ : add_accessor_declaration remove_accessor_declaration
3645
+ | remove_accessor_declaration add_accessor_declaration
3646
+ ;
3647
3647
3648
3648
add_accessor_declaration
3649
- : attributes ? 'add' block
3650
- ;
3649
+ : attributes ? 'add' block
3650
+ ;
3651
3651
3652
3652
remove_accessor_declaration
3653
- : attributes ? 'remove' block
3654
- ;
3653
+ : attributes ? 'remove' block
3654
+ ;
3655
3655
```
3656
3656
3657
3657
* unsafe_modifier* ([ §22.2] ( unsafe-code.md#222-unsafe-contexts ) ) is only available in unsafe code ([ §22] ( unsafe-code.md#22-unsafe-code ) ).
@@ -3899,23 +3899,23 @@ indexer_declaration
3899
3899
;
3900
3900
3901
3901
indexer_modifier
3902
- : 'new'
3903
- | 'public'
3904
- | 'protected'
3905
- | 'internal'
3906
- | 'private'
3907
- | 'virtual'
3908
- | 'sealed'
3909
- | 'override'
3910
- | 'abstract'
3911
- | 'extern'
3912
- | unsafe_modifier // unsafe code support
3913
- ;
3902
+ : 'new'
3903
+ | 'public'
3904
+ | 'protected'
3905
+ | 'internal'
3906
+ | 'private'
3907
+ | 'virtual'
3908
+ | 'sealed'
3909
+ | 'override'
3910
+ | 'abstract'
3911
+ | 'extern'
3912
+ | unsafe_modifier // unsafe code support
3913
+ ;
3914
3914
3915
3915
indexer_declarator
3916
- : type 'this' '[' formal_parameter_list ']'
3917
- | type interface_type '.' 'this' '[' formal_parameter_list ']'
3918
- ;
3916
+ : type 'this' '[' formal_parameter_list ']'
3917
+ | type interface_type '.' 'this' '[' formal_parameter_list ']'
3918
+ ;
3919
3919
3920
3920
indexer_body
3921
3921
: '{' accessor_declarations '}'
@@ -4115,51 +4115,50 @@ An ***operator*** is a member that defines the meaning of an expression operator
4115
4115
4116
4116
```ANTLR
4117
4117
operator_declaration
4118
- : attributes ? operator_modifier + operator_declarator operator_body
4119
- ;
4118
+ : attributes ? operator_modifier + operator_declarator operator_body
4119
+ ;
4120
4120
4121
4121
operator_modifier
4122
- : 'public'
4123
- | 'static'
4124
- | 'extern'
4125
- | unsafe_modifier // unsafe code support
4126
- ;
4122
+ : 'public'
4123
+ | 'static'
4124
+ | 'extern'
4125
+ | unsafe_modifier // unsafe code support
4126
+ ;
4127
4127
4128
4128
operator_declarator
4129
- : unary_operator_declarator
4130
- | binary_operator_declarator
4131
- | conversion_operator_declarator
4132
- ;
4129
+ : unary_operator_declarator
4130
+ | binary_operator_declarator
4131
+ | conversion_operator_declarator
4132
+ ;
4133
4133
4134
4134
unary_operator_declarator
4135
- : type 'operator' overloadable_unary_operator '(' fixed_parameter ')'
4136
- ;
4135
+ : type 'operator' overloadable_unary_operator '(' fixed_parameter ')'
4136
+ ;
4137
4137
4138
4138
overloadable_unary_operator
4139
- : '+' | '-' | '!' | '~' | '++' | '--' | 'true' | 'false'
4140
- ;
4139
+ : '+' | '-' | '!' | '~' | '++' | '--' | 'true' | 'false'
4140
+ ;
4141
4141
4142
4142
binary_operator_declarator
4143
- : type 'operator' overloadable_binary_operator
4144
- '(' fixed_parameter ',' fixed_parameter ')'
4145
- ;
4143
+ : type 'operator' overloadable_binary_operator
4144
+ '(' fixed_parameter ',' fixed_parameter ')'
4145
+ ;
4146
4146
4147
4147
overloadable_binary_operator
4148
- : '+' | '-' | '*' | '/' | '%' | '&' | '|' | '^' | '<<'
4149
- | right_shift | '==' | '!=' | '>' | '<' | '>=' | '<='
4150
- ;
4148
+ : '+' | '-' | '*' | '/' | '%' | '&' | '|' | '^' | '<<'
4149
+ | right_shift | '==' | '!=' | '>' | '<' | '>=' | '<='
4150
+ ;
4151
4151
4152
4152
conversion_operator_declarator
4153
- : 'implicit' 'operator' type '(' fixed_parameter ')'
4154
- | 'explicit' 'operator' type '(' fixed_parameter ')'
4155
- ;
4153
+ : 'implicit' 'operator' type '(' fixed_parameter ')'
4154
+ | 'explicit' 'operator' type '(' fixed_parameter ')'
4155
+ ;
4156
4156
4157
4157
operator_body
4158
- : block
4159
- | '=>' expression ';'
4160
- | ';'
4161
- ;
4162
-
4158
+ : block
4159
+ | '=>' expression ';'
4160
+ | ';'
4161
+ ;
4163
4162
```
4164
4163
4165
4164
* unsafe_modifier* ([ §22.2] ( unsafe-code.md#222-unsafe-contexts ) ) is only available in unsafe code ([ §22] ( unsafe-code.md#22-unsafe-code ) ).
@@ -4384,31 +4383,31 @@ An ***instance constructor*** is a member that implements the actions required t
4384
4383
4385
4384
```ANTLR
4386
4385
constructor_declaration
4387
- : attributes ? constructor_modifier * constructor_declarator constructor_body
4388
- ;
4386
+ : attributes ? constructor_modifier * constructor_declarator constructor_body
4387
+ ;
4389
4388
4390
4389
constructor_modifier
4391
- : 'public'
4392
- | 'protected'
4393
- | 'internal'
4394
- | 'private'
4395
- | 'extern'
4396
- | unsafe_modifier // unsafe code support
4397
- ;
4390
+ : 'public'
4391
+ | 'protected'
4392
+ | 'internal'
4393
+ | 'private'
4394
+ | 'extern'
4395
+ | unsafe_modifier // unsafe code support
4396
+ ;
4398
4397
4399
4398
constructor_declarator
4400
- : identifier '(' formal_parameter_list ? ')' constructor_initializer ?
4401
- ;
4399
+ : identifier '(' formal_parameter_list ? ')' constructor_initializer ?
4400
+ ;
4402
4401
4403
4402
constructor_initializer
4404
- : ':' 'base' '(' argument_list ? ')'
4405
- | ':' 'this' '(' argument_list ? ')'
4406
- ;
4403
+ : ':' 'base' '(' argument_list ? ')'
4404
+ | ':' 'this' '(' argument_list ? ')'
4405
+ ;
4407
4406
4408
4407
constructor_body
4409
- : block
4410
- | ';'
4411
- ;
4408
+ : block
4409
+ | ';'
4410
+ ;
4412
4411
```
4413
4412
4414
4413
* unsafe_modifier* ([ §22.2] ( unsafe-code.md#222-unsafe-contexts ) ) is only available in unsafe code ([ §22] ( unsafe-code.md#22-unsafe-code ) ).
@@ -4653,24 +4652,24 @@ A ***static constructor*** is a member that implements the actions required to i
4653
4652
4654
4653
```ANTLR
4655
4654
static_constructor_declaration
4656
- : attributes ? static_constructor_modifiers identifier '(' ')'
4657
- static_constructor_body
4658
- ;
4655
+ : attributes ? static_constructor_modifiers identifier '(' ')'
4656
+ static_constructor_body
4657
+ ;
4659
4658
4660
4659
static_constructor_modifiers
4661
- : 'static'
4662
- | 'static' 'extern' unsafe_modifier ?
4663
- | 'static' unsafe_modifier 'extern' ?
4664
- | 'extern' 'static' unsafe_modifier ?
4665
- | 'extern' unsafe_modifier 'static'
4666
- | unsafe_modifier 'static' 'extern' ?
4667
- | unsafe_modifier 'extern' 'static'
4668
- ;
4660
+ : 'static'
4661
+ | 'static' 'extern' unsafe_modifier ?
4662
+ | 'static' unsafe_modifier 'extern' ?
4663
+ | 'extern' 'static' unsafe_modifier ?
4664
+ | 'extern' unsafe_modifier 'static'
4665
+ | unsafe_modifier 'static' 'extern' ?
4666
+ | unsafe_modifier 'extern' 'static'
4667
+ ;
4669
4668
4670
4669
static_constructor_body
4671
- : block
4672
- | ';'
4673
- ;
4670
+ : block
4671
+ | ';'
4672
+ ;
4674
4673
```
4675
4674
4676
4675
* unsafe_modifier* ([ §22.2] ( unsafe-code.md#222-unsafe-contexts ) ) is only available in unsafe code ([ §22] ( unsafe-code.md#22-unsafe-code ) ).
0 commit comments