Skip to content

Commit 3d84d39

Browse files
authored
Various Pre-v6 tweaks (#542)
* fix point 2 and 3 descriptions * fix end note/example formatting * fix formatting * fix formatting * fix formatting * fix formatting * fix formatting * fix formatting * fix formatting * add trailing space * add trailing space * remove trailing spaces * remove trailing space * wrap long grammar rule * wrap long grammar rule
1 parent 5b5466d commit 3d84d39

File tree

10 files changed

+32
-56
lines changed

10 files changed

+32
-56
lines changed

standard/basic-concepts.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -970,15 +970,15 @@ The behavior of the garbage collector can be controlled, to some degree, via sta
970970
> creates an instance of class `A` and an instance of class `B`. These objects become eligible for garbage collection when the variable `b` is assigned the value `null`, since after this time it is impossible for any user-written code to access them. The output could be either
971971
>
972972
> ```console
973-
> Finalize instance of `A`
974-
> Finalize instance of `B`
973+
> Finalize instance of A
974+
> Finalize instance of B
975975
> ```
976976
>
977977
> or
978978
>
979979
> ```console
980-
> Finalize instance of `B`
981-
> Finalize instance of `A`
980+
> Finalize instance of B
981+
> Finalize instance of A
982982
> ```
983983
>
984984
> because the language imposes no constraints on the order in which objects are garbage collected.

standard/classes.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,9 +1430,7 @@ Constants are permitted to depend on other constants within the same program as
14301430
14311431
Constant declarations may depend on constants from other programs, but such dependencies are only possible in one direction.
14321432
1433-
> *Example*: Referring to the example above, if `A` and `B` were declared in separate programs, it would be possible for `A.X` to depend on `B.Z`, but `B.Z` could then not simultaneously depend on `A.Y`.
1434-
>
1435-
> *end example*
1433+
> *Example*: Referring to the example above, if `A` and `B` were declared in separate programs, it would be possible for `A.X` to depend on `B.Z`, but `B.Z` could then not simultaneously depend on `A.Y`. *end example*
14361434
14371435
## 14.5 Fields
14381436
@@ -2179,9 +2177,7 @@ Output parameters are typically used in methods that produce multiple return val
21792177
21802178
A parameter declared with a `params` modifier is a parameter array. If a formal parameter list includes a parameter array, it shall be the last parameter in the list and it shall be of a single-dimensional array type.
21812179
2182-
> *Example*: The types `string[]` and `string[][]` can be used as the type of a parameter array, but the type `string[,]` can not.
2183-
>
2184-
> *end example*
2180+
> *Example*: The types `string[]` and `string[][]` can be used as the type of a parameter array, but the type `string[,]` can not. *end example*
21852181
21862182
It is not possible to combine the `params` modifier with the modifiers `ref` and `out`.
21872183
@@ -4277,9 +4273,7 @@ For the purposes of these rules, any type parameters associated with `S` or `T
42774273
42784274
From the second rule, it follows that a conversion operator shall convert either to or from the class or struct type in which the operator is declared.
42794275
4280-
> *Example*: It is possible for a class or struct type `C` to define a conversion from `C` to `int` and from `int` to `C`, but not from `int` to `bool`.
4281-
>
4282-
> *end example*
4276+
> *Example*: It is possible for a class or struct type `C` to define a conversion from `C` to `int` and from `int` to `C`, but not from `int` to `bool`. *end example*
42834277
42844278
It is not possible to directly redefine a pre-defined conversion. Thus, conversion operators are not allowed to convert from or to `object` because implicit and explicit conversions already exist between `object` and all other types. Likewise, neither the source nor the target types of a conversion can be a base type of the other, since a conversion would then already exist. However, it *is* possible to declare operators on generic types that, for particular type arguments, specify conversions that already exist as pre-defined conversions.
42854279

standard/conversions.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,7 @@ The explicit enumeration conversions are:
373373
374374
An explicit enumeration conversion between two types is processed by treating any participating *enum_type* as the underlying type of that *enum_type*, and then performing an implicit or explicit numeric conversion between the resulting types.
375375
376-
> *Example*: Given an *enum_type* `E` with and underlying type of `int`, a conversion from `E` to `byte` is processed as an explicit numeric conversion ([§10.3.2](conversions.md#1032-explicit-numeric-conversions)) from `int` to `byte`, and a conversion from `byte` to `E` is processed as an implicit numeric conversion ([§10.2.3](conversions.md#1023-implicit-numeric-conversions)) from `byte` to `int`.
377-
>
378-
> *end example*
376+
> *Example*: Given an *enum_type* `E` with and underlying type of `int`, a conversion from `E` to `byte` is processed as an explicit numeric conversion ([§10.3.2](conversions.md#1032-explicit-numeric-conversions)) from `int` to `byte`, and a conversion from `byte` to `E` is processed as an implicit numeric conversion ([§10.2.3](conversions.md#1023-implicit-numeric-conversions)) from `byte` to `int`. *end example*
379377
380378
### 10.3.4 Explicit nullable conversions
381379
@@ -887,6 +885,7 @@ The compile-time application of the conversion from a method group `E` to a del
887885
> The assignment to `d4` shows how the method must be applicable in its normal form.
888886
>
889887
> The assignment to `d5` shows how parameter and return types of the delegate and method are allowed to differ only for reference types.
888+
>
890889
> *end example*
891890
892891
As with all other implicit and explicit conversions, the cast operator can be used to explicitly perform a particular conversion.

standard/expressions.md

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,9 +2313,7 @@ array_creation_expression
23132313
23142314
An array creation expression of the first form allocates an array instance of the type that results from deleting each of the individual expressions from the expression list.
23152315

2316-
> *Example*: The array creation expression `new int[10,20]` produces an array instance of type `int[,]`, and the array creation expression new `int[10][,]` produces an array instance of type `int[][,]`.
2317-
>
2318-
> *end example*
2316+
> *Example*: The array creation expression `new int[10,20]` produces an array instance of type `int[,]`, and the array creation expression new `int[10][,]` produces an array instance of type `int[][,]`. *end example*
23192317
23202318
Each expression in the expression list shall be of type `int`, `uint`, `long`, or `ulong`, or implicitly convertible to one or more of these types. The value of each expression determines the length of the corresponding dimension in the newly allocated array instance. Since the length of an array dimension shall be nonnegative, it is a compile-time error to have a constant expression with a negative value, in the expression list.
23212319

@@ -3079,9 +3077,7 @@ A *cast_expression* of the form `(T)E`, where `T` is a type and `E` is a *unary_
30793077

30803078
The grammar for a *cast_expression* leads to certain syntactic ambiguities.
30813079

3082-
> *Example*: The expression `(x)–y` could either be interpreted as a *cast_expression* (a cast of `–y` to type `x`) or as an *additive_expression* combined with a *parenthesized_expression* (which computes the value `x – y`).
3083-
>
3084-
> *end example*
3080+
> *Example*: The expression `(x)–y` could either be interpreted as a *cast_expression* (a cast of `–y` to type `x`) or as an *additive_expression* combined with a *parenthesized_expression* (which computes the value `x – y`). *end example*
30853081
30863082
To resolve *cast_expression* ambiguities, the following rule exists: A sequence of one or more tokens ([§6.4](lexical-structure.md#64-tokens)) enclosed in parentheses is considered the start of a *cast_expression* only if at least one of the following are true:
30873083

@@ -3090,9 +3086,7 @@ To resolve *cast_expression* ambiguities, the following rule exists: A sequence
30903086

30913087
The term “correct grammar” above means only that the sequence of tokens shall conform to the particular grammatical production. It specifically does not consider the actual meaning of any constituent identifiers.
30923088

3093-
> *Example*: If `x` and `y` are identifiers, then `x.y` is correct grammar for a type, even if `x.y` doesn’t actually denote a type.
3094-
>
3095-
> *end example*
3089+
> *Example*: If `x` and `y` are identifiers, then `x.y` is correct grammar for a type, even if `x.y` doesn’t actually denote a type. *end example*
30963090
<!-- markdownlint-disable MD028 -->
30973091
30983092
<!-- markdownlint-enable MD028 -->
@@ -3978,9 +3972,7 @@ Shift operations never cause overflows and produce the same results in checked a
39783972

39793973
When the left operand of the `>>` operator is of a signed integral type, the operator performs an *arithmetic* shift right wherein the value of the most significant bit (the sign bit) of the operand is propagated to the high-order empty bit positions. When the left operand of the `>>` operator is of an unsigned integral type, the operator performs a *logical* shift right wherein high-order empty bit positions are always set to zero. To perform the opposite operation of that inferred from the operand type, explicit casts can be used.
39803974

3981-
> *Example*: If `x` is a variable of type `int`, the operation `unchecked ((int)((uint)x >> y))` performs a logical shift right of `x`.
3982-
>
3983-
> *end example*
3975+
> *Example*: If `x` is a variable of type `int`, the operation `unchecked ((int)((uint)x >> y))` performs a logical shift right of `x`. *end example*
39843976
39853977
Lifted ([§11.4.8](expressions.md#1148-lifted-operators)) forms of the unlifted predefined shift operators defined above are also predefined.
39863978

@@ -4095,9 +4087,7 @@ The operators compare the operands according to the rules of the IEC 60559 stand
40954087

40964088
If either operand is NaN, the result is `false` for all operators except `!=`, for which the result is `true`. For any two operands, `x != y` always produces the same result as `!(x == y)`. However, when one or both operands are NaN, the `<`, `>`, `<=`, and `>=` operators do *not* produce the same results as the logical negation of the opposite operator.
40974089

4098-
> *Example*: If either of `x` and `y` is NaN, then `x` < `y` is `false`, but `!(x >= y)` is `true`.
4099-
>
4100-
> *end example*
4090+
> *Example*: If either of `x` and `y` is NaN, then `x` < `y` is `false`, but `!(x >= y)` is `true`. *end example*
41014091
41024092
When neither operand is NaN, the operators compare the values of the two floating-point operands with respect to the ordering
41034093

@@ -4601,9 +4591,7 @@ In a null coalescing expression of the form `a ?? b`, if `a` is non-`null`, th
46014591

46024592
The null coalescing operator is right-associative, meaning that operations are grouped from right to left.
46034593

4604-
> *Example*: An expression of the form `a ?? b ?? c` is evaluated as a `?? (b ?? c)`. In general terms, an expression of the form `E1 ?? E2 ?? ... ?? EN` returns the first of the operands that is non-`null`, or `null` if all operands are `null`.
4605-
>
4606-
> *end example*
4594+
> *Example*: An expression of the form `a ?? b ?? c` is evaluated as a `?? (b ?? c)`. In general terms, an expression of the form `E1 ?? E2 ?? ... ?? EN` returns the first of the operands that is non-`null`, or `null` if all operands are `null`. *end example*
46074595
46084596
The type of the expression `a ?? b` depends on which implicit conversions are available on the operands. In order of preference, the type of `a ?? b` is `A₀`, `A`, or `B`, where `A` is the type of `a` (provided that `a` has a type), `B` is the type of `b`(provided that `b` has a type), and `A₀` is the underlying type of `A` if `A` is a nullable value type, or `A` otherwise. Specifically, `a ?? b` is processed as follows:
46094597

@@ -4631,9 +4619,7 @@ A conditional expression of the form `b ? x : y` first evaluates the conditi
46314619

46324620
The conditional operator is right-associative, meaning that operations are grouped from right to left.
46334621

4634-
> *Example*: An expression of the form `a ? b : c ? d : e` is evaluated as `a ? b : (c ? d : e)`.
4635-
>
4636-
> *end example*
4622+
> *Example*: An expression of the form `a ? b : c ? d : e` is evaluated as `a ? b : (c ? d : e)`. *end example*
46374623
46384624
The first operand of the `?:` operator shall be an expression that can be implicitly converted to `bool`, or an expression of a type that implements `operator true`. If neither of these requirements is satisfied, a compile-time error occurs.
46394625

@@ -6055,9 +6041,7 @@ The `+=` and `-=` operators with an event access expression as the left operand
60556041

60566042
The assignment operators are right-associative, meaning that operations are grouped from right to left.
60576043

6058-
> *Example*: An expression of the form `a = b = c` is evaluated as `a = (b = c)`.
6059-
>
6060-
> *end example*
6044+
> *Example*: An expression of the form `a = b = c` is evaluated as `a = (b = c)`. *end example*
60616045

60626046
### 11.18.2 Simple assignment
60636047

@@ -6193,9 +6177,7 @@ An operation of the form `x «op»= y` is processed by applying binary operato
61936177

61946178
The termevaluated only oncemeans that in the evaluation of `x «op» y`, the results of any constituent expressions of `x` are temporarily saved and then reused when performing the assignment to `x`.
61956179

6196-
> *Example*: In the assignment `A()[B()] += C()`, where `A` is a method returning `int[]`, and `B` and `C` are methods returning `int`, the methods are invoked only once, in the order `A`, `B`, `C`.
6197-
>
6198-
> *end example*
6180+
> *Example*: In the assignment `A()[B()] += C()`, where `A` is a method returning `int[]`, and `B` and `C` are methods returning `int`, the methods are invoked only once, in the order `A`, `B`, `C`. *end example*
61996181

62006182
When the left operand of a compound assignment is a property access or indexer access, the property or indexer shall have both a get accessor and a set accessor. If this is not the case, a binding-time error occurs.
62016183

standard/general-description.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Examples are provided to illustrate possible forms of the constructions describe
1313
Informative text is indicated in the following ways:
1414

1515
1. Whole or partial clauses or annexes delimited by “**This clause/text is informative**” and “**End of informative text**”.
16-
1. *Example*: The following example … code fragment, possibly with some narrative … *end example*
17-
1. *Note*: narrative … *end note* The *Note*: and *end note* are in the same paragraph for single paragraph notes. If a note spans multiple paragraphs, the *end note* marker should be its own paragraph.
16+
1. *Example*: The following example … code fragment, possibly with some narrative … *end example* The *Example:* and *end example* markers are in the same paragraph for single paragraph examples. If an example spans multiple paragraphs, the end example marker should be its own paragraph.
17+
1. *Note*: narrative … *end note* The *Note*: and *end note* markers are in the same paragraph for single paragraph notes. If a note spans multiple paragraphs, the *end note* marker should be its own paragraph.
1818

1919
All text not marked as being informative is normative.

standard/lexical-structure.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ The lexical processing of a C# compilation unit consists of reducing the file i
155155

156156
When several lexical grammar productions match a sequence of characters in a compilation unit, the lexical processing always forms the longest possible lexical element.
157157

158-
> *Example*: The character sequence `//` is processed as the beginning of a single-line comment because that lexical element is longer than a single `/` token.
159-
>
160-
> *end example*
158+
> *Example*: The character sequence `//` is processed as the beginning of a single-line comment because that lexical element is longer than a single `/` token. *end example*
161159
162160
Some tokens are defined by a set of lexical rules; a main rule and one or more sub-rules. The latter are marked in the grammar by `fragment` to indicate the rule defines part of another token. Fragment rules are not considered in the top-to-bottom ordering of lexical rules.
163161

@@ -914,7 +912,7 @@ right_shift_assignment
914912
915913
*right_shift* is made up of the two tokens `>` and `>`. Similarly, *right_shift_assignment* is made up of the two tokens `>` and `>=`. Unlike other productions in the syntactic grammar, no characters of any kind (not even whitespace) are allowed between the two tokens in each of these productions. These productions are treated specially in order to enable the correct handling of *type_parameter_lists* ([§14.2.3](classes.md#1423-type-parameters)).
916914

917-
> *Note*: Prior to the addition of generics to C#, `>>` and `>>=` were both single tokens. However, the syntax for generics uses the `<` and `>` characters to delimit type parameters and type arguments. It is often desirable to use nested constructed types, such as `List<Dictionary<string, int>>`. Rather than requiring the programmer to separate the `>` and `>` by a space, the definition of the two *operator_or_punctuator*s was changed.
915+
> *Note*: Prior to the addition of generics to C#, `>>` and `>>=` were both single tokens. However, the syntax for generics uses the `<` and `>` characters to delimit type parameters and type arguments. It is often desirable to use nested constructed types, such as `List<Dictionary<string, int>>`. Rather than requiring the programmer to separate the `>` and `>` by a space, the definition of the two *operator_or_punctuator*s was changed. *end note*
918916
919917
## 6.5 Pre-processing directives
920918

@@ -1049,11 +1047,13 @@ fragment PP_Or_Expression
10491047
;
10501048
10511049
fragment PP_And_Expression
1052-
: PP_Equality_Expression (PP_Whitespace? '&&' PP_Whitespace? PP_Equality_Expression)*
1050+
: PP_Equality_Expression (PP_Whitespace? '&&' PP_Whitespace?
1051+
PP_Equality_Expression)*
10531052
;
10541053
10551054
fragment PP_Equality_Expression
1056-
: PP_Unary_Expression (PP_Whitespace? ('==' | '!=') PP_Whitespace? PP_Unary_Expression)*
1055+
: PP_Unary_Expression (PP_Whitespace? ('==' | '!=') PP_Whitespace?
1056+
PP_Unary_Expression)*
10571057
;
10581058
10591059
fragment PP_Unary_Expression

standard/namespaces.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ A *compilation_unit* consists of zero or more *extern_alias_directive*s followed
1212

1313
```ANTLR
1414
compilation_unit
15-
: extern_alias_directive* using_directive* global_attributes? namespace_member_declaration*
15+
: extern_alias_directive* using_directive* global_attributes?
16+
namespace_member_declaration*
1617
;
1718
```
1819

standard/statements.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ The order in which `foreach` traverses the elements of an array, is as follows:
10051005
> ```
10061006
>
10071007
> the type of `n` is inferred to be `int`, the iteration type of `numbers`.
1008+
>
10081009
> *end example*
10091010
10101011
## 12.10 Jump statements

standard/structs.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ A variable of a struct type directly contains the data of the struct, whereas a
143143
> ```
144144
>
145145
> is an error because each of the types `A`, `B`, and `C` depend on each other.
146-
*end example*
146+
>
147+
> *end example*
147148
148149
With classes, it is possible for two variables to reference the same object, and thus possible for operations on one variable to affect the object referenced by the other variable. With structs, the variables each have their own copy of the data (except in the case of `ref` and `out` parameter variables), and it is not possible for operations on one to affect the other. Furthermore, except when explicitly nullable ([§8.3.11](types.md#8311-nullable-value-types)), it is not possible for values of a struct type to be `null`.
149150

standard/variables.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,7 @@ The following rules apply to these kinds of expressions: parenthesized expressio
541541
542542
Each of these expressions has one or more subexpressions that are unconditionally evaluated in a fixed order.
543543
544-
> *Example*: The binary `%` operator evaluates the left hand side of the operator, then the right hand side. An indexing operation evaluates the indexed expression, and then evaluates each of the index expressions, in order from left to right.
545-
>
546-
> *end example*
544+
> *Example*: The binary `%` operator evaluates the left hand side of the operator, then the right hand side. An indexing operation evaluates the indexed expression, and then evaluates each of the index expressions, in order from left to right. *end example*
547545
548546
For an expression *expr*, which has subexpressions *expr*, *expr*, …, *expr*, evaluated in that order:
549547

0 commit comments

Comments
 (0)