Skip to content

Commit b7e7e9a

Browse files
authored
revise example metadata (#710)
1 parent f2ff5b3 commit b7e7e9a

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

standard/lexical-structure.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The productions for *simple_name* ([§11.7.4](expressions.md#1174-simple-names))
5656

5757
> *Example*: The statement:
5858
>
59-
> <!-- IncompleteExample: {template:"standalone-lib", name:"GrammarAmbiguities1"} -->
59+
> <!-- Incomplete$Example: {template:"standalone-lib", name:"GrammarAmbiguities1"} -->
6060
> ```csharp
6161
> F(G<A, B>(7));
6262
> ```
@@ -79,7 +79,7 @@ then the *type_argument_list* is retained as part of the *simple_name*, *member_
7979
<!-- markdownlint-enable MD028 -->
8080
> *Example*: The statement:
8181
>
82-
> <!-- IncompleteExample: {template:"standalone-lib", name:"GrammarAmbiguities2"} -->
82+
> <!-- Incomplete$Example: {template:"standalone-lib", name:"GrammarAmbiguities2"} -->
8383
> ```csharp
8484
> F(G<A, B>(7));
8585
> ```
@@ -94,14 +94,14 @@ then the *type_argument_list* is retained as part of the *simple_name*, *member_
9494
>
9595
> will each be interpreted as a call to `F` with two arguments. The statement
9696
>
97-
> <!-- IncompleteExample: {template:"standalone-lib", name:"GrammarAmbiguities4"} -->
97+
> <!-- Incomplete$Example: {template:"standalone-lib", name:"GrammarAmbiguities4"} -->
9898
> ```csharp
9999
> x = F<A> + y;
100100
> ```
101101
>
102102
> will be interpreted as a less-than operator, greater-than operator and unary-plus operator, as if the statement had been written `x = (F < A) > (+y)`, instead of as a *simple_name* with a *type_argument_list* followed by a binary-plus operator. In the statement
103103
>
104-
> <!-- IncompleteExample: {template:"standalone-lib", name:"GrammarAmbiguities5"} -->
104+
> <!-- Incomplete$Example: {template:"standalone-lib", name:"GrammarAmbiguities5"} -->
105105
> ```csharp
106106
> x = y is C<T> && z;
107107
> ```
@@ -192,7 +192,7 @@ A ***delimited comment*** begins with the characters `/*` and ends with the cha
192192

193193
> *Example*: The example
194194
>
195-
> <!-- Example: {template:"standalone-console", name:"HelloWorld1", expectedOutput:["hello, world"]} -->
195+
> <!-- Example: {template:"standalone-console-without-using", name:"HelloWorld1", expectedOutput:["hello, world"]} -->
196196
> ```csharp
197197
> /* Hello, world program
198198
> This program writes "hello, world" to the console
@@ -214,7 +214,7 @@ A ***single-line comment*** begins with the characters `//` and extends to the
214214
215215
> *Example*: The example
216216
>
217-
> <!-- Example: {template:"standalone-console", name:"HelloWorld2", expectedOutput:["hello, world"]} -->
217+
> <!-- Example: {template:"standalone-console-without-using", name:"HelloWorld2", expectedOutput:["hello, world"]} -->
218218
> ```csharp
219219
> // Hello, world program
220220
> // This program writes "hello, world" to the console
@@ -355,7 +355,7 @@ Multiple translations are not performed. For instance, the string literal `"\u00
355355
<!-- markdownlint-enable MD028 -->
356356
> *Example*: The example
357357
>
358-
> <!-- Example: {template:"standalone-lib", name:"UnicodeCharacterEscapeSequences"} -->
358+
> <!-- Example: {template:"standalone-lib-without-using", name:"UnicodeCharacterEscapeSequences"} -->
359359
> ```csharp
360360
> class Class1
361361
> {
@@ -372,7 +372,7 @@ Multiple translations are not performed. For instance, the string literal `"\u00
372372
>
373373
> shows several uses of `\u0066`, which is the escape sequence for the letter “`f`”. The program is equivalent to
374374
>
375-
> <!-- Example: {template:"standalone-lib", name:"UnicodeCharacterEscapeSequencesNot"} -->
375+
> <!-- Example: {template:"standalone-lib-without-using", name:"UnicodeCharacterEscapeSequencesNot"} -->
376376
> ```csharp
377377
> class Class1
378378
> {
@@ -500,7 +500,7 @@ The prefix “`@`” enables the use of keywords as identifiers, which is usefu
500500
<!-- markdownlint-enable MD028 -->
501501
> *Example*: The example:
502502
>
503-
> <!-- Example: {template:"standalone-lib", name:"IdentifierAtPrefix"} -->
503+
> <!-- Example: {template:"standalone-lib-without-using", name:"IdentifierAtPrefix"} -->
504504
> ```csharp
505505
> class @class
506506
> {
@@ -819,6 +819,7 @@ fragment Hexadecimal_Escape_Sequence
819819
<!-- markdownlint-enable MD028 -->
820820
> *Note*: The use of the `\x` *Hexadecimal_Escape_Sequence* production can be error-prone and hard to read due to the variable number of hexadecimal digits following the `\x`. For example, in the code:
821821
>
822+
> <!-- Example: {template:"standalone-console-without-using", name:"CharacterLiterals", ignoredWarnings:["CS0219"]} -->
822823
> ```csharp
823824
> string good = "x9Good text";
824825
> string bad = "x9Bad text";
@@ -904,7 +905,7 @@ fragment Quote_Escape_Sequence
904905
905906
> *Example*: The example
906907
>
907-
> <!-- Example: {template:"code-in-main", name:"StringLiterals", ignoredWarnings:["CS0219"]} -->
908+
> <!-- Example: {template:"code-in-main-without-using", name:"StringLiterals", ignoredWarnings:["CS0219"]} -->
908909
> ```csharp
909910
> string a = "Happy birthday, Joel"; // Happy birthday, Joel
910911
> string b = @"Happy birthday, Joel"; // Happy birthday, Joel
@@ -938,7 +939,7 @@ Each string literal does not necessarily result in a new string instance. When t
938939
939940
> *Example*: For instance, the output produced by
940941
>
941-
> <!-- Example: {template:"standalone-console", name:"ObjectReferenceEquality", expectedOutput:["True"]} -->
942+
> <!-- Example: {template:"standalone-console-without-using", name:"ObjectReferenceEquality", expectedOutput:["True"]} -->
942943
> ```csharp
943944
> class Test
944945
> {
@@ -1064,7 +1065,7 @@ Pre-processing directives are not part of the syntactic grammar of C#. However,
10641065

10651066
> *Example*: When compiled, the program
10661067
>
1067-
> <!-- Example: {template:"standalone-lib", name:"PreproGeneral1"} -->
1068+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproGeneral1"} -->
10681069
> ```csharp
10691070
> #define A
10701071
> #undef B
@@ -1085,7 +1086,7 @@ Pre-processing directives are not part of the syntactic grammar of C#. However,
10851086
>
10861087
> results in the exact same sequence of tokens as the program
10871088
>
1088-
> <!-- Example: {template:"standalone-lib", name:"PreproGeneral2"} -->
1089+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproGeneral2"} -->
10891090
> ```csharp
10901091
> class C
10911092
> {
@@ -1179,7 +1180,7 @@ Any `#define` and `#undef` directives in a compilation unit shall occur before t
11791180

11801181
> *Example*: The example:
11811182
>
1182-
> <!-- Example: {template:"standalone-lib", name:"PreproDefinitionDirectives1", replaceEllipsis:true} -->
1183+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproDefinitionDirectives1", replaceEllipsis:true} -->
11831184
> ```csharp
11841185
> #define Enterprise
11851186
> #if Professional || Enterprise
@@ -1201,7 +1202,7 @@ Any `#define` and `#undef` directives in a compilation unit shall occur before t
12011202
<!-- markdownlint-enable MD028 -->
12021203
> *Example*: The following example results in a compile-time error because a #define follows real code:
12031204
>
1204-
> <!-- Example: {template:"standalone-lib", name:"PreproDefinitionDirectives2", expectedErrors:["CS1032"]} -->
1205+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproDefinitionDirectives2", expectedErrors:["CS1032"]} -->
12051206
> ```csharp
12061207
> #define A
12071208
> namespace N
@@ -1219,7 +1220,7 @@ A `#define` may define a conditional compilation symbol that is already defined,
12191220
12201221
> *Example*: The example below defines a conditional compilation symbol A and then defines it again.
12211222
>
1222-
> <!-- Example: {template:"standalone-lib", name:"PreproSymbolRedefinition"} -->
1223+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproSymbolRedefinition"} -->
12231224
> ```csharp
12241225
> #define A
12251226
> #define A
@@ -1233,7 +1234,7 @@ A `#undef` may “undefine” a conditional compilation symbol that is not defin
12331234
12341235
> *Example*: The example below defines a conditional compilation symbol `A` and then undefines it twice; although the second `#undef` has no effect, it is still valid.
12351236
>
1236-
> <!-- Example: {template:"standalone-lib", name:"PreproSymbolUndef"} -->
1237+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproSymbolUndef"} -->
12371238
> ```csharp
12381239
> #define A
12391240
> #undef A
@@ -1289,7 +1290,8 @@ Any remaining conditional sections are skipped and no tokens, except those for p
12891290
<!-- markdownlint-enable MD028 -->
12901291
> *Example*: The following example illustrates how conditional compilation directives can nest:
12911292
>
1292-
> <!-- IncompleteExample: {template:"standalone-lib", name:"PreproConditionalCompilation", replaceEllipsis:true} -->
1293+
> <!-- FIX: my thinking was to make CheckConsistency, WriteToLog, CommitHelper extension methods, but I could not get that to work. -->
1294+
> <!-- Incomplete$Example: {template:"standalone-lib-without-using", name:"PreproConditionalCompilation", replaceEllipsis:true} -->
12931295
> ```csharp
12941296
> #define Debug // Debugging on
12951297
> #undef Trace // Tracing off
@@ -1311,7 +1313,8 @@ Any remaining conditional sections are skipped and no tokens, except those for p
13111313
>
13121314
> Except for pre-processing directives, skipped source code is not subject to lexical analysis. For example, the following is valid despite the unterminated comment in the `#else` section:
13131315
>
1314-
> <!-- IncompleteExample: {template:"standalone-lib", name:"PreproInvalidSkippedSource", replaceEllipsis:true} -->
1316+
> <!-- FIX: my thinking was to make CheckConsistency an extension method, but I could not get that to work. -->
1317+
> <!-- Incomplete$Example: {template:"standalone-lib-without-using", name:"PreproInvalidSkippedSource", replaceEllipsis:true} -->
13151318
> ```csharp
13161319
> #define Debug // Debugging on
13171320
> class PurchaseTransaction
@@ -1332,7 +1335,7 @@ Any remaining conditional sections are skipped and no tokens, except those for p
13321335
>
13331336
> Pre-processing directives are not processed when they appear inside multi-line input elements. For example, the program:
13341337
>
1335-
> <!-- Example: {template:"standalone-console", name:"PreproDirectivesNotProcessed", inferOutput:true} -->
1338+
> <!-- Example: {template:"standalone-console-without-using", name:"PreproDirectivesNotProcessed", inferOutput:true} -->
13361339
> ```csharp
13371340
> class Hello
13381341
> {
@@ -1362,7 +1365,7 @@ Any remaining conditional sections are skipped and no tokens, except those for p
13621365
>
13631366
> In peculiar cases, the set of pre-processing directives that is processed might depend on the evaluation of the *pp_expression*. The example:
13641367
>
1365-
> <!-- Example: {template:"standalone-lib", name:"PreproTokenStream"} -->
1368+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproTokenStream"} -->
13661369
> ```csharp
13671370
> #if X
13681371
> /*
@@ -1392,7 +1395,7 @@ fragment PP_Message
13921395
13931396
> *Example*: The example
13941397
>
1395-
> <!-- Example: {template:"standalone-lib", name:"PreproErrorDirective", replaceEllipsis:true} -->
1398+
> <!-- Example: {template:"standalone-lib-without-using", name:"PreproErrorDirective", replaceEllipsis:true} -->
13961399
> ```csharp
13971400
> #if Debug && Retail
13981401
> #error A build can't be both debug and retail
@@ -1427,6 +1430,7 @@ No semantic meaning is attached to a region; regions are intended for use by the
14271430
14281431
The lexical processing of a region:
14291432
1433+
<!-- Example: {template:"standalone-lib-without-using", name:"Region1", replaceEllipsis:true} -->
14301434
```csharp
14311435
#region
14321436
...
@@ -1435,6 +1439,7 @@ The lexical processing of a region:
14351439
14361440
corresponds exactly to the lexical processing of a conditional compilation directive of the form:
14371441
1442+
<!-- Example: {template:"standalone-lib-without-using", name:"Region2", replaceEllipsis:true} -->
14381443
```csharp
14391444
#if true
14401445
...

0 commit comments

Comments
 (0)