Skip to content

Commit

Permalink
Fix Word converter warnings
Browse files Browse the repository at this point in the history
These are almost all just line breaks in either grammar or C# code
  • Loading branch information
jskeet committed Sep 22, 2023
1 parent c3028bc commit e4196e8
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 39 deletions.
10 changes: 6 additions & 4 deletions standard/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,8 @@ A ***method*** is a member that implements a computation or action that can be p
```ANTLR
method_declaration
: attributes? method_modifiers return_type method_header method_body
| attributes? ref_method_modifiers ref_kind ref_return_type method_header ref_method_body
| attributes? ref_method_modifiers ref_kind ref_return_type method_header
ref_method_body
;
method_modifiers
Expand All @@ -1924,7 +1925,8 @@ ref_method_modifiers
method_header
: member_name '(' formal_parameter_list? ')'
| member_name type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause*
| member_name type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause*
;
method_modifier
Expand Down Expand Up @@ -3281,8 +3283,8 @@ A get accessor for a ref-valued property corresponds to a parameterless method w
> {
> field = 10;
> Console.WriteLine(Property); // Prints 10
> Property = 20; // This invokes the getter, then assigns via the
> // resulting variable reference
> Property = 20; // This invokes the getter, then assigns
> // via the resulting variable reference
> Console.WriteLine(field); // Prints 20
> }
> }
Expand Down
6 changes: 4 additions & 2 deletions standard/delegates.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ A *delegate_declaration* is a *type_declaration* ([§14.7](namespaces.md#147-typ
```ANTLR
delegate_declaration
: attributes? delegate_modifier* 'delegate' return_type delegate_header
| attributes? delegate_modifier* 'delegate' ref_kind ref_return_type delegate_header
| attributes? delegate_modifier* 'delegate' ref_kind ref_return_type
delegate_header
;
delegate_header
: identifier '(' formal_parameter_list? ')' ';'
| identifier variant_type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause* ';'
| identifier variant_type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause* ';'
;
delegate_modifier
Expand Down
8 changes: 5 additions & 3 deletions standard/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3129,7 +3129,8 @@ The safe context rules for a stack allocation expression are described in [§16.
```ANTLR
stackalloc_expression
: 'stackalloc' unmanaged_type '[' expression ']'
| 'stackalloc' unmanaged_type? '[' constant_expression? ']' stackalloc_initializer
| 'stackalloc' unmanaged_type? '[' constant_expression? ']'
stackalloc_initializer
;
stackalloc_initializer
Expand All @@ -3149,7 +3150,7 @@ stackalloc_element_initializer
A *stackalloc_expression* is only permitted in two contexts:

1. The initializing *expression*, `E`, of a *local_variable_declaration* ([§13.6.2](statements.md#1362-local-variable-declarations)); and
2. The right operand *expression*, `E`, of a simple assignment ([$12.21.2](expressions.md#12212-simple-assignment)) which itself occurs as a *expression_statement* ([§13.7](statements.md#137-expression-statements))
2. The right operand *expression*, `E`, of a simple assignment ([§12.21.2](expressions.md#12212-simple-assignment)) which itself occurs as a *expression_statement* ([§13.7](statements.md#137-expression-statements))

In both contexts the *stackalloc_expression* is only permitted to occur as:

Expand Down Expand Up @@ -4792,7 +4793,8 @@ The `?:` operator is called the conditional operator. It is at times also calle
conditional_expression
: null_coalescing_expression
| null_coalescing_expression '?' expression ':' expression
| null_coalescing_expression '?' 'ref' variable_reference ':' 'ref' variable_reference
| null_coalescing_expression '?' 'ref' variable_reference ':'
'ref' variable_reference
;
```
Expand Down
33 changes: 22 additions & 11 deletions standard/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,8 @@ default_literal
// Source: §12.8.21 Stack allocation
stackalloc_expression
: 'stackalloc' unmanaged_type '[' expression ']'
| 'stackalloc' unmanaged_type? '[' constant_expression? ']' stackalloc_initializer
| 'stackalloc' unmanaged_type? '[' constant_expression? ']'
stackalloc_initializer
;
stackalloc_initializer
Expand Down Expand Up @@ -1299,7 +1300,8 @@ local_variable_type
conditional_expression
: null_coalescing_expression
| null_coalescing_expression '?' expression ':' expression
| null_coalescing_expression '?' 'ref' variable_reference ':' 'ref' variable_reference
| null_coalescing_expression '?' 'ref' variable_reference ':'
'ref' variable_reference
;
// Source: §12.19.1 General
Expand Down Expand Up @@ -1542,7 +1544,8 @@ explicitly_typed_local_variable_declaration
;
explicitly_typed_local_variable_declarators
: explicitly_typed_local_variable_declarator (',' explicitly_typed_local_variable_declarator)*
: explicitly_typed_local_variable_declarator
(',' explicitly_typed_local_variable_declarator)*
;
explicitly_typed_local_variable_declarator
Expand Down Expand Up @@ -1582,13 +1585,16 @@ constant_declarator
// Source: §13.6.4 Local function declarations
local_function_declaration
: local_function_modifier* return_type local_function_header local_function_body
| ref_local_function_modifier* ref_kind ref_return_type local_function_header ref_local_function_body
: local_function_modifier* return_type local_function_header
local_function_body
| ref_local_function_modifier* ref_kind ref_return_type
local_function_header ref_local_function_body
;
local_function_header
: identifier '(' formal_parameter_list? ')'
| identifier type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause*
| identifier type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause*
;
local_function_modifier
Expand Down Expand Up @@ -2017,7 +2023,8 @@ variable_declarator
// Source: §15.6.1 General
method_declaration
: attributes? method_modifiers return_type method_header method_body
| attributes? ref_method_modifiers ref_kind ref_return_type method_header ref_method_body
| attributes? ref_method_modifiers ref_kind ref_return_type method_header
ref_method_body
;
method_modifiers
Expand All @@ -2035,7 +2042,8 @@ ref_method_modifiers
method_header
: member_name '(' formal_parameter_list? ')'
| member_name type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause*
| member_name type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause*
;
method_modifier
Expand Down Expand Up @@ -2496,7 +2504,8 @@ interface_method_declaration
interface_method_header
: identifier '(' formal_parameter_list? ')' ';'
| identifier type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause* ';'
| identifier type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause* ';'
;
// Source: §18.4.3 Interface properties
Expand Down Expand Up @@ -2570,12 +2579,14 @@ enum_member_declaration
// Source: §20.2 Delegate declarations
delegate_declaration
: attributes? delegate_modifier* 'delegate' return_type delegate_header
| attributes? delegate_modifier* 'delegate' ref_kind ref_return_type delegate_header
| attributes? delegate_modifier* 'delegate' ref_kind ref_return_type
delegate_header
;
delegate_header
: identifier '(' formal_parameter_list? ')' ';'
| identifier variant_type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause* ';'
| identifier variant_type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause* ';'
;
delegate_modifier
Expand Down
3 changes: 2 additions & 1 deletion standard/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ interface_method_declaration
interface_method_header
: identifier '(' formal_parameter_list? ')' ';'
| identifier type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause* ';'
| identifier type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause* ';'
;
```

Expand Down
6 changes: 4 additions & 2 deletions standard/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ A set of patterns `Q` is *exhaustive* for a type `T` if any of the following con
> static void M(byte b)
> {
> switch (b) {
> case 0: case 1: case 2: case 3: ... // handle every specific value of byte
> case 0: case 1: case 2: ... // handle every specific value of byte
> break;
> case byte other: // error: the pattern 'byte other' is subsumed by the (exhaustive) previous cases
> // error: the pattern 'byte other' is subsumed by the (exhaustive)
> // previous cases
> case byte other:
> break;
> }
> }
Expand Down
27 changes: 18 additions & 9 deletions standard/standard-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ namespace System
public T4 Item4;
public T5 Item5;
public T6 Item6;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6);
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5,
T6 item6);
}
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7>
{
Expand All @@ -302,7 +303,8 @@ namespace System
public T5 Item5;
public T6 Item6;
public T7 Item7;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7);
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5,
T6 item6, T7 item7);
}
public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>
{
Expand All @@ -314,7 +316,8 @@ namespace System
public T6 Item6;
public T7 Item7;
public TRest Rest;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest);
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5,
T6 item6, T7 item7, TRest rest);
}

public abstract class ValueType
Expand Down Expand Up @@ -509,25 +512,29 @@ namespace System.Runtime.CompilerServices
void OnCompleted(Action continuation);
}

public readonly struct TaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
public readonly struct TaskAwaiter : ICriticalNotifyCompletion,
INotifyCompletion
{
public bool IsCompleted { get; }
public void GetResult();
}

public readonly struct TaskAwaiter<TResult> : ICriticalNotifyCompletion, INotifyCompletion
public readonly struct TaskAwaiter<TResult> : ICriticalNotifyCompletion,
INotifyCompletion
{
public bool IsCompleted { get; }
public TResult GetResult();
}

public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion,
INotifyCompletion
{
public bool IsCompleted { get; }
public void GetResult();
}

public readonly struct ValueTaskAwaiter<TResult> : ICriticalNotifyCompletion, INotifyCompletion
public readonly struct ValueTaskAwaiter<TResult>
: ICriticalNotifyCompletion, INotifyCompletion
{
public bool IsCompleted { get; }
public TResult GetResult();
Expand All @@ -549,9 +556,11 @@ namespace System.Threading.Tasks
{
public System.Runtime.CompilerServices.ValueTaskAwaiter GetAwaiter();
}
public readonly struct ValueTask<TResult> : System.IEquatable<ValueTask<TResult>>
public readonly struct ValueTask<TResult>
: System.IEquatable<ValueTask<TResult>>
{
public new System.Runtime.CompilerServices.ValueTaskAwaiter<TResult> GetAwaiter();
public new System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>
GetAwaiter();
}
}
```
Expand Down
12 changes: 8 additions & 4 deletions standard/statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ explicitly_typed_local_variable_declaration
;
explicitly_typed_local_variable_declarators
: explicitly_typed_local_variable_declarator (',' explicitly_typed_local_variable_declarator)*
: explicitly_typed_local_variable_declarator
(',' explicitly_typed_local_variable_declarator)*
;
explicitly_typed_local_variable_declarator
Expand Down Expand Up @@ -486,13 +487,16 @@ A *local_function_declaration* declares a local function.

```ANTLR
local_function_declaration
: local_function_modifier* return_type local_function_header local_function_body
| ref_local_function_modifier* ref_kind ref_return_type local_function_header ref_local_function_body
: local_function_modifier* return_type local_function_header
local_function_body
| ref_local_function_modifier* ref_kind ref_return_type
local_function_header ref_local_function_body
;
local_function_header
: identifier '(' formal_parameter_list? ')'
| identifier type_parameter_list '(' formal_parameter_list? ')' type_parameter_constraints_clause*
| identifier type_parameter_list '(' formal_parameter_list? ')'
type_parameter_constraints_clause*
;
local_function_modifier
Expand Down
9 changes: 6 additions & 3 deletions standard/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1114,13 +1114,16 @@ These values form a nesting relationship from narrowest (declaration-block) to w
> {
> int v3 = 6;
>
> // context of r2 is declaration-block, ref safe context of p is function-member
> // context of r2 is declaration-block,
> // ref safe context of p is function-member
> ref int r2 = ref p;
>
> // context of r3 is declaration-block, ref safe context of v3 is declaration-block
> // context of r3 is declaration-block,
> // ref safe context of v3 is declaration-block
> ref int r3 = ref v3;
>
> // context of r4 is declaration-block, ref safe context of arr[v3] is caller-context
> // context of r4 is declaration-block,
> // ref safe context of arr[v3] is caller-context
> ref int r4 = ref arr[v3];
> }
> }
Expand Down

0 comments on commit e4196e8

Please sign in to comment.