You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/expressions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4161,7 +4161,7 @@ equality_expression
4161
4161
;
4162
4162
```
4163
4163
4164
-
> *Note*: Lookup for the right operand of the `is` operator must first test as a *type*, then as an *expression* which may span multiple tokens. In the case where the operand is an *expreesion*, the pattern expression must have precedence at least as high as *shift_expression*. *end note*
4164
+
> *Note*: Lookup for the right operand of the `is` operator must first test as a *type*, then as an *expression* which may span multiple tokens. In the case where the operand is an *expression*, the pattern expression must have precedence at least as high as *shift_expression*. *end note*
4165
4165
4166
4166
The `is` operator is described in [§12.12.12](expressions.md#121212-the-is-operator) and the `as` operator is described in [§12.12.13](expressions.md#121213-the-as-operator).
Copy file name to clipboardExpand all lines: standard/lexical-structure.md
+54-42Lines changed: 54 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,18 @@ Every compilation unit in a C# program shall conform to the *compilation_unit*
52
52
53
53
### 6.2.5 Grammar ambiguities
54
54
55
-
The productions for *simple_name* ([§12.8.4](expressions.md#1284-simple-names)) and *member_access* ([§12.8.7](expressions.md#1287-member-access)) can give rise to ambiguities in the grammar for expressions.
(the “disambiguated productions”) can give rise to ambiguities in the grammar for expressions.
65
+
66
+
These productions occur in contexts where a value can occur in an expression, and have one or more alternatives that end with the grammar “`identifier type_argument_list?`”. It is the optional *type_argument_list* which results in the possible ambiguity.
56
67
57
68
> *Example*: The statement:
58
69
>
@@ -65,16 +76,17 @@ The productions for *simple_name* ([§12.8.4](expressions.md#1284-simple-names))
@@ -723,14 +735,14 @@ To permit the smallest possible `int` and `long` values to be written as integer
723
735
>1_2__3___4____5// decimal, int
724
736
>_123// not a numeric literal; identifier due to leading _
725
737
>123_// invalid; no trailing _allowed
726
-
>
738
+
>
727
739
>0xFf// hex, int
728
740
>0X1b_a0_44_fEL// hex, long
729
741
>0x1ade_3FE1_29AaUL// hex, ulong
730
742
>0x_abc// hex, int
731
743
>_0x123// not a numeric literal; identifier due to leading _
732
744
>0xabc_// invalid; no trailing _ allowed
733
-
>
745
+
>
734
746
>0b101// binary, int
735
747
>0B1001_1010u// binary, uint
736
748
>0b1111_1111_0000UL// binary, ulong
@@ -774,7 +786,7 @@ If no *Real_Type_Suffix* is specified, the type of the *Real_Literal* is `double
774
786
- A real literal suffixed by `D` or `d` is of type `double`.
775
787
> *Example*: The literals `1d`, `1.5d`, `1e10d`, and `123.456D` are all of type `double`. *end example*
776
788
- A real literal suffixed by `M` or `m` is of type `decimal`.
777
-
> *Example*: The literals `1m`, `1.5m`, `1e10m`, and `123.456M` are all of type `decimal`. *end example*
789
+
> *Example*: The literals `1m`, `1.5m`, `1e10m`, and `123.456M` are all of type `decimal`. *end example*
778
790
This literal is converted to a `decimal` value by taking the exact value, and, if necessary, rounding to the nearest representable value using banker’s rounding ([§8.3.8](types.md#838-the-decimal-type)). Any scale apparent in the literal is preserved unless the value is rounded.
779
791
> *Note*: Hence, the literal `2.900m` will be parsed to form the `decimal` with sign `0`, coefficient `2900`, and scale `3`. *end note*
780
792
@@ -812,24 +824,24 @@ A character literal represents a single character, and consists of a character i
812
824
Character_Literal
813
825
:'\''Character'\''
814
826
;
815
-
827
+
816
828
fragmentCharacter
817
829
:Single_Character
818
830
|Simple_Escape_Sequence
819
831
|Hexadecimal_Escape_Sequence
820
832
|Unicode_Escape_Sequence
821
833
;
822
-
834
+
823
835
fragmentSingle_Character
824
836
// anything but ', \, and New_Line_Character
825
837
:~['\\\u000D\u000A\u0085\u2028\u2029]
826
838
;
827
-
839
+
828
840
fragmentSimple_Escape_Sequence
829
841
:'\\\''|'\\"'|'\\\\'|'\\0'|'\\a'|'\\b'|
830
842
'\\f'|'\\n'|'\\r'|'\\t'|'\\v'
831
843
;
832
-
844
+
833
845
fragmentHexadecimal_Escape_Sequence
834
846
:'\\x'Hex_DigitHex_Digit?Hex_Digit?Hex_Digit?
835
847
;
@@ -890,11 +902,11 @@ String_Literal
890
902
:Regular_String_Literal
891
903
|Verbatim_String_Literal
892
904
;
893
-
905
+
894
906
fragmentRegular_String_Literal
895
907
:'"'Regular_String_Literal_Character*'"'
896
908
;
897
-
909
+
898
910
fragmentRegular_String_Literal_Character
899
911
:Single_Regular_String_Literal_Character
900
912
|Simple_Escape_Sequence
@@ -910,16 +922,16 @@ fragment Single_Regular_String_Literal_Character
910
922
fragmentVerbatim_String_Literal
911
923
:'@"'Verbatim_String_Literal_Character*'"'
912
924
;
913
-
925
+
914
926
fragmentVerbatim_String_Literal_Character
915
927
:Single_Verbatim_String_Literal_Character
916
928
|Quote_Escape_Sequence
917
929
;
918
-
930
+
919
931
fragmentSingle_Verbatim_String_Literal_Character
920
932
:~["] // anything but quotation mark (U+0022)
921
933
;
922
-
934
+
923
935
fragmentQuote_Escape_Sequence
924
936
:'""'
925
937
;
@@ -1102,7 +1114,7 @@ Pre-processing directives are not part of the syntactic grammar of C#. However,
1102
1114
> #endif
1103
1115
> #ifB
1104
1116
> voidH() {}
1105
-
> #else
1117
+
> #else
1106
1118
> voidI() {}
1107
1119
> #endif
1108
1120
> }
@@ -1155,11 +1167,11 @@ Pre-processing expressions can occur in `#if` and `#elif` directives. The operat
0 commit comments