@@ -13,24 +13,15 @@ Swift では、単純な文、コンパイラ制御文、および制御フロ
13
13
14
14
> Grammar of a statement:
15
15
>
16
- > * statement* → * expression* ** ` ; ` ** _ ?_
17
- >
18
- > * statement* → * declaration* ** ` ; ` ** _ ?_
19
- >
20
- > * statement* → * loop-statement* ** ` ; ` ** _ ?_
21
- >
22
- > * statement* → * branch-statement* ** ` ; ` ** _ ?_
23
- >
24
- > * statement* → * labeled-statement* ** ` ; ` ** _ ?_
25
- >
26
- > * statement* → * control-transfer-statement* ** ` ; ` ** _ ?_
27
- >
28
- > * statement* → * defer-statement* ** ` ; ` ** _ ?_
29
- >
30
- > * statement* → * do-statement* ** ` ; ` ** _ ?_
31
- >
32
- > * statement* → * compiler-control-statement*
33
- >
16
+ > * statement* → * expression* ** ` ; ` ** _ ?_ \
17
+ > * statement* → * declaration* ** ` ; ` ** _ ?_ \
18
+ > * statement* → * loop-statement* ** ` ; ` ** _ ?_ \
19
+ > * statement* → * branch-statement* ** ` ; ` ** _ ?_ \
20
+ > * statement* → * labeled-statement* ** ` ; ` ** _ ?_ \
21
+ > * statement* → * control-transfer-statement* ** ` ; ` ** _ ?_ \
22
+ > * statement* → * defer-statement* ** ` ; ` ** _ ?_ \
23
+ > * statement* → * do-statement* ** ` ; ` ** _ ?_ \
24
+ > * statement* → * compiler-control-statement* \
34
25
> * statements* → * statement* * statements* _ ?_
35
26
36
27
## ループ文\( Loop Statements\)
@@ -41,10 +32,8 @@ Swift では、単純な文、コンパイラ制御文、および制御フロ
41
32
42
33
> Grammar of a loop statement:
43
34
>
44
- > * loop-statement* → * for-in-statement*
45
- >
46
- > * loop-statement* → * while-statement*
47
- >
35
+ > * loop-statement* → * for-in-statement* \
36
+ > * loop-statement* → * while-statement* \
48
37
> * loop-statement* → * repeat-while-statement*
49
38
50
39
### For-In 文\( For-In Statement\)
@@ -90,16 +79,10 @@ _condition_ の値は、`Bool` 型または `Bool` にブリッジされた型
90
79
>
91
80
> * while-statement* → ** ` while ` ** * condition-list* * code-block*
92
81
>
93
- >
94
- >
95
- > * condition-list* → * condition* | * condition* ** ` , ` ** * condition-list*
96
- >
82
+ > * condition-list* → * condition* | * condition* ** ` , ` ** * condition-list* \
97
83
> * condition* → * expression* | * availability-condition* | * case-condition* | * optional-binding-condition*
98
84
>
99
- >
100
- >
101
- > * case-condition* → ** ` case ` ** * pattern* * initializer*
102
- >
85
+ > * case-condition* → ** ` case ` ** * pattern* * initializer* \
103
86
> * optional-binding-condition* → ** ` let ` ** * pattern* * initializer* _ ?_ | ** ` var ` ** * pattern* * initializer* _ ?_
104
87
105
88
### Repeat-While 文\( Repeat-While Statement\)
@@ -135,10 +118,8 @@ _condition_ の値は、`Bool` 型または `Bool` にブリッジされた型
135
118
136
119
> Grammar of a branch statement:
137
120
>
138
- > * branch-statement* → * if-statement*
139
- >
140
- > * branch-statement* → * guard-statement*
141
- >
121
+ > * branch-statement* → * if-statement* \
122
+ > * branch-statement* → * guard-statement* \
142
123
> * branch-statement* → * switch-statement*
143
124
144
125
### If 文\( If Statement\)
@@ -181,8 +162,7 @@ if <#condition 1#> {
181
162
182
163
> Grammar of an if statement:
183
164
>
184
- > * if - statement* → ** `if `** * condition- list* * code- block* * else - clause* _ ? _
185
- >
165
+ > * if - statement* → ** `if `** * condition- list* * code- block* * else - clause* _ ? _ \
186
166
> * else - clause* → ** `else `** * code- block* | ** `else `** * if - statement*
187
167
188
168
### < a id= " guard-statement" > Guard 文\(Guard Statement\)</ a>
@@ -285,40 +265,23 @@ case .suppressed:
285
265
286
266
> Grammar of a switch statement:
287
267
>
288
- > * switch - statement* → ** `switch `** * expression* ** `{`** * switch - cases* _ ? _ ** `}`**
289
- >
290
- > * switch - cases* → * switch - case * * switch - cases* _ ? _
291
- >
292
- > * switch - case * → * case - label* * statements*
293
- >
294
- > * switch - case * → * default - label* * statements*
295
- >
268
+ > * switch - statement* → ** `switch `** * expression* ** `{`** * switch - cases* _ ? _ ** `}`** \
269
+ > * switch - cases* → * switch - case * * switch - cases* _ ? _ \
270
+ > * switch - case * → * case - label* * statements* \
271
+ > * switch - case * → * default - label* * statements* \
296
272
> * switch - case * → * conditional- switch - case *
297
273
>
298
- >
299
- >
300
- > * case - label* → * attributes* _ ? _ ** `case `** * case - item- list* ** `: `**
301
- >
302
- > * case - item- list* → * pattern* * where - clause* _ ? _ | * pattern* * where - clause* _ ? _ ** `,`** * case - item- list*
303
- >
274
+ > * case - label* → * attributes* _ ? _ ** `case `** * case - item- list* ** `: `** \
275
+ > * case - item- list* → * pattern* * where - clause* _ ? _ | * pattern* * where - clause* _ ? _ ** `,`** * case - item- list* \
304
276
> * default - label* → * attributes* _ ? _ ** `default `** ** `: `**
305
277
>
306
- >
307
- >
308
- > * where - clause* → ** `where `** * where - expression*
309
- >
278
+ > * where - clause* → ** `where `** * where - expression* \
310
279
> * where - expression* → * expression*
311
280
>
312
- >
313
- >
314
- > * conditional- switch - case * → * switch - if - directive- clause* * switch - elseif- directive- clauses* _ ? _ * switch - else - directive- clause* _ ? _ * endif- directive*
315
- >
316
- > * switch - if - directive- clause* → * if - directive* * compilation- condition* * switch - cases* _ ? _
317
- >
318
- > * switch - elseif- directive- clauses* → * elseif- directive- clause* * switch - elseif- directive- clauses* _ ? _
319
- >
320
- > * switch - elseif- directive- clause* → * elseif- directive* * compilation- condition* * switch - cases* _ ? _
321
- >
281
+ > * conditional- switch - case * → * switch - if - directive- clause* * switch - elseif- directive- clauses* _ ? _ * switch - else - directive- clause* _ ? _ * endif- directive* \
282
+ > * switch - if - directive- clause* → * if - directive* * compilation- condition* * switch - cases* _ ? _ \
283
+ > * switch - elseif- directive- clauses* → * elseif- directive- clause* * switch - elseif- directive- clauses* _ ? _ \
284
+ > * switch - elseif- directive- clause* → * elseif- directive* * compilation- condition* * switch - cases* _ ? _ \
322
285
> * switch - else - directive- clause* → * else - directive* * switch - cases* _ ? _
323
286
324
287
## ラベル付き文\(Labeled Statement\)
@@ -331,18 +294,12 @@ case .suppressed:
331
294
332
295
> Grammar of a labeled statement:
333
296
>
334
- > * labeled- statement* → * statement- label* * loop- statement*
335
- >
336
- > * labeled- statement* → * statement- label* * if - statement*
337
- >
338
- > * labeled- statement* → * statement- label* * switch - statement*
339
- >
297
+ > * labeled- statement* → * statement- label* * loop- statement* \
298
+ > * labeled- statement* → * statement- label* * if - statement* \
299
+ > * labeled- statement* → * statement- label* * switch - statement* \
340
300
> * labeled- statement* → * statement- label* * do - statement*
341
301
>
342
- >
343
- >
344
- > * statement- label* → * label- name* ** `: `**
345
- >
302
+ > * statement- label* → * label- name* ** `: `** \
346
303
> * label- name* → * identifier*
347
304
348
305
## 制御転送文\(Control Transfer Statements\)
@@ -351,14 +308,10 @@ case .suppressed:
351
308
352
309
> Grammar of a control transfer statement:
353
310
>
354
- > * control- transfer- statement* → * break - statement*
355
- >
356
- > * control- transfer- statement* → * continue - statement*
357
- >
358
- > * control- transfer- statement* → * fallthrough - statement*
359
- >
360
- > * control- transfer- statement* → * return - statement*
361
- >
311
+ > * control- transfer- statement* → * break - statement* \
312
+ > * control- transfer- statement* → * continue - statement* \
313
+ > * control- transfer- statement* → * fallthrough - statement* \
314
+ > * control- transfer- statement* → * return - statement* \
362
315
> * control- transfer- statement* → * throw - statement*
363
316
364
317
### < a id= " break-statement" > Break 文\(Break Statement\)</ a>
@@ -550,14 +503,10 @@ do {
550
503
551
504
> Grammar of a do statement:
552
505
>
553
- > * do - statement* → ** `do `** * code- block* * catch - clauses* _ ? _
554
- >
555
- > * catch - clauses* → * catch - clause* * catch - clauses* _ ? _
556
- >
557
- > * catch - clause* → ** `catch `** * catch - pattern- list* _ ? _ * code- block*
558
- >
559
- > * catch - pattern- list* → * catch - pattern* | * catch - pattern* ** `,`** * catch - pattern- list*
560
- >
506
+ > * do - statement* → ** `do `** * code- block* * catch - clauses* _ ? _ \
507
+ > * catch - clauses* → * catch - clause* * catch - clauses* _ ? _ \
508
+ > * catch - clause* → ** `catch `** * catch - pattern- list* _ ? _ * code- block* \
509
+ > * catch - pattern- list* → * catch - pattern* | * catch - pattern* ** `,`** * catch - pattern- list* \
561
510
> * catch - pattern* → * pattern* * where - clause* _ ? _
562
511
563
512
## < a id= " compiler-control-statements" > コンパイラ制御文\(Compiler Control Statements\)</ a>
@@ -566,10 +515,8 @@ do {
566
515
567
516
> Grammar of a compiler control statement:
568
517
>
569
- > * compiler- control- statement* → * conditional- compilation- block*
570
- >
571
- > * compiler- control- statement* → * line- control- statement*
572
- >
518
+ > * compiler- control- statement* → * conditional- compilation- block* \
519
+ > * compiler- control- statement* → * line- control- statement* \
573
520
> * compiler- control- statement* → * diagnostic- statement*
574
521
575
522
### < a id= " conditional-compilation-block" > 条件付きコンパイルブロック\(Conditional Compilation Block\)</ a>
@@ -644,64 +591,34 @@ print("Compiled with the Swift 5 compiler or later in a Swift mode earlier than
644
591
>
645
592
> * conditional- compilation- block* → * if - directive- clause* * elseif- directive- clauses* _ ? _ * else - directive- clause* _ ? _ * endif- directive*
646
593
>
647
- >
648
- >
649
- > * if - directive- clause* → * if - directive* * compilation- condition* * statements* _ ? _
650
- >
651
- > * elseif- directive- clauses* → * elseif- directive- clause* * elseif- directive- clauses* _ ? _
652
- >
653
- > * elseif- directive- clause* → * elseif- directive* * compilation- condition* * statements* _ ? _
654
- >
655
- > * else - directive- clause* → * else - directive* * statements* _ ? _
656
- >
657
- > * if - directive* → ** `#if `**
658
- >
659
- > * elseif- directive* → ** `#elseif `**
660
- >
661
- > * else - directive* → ** `#else `**
662
- >
594
+ > * if - directive- clause* → * if - directive* * compilation- condition* * statements* _ ? _ \
595
+ > * elseif- directive- clauses* → * elseif- directive- clause* * elseif- directive- clauses* _ ? _ \
596
+ > * elseif- directive- clause* → * elseif- directive* * compilation- condition* * statements* _ ? _ \
597
+ > * else - directive- clause* → * else - directive* * statements* _ ? _ \
598
+ > * if - directive* → ** `#if `** \
599
+ > * elseif- directive* → ** `#elseif `** \
600
+ > * else - directive* → ** `#else `** \
663
601
> * endif- directive* → ** `#endif `**
664
602
>
665
- >
666
- >
667
- > * compilation- condition* → * platform- condition*
668
- >
669
- > * compilation- condition* → * identifier*
670
- >
671
- > * compilation- condition* → * boolean- literal*
672
- >
673
- > * compilation- condition* → ** `(`** * compilation- condition* ** `)`**
674
- >
675
- > * compilation- condition* → ** `! `** * compilation- condition*
676
- >
677
- > * compilation- condition* → * compilation- condition* ** `&& `** * compilation- condition*
678
- >
603
+ > * compilation- condition* → * platform- condition* \
604
+ > * compilation- condition* → * identifier* \
605
+ > * compilation- condition* → * boolean- literal* \
606
+ > * compilation- condition* → ** `(`** * compilation- condition* ** `)`** \
607
+ > * compilation- condition* → ** `! `** * compilation- condition* \
608
+ > * compilation- condition* → * compilation- condition* ** `&& `** * compilation- condition* \
679
609
> * compilation- condition* → * compilation- condition* ** `|| `** * compilation- condition*
680
610
>
681
- >
682
- >
683
- > * platform- condition* → ** `os`** ** `(`** * operating- system* ** `)`**
684
- >
685
- > * platform- condition* → ** `arch`** ** `(`** * architecture* ** `)`**
686
- >
687
- > * platform- condition* → ** `swift`** ** `(`** ** `>= `** * swift- version* ** `)`** | ** `swift`** ** `(`** ** `< `** * swift- version* ** `)`**
688
- >
689
- > * platform- condition* → ** `compiler`** ** `(`** ** `>= `** * swift- version* ** `)`** | ** `compiler`** ** `(`** ** `< `** * swift- version* ** `)`**
690
- >
691
- > * platform- condition* → ** `canImport`** ** `(`** * import - path* ** `)`**
692
- >
611
+ > * platform- condition* → ** `os`** ** `(`** * operating- system* ** `)`** \
612
+ > * platform- condition* → ** `arch`** ** `(`** * architecture* ** `)`** \
613
+ > * platform- condition* → ** `swift`** ** `(`** ** `>= `** * swift- version* ** `)`** | ** `swift`** ** `(`** ** `< `** * swift- version* ** `)`** \
614
+ > * platform- condition* → ** `compiler`** ** `(`** ** `>= `** * swift- version* ** `)`** | ** `compiler`** ** `(`** ** `< `** * swift- version* ** `)`** \
615
+ > * platform- condition* → ** `canImport`** ** `(`** * import - path* ** `)`** \
693
616
> * platform- condition* → ** `targetEnvironment`** ** `(`** * environment* ** `)`**
694
617
>
695
- >
696
- >
697
- > * operating- system* → ** `macOS`** | ** `iOS`** | ** `watchOS`** | ** `tvOS`** | ** `Linux`** | ** `Windows`**
698
- >
699
- > * architecture* → ** `i386`** | ** `x86_64`** | ** `arm`** | ** `arm64`**
700
- >
701
- > * swift- version* → * decimal- digits* * swift- version- continuation* _ ? _
702
- >
703
- > * swift- version- continuation* → ** `.`** * decimal- digits* * swift- version- continuation* _ ? _
704
- >
618
+ > * operating- system* → ** `macOS`** | ** `iOS`** | ** `watchOS`** | ** `tvOS`** | ** `Linux`** | ** `Windows`** \
619
+ > * architecture* → ** `i386`** | ** `x86_64`** | ** `arm`** | ** `arm64`** \
620
+ > * swift- version* → * decimal- digits* * swift- version- continuation* _ ? _ \
621
+ > * swift- version- continuation* → ** `.`** * decimal- digits* * swift- version- continuation* _ ? _ \
705
622
> * environment* → ** `simulator`** | ** `macCatalyst`**
706
623
707
624
### < a id= " line-control-statement" > 行制御文\(Line Control Statement\)</ a>
@@ -721,12 +638,9 @@ print("Compiled with the Swift 5 compiler or later in a Swift mode earlier than
721
638
722
639
> Grammar of a line control statement:
723
640
>
724
- > * line- control- statement* → ** `#sourceLocation `** ** `(`** ** `file: `** * file- path* ** `,`** ** `line: `** * line- number* ** `)`**
725
- >
726
- > * line- control- statement* → ** `#sourceLocation `** ** `(`** ** `)`**
727
- >
728
- > * line- number* → A decimal integer greater than zero
729
- >
641
+ > * line- control- statement* → ** `#sourceLocation `** ** `(`** ** `file: `** * file- path* ** `,`** ** `line: `** * line- number* ** `)`** \
642
+ > * line- control- statement* → ** `#sourceLocation `** ** `(`** ** `)`** \
643
+ > * line- number* → A decimal integer greater than zero \
730
644
> * file- path* → * static - string- literal*
731
645
732
646
### < a id= " compile-time-diagnostic-statement" > コンパイル時診断文\(Compile- Time Diagnostic Statement\)</ a>
@@ -766,33 +680,21 @@ if #unavailable(<#platform name#> <#version#>, <#...#>) {
766
680
767
681
> Grammar of an availability condition:
768
682
>
769
- > * availability- condition* → ** `#available `** ** `(`** * availability- arguments* ** `)`**
770
- >
771
- > * availability- condition* → ** `#unavailable `** ** `(`** * availability- arguments* ** `)`**
772
- >
773
- > * availability- arguments* → * availability- argument* | * availability- argument* ** `,`** * availability- arguments*
774
- >
775
- > * availability- argument* → * platform- name* * platform- version*
776
- >
683
+ > * availability- condition* → ** `#available `** ** `(`** * availability- arguments* ** `)`** \
684
+ > * availability- condition* → ** `#unavailable `** ** `(`** * availability- arguments* ** `)`** \
685
+ > * availability- arguments* → * availability- argument* | * availability- argument* ** `,`** * availability- arguments* \
686
+ > * availability- argument* → * platform- name* * platform- version* \
777
687
> * availability- argument* → ** `* `**
778
688
>
779
689
>
780
690
>
781
- > * platform- name* → ** `iOS`** | ** `iOSApplicationExtension`**
782
- >
783
- > * platform- name* → ** `macOS`** | ** `macOSApplicationExtension`**
784
- >
785
- > * platform- name* → ** `macCatalyst`** | ** `macCatalystApplicationExtension`**
786
- >
787
- > * platform- name* → ** `watchOS`** | ** `watchOSApplicationExtension`**
788
- >
789
- > * platform- name* → ** `tvOS`** | ** `tvOSApplicationExtension`**
790
- >
791
- > * platform- name* → ** `visionOS`**
792
- >
793
- > * platform- version* → * decimal- digits*
794
- >
795
- > * platform- version* → * decimal- digits* ** `.`** * decimal- digits*
796
- >
691
+ > * platform- name* → ** `iOS`** | ** `iOSApplicationExtension`** \
692
+ > * platform- name* → ** `macOS`** | ** `macOSApplicationExtension`** \
693
+ > * platform- name* → ** `macCatalyst`** | ** `macCatalystApplicationExtension`** \
694
+ > * platform- name* → ** `watchOS`** | ** `watchOSApplicationExtension`** \
695
+ > * platform- name* → ** `tvOS`** | ** `tvOSApplicationExtension`** \
696
+ > * platform- name* → ** `visionOS`** \
697
+ > * platform- version* → * decimal- digits* \
698
+ > * platform- version* → * decimal- digits* ** `.`** * decimal- digits* \
797
699
> * platform- version* → * decimal- digits* ** `.`** * decimal- digits* ** `.`** * decimal- digits*
798
700
0 commit comments