网站建设刂搜金手指下拉贰伍,网站查询功能怎么做,wordpress 文章前空格,seo学校培训★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号#xff1a;山青咏芝#xff08;shanqingyongzhi#xff09;➤博客园地址#xff1a;山青咏芝#xff08;https://www.cnblogs.com/strengthen/#xff09;➤GitHub地址山青咏芝shanqingyongzhi➤博客园地址山青咏芝https://www.cnblogs.com/strengthen/➤GitHub地址https://github.com/strengthen/LeetCode➤原文地址https://www.cnblogs.com/strengthen/p/9740754.html ➤如果链接不是山青咏芝的博客园地址则可能是爬取作者的文章。➤原文已修改更新强烈建议点击原文地址阅读支持作者支持原创★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ 词法结构 1 GRAMMAR OF WHITESPACE2 3 whitespace → whitespace-item whitespace opt4 5 whitespace-item → line-break6 7 whitespace-item → comment8 9 whitespace-item → multiline-comment
10
11 whitespace-item → U0000, U0009, U000B, U000C, or U0020
12
13 line-break → U000A
14
15 line-break → U000D
16
17 line-break → U000D followed by U000A
18
19 comment → // comment-text line-break
20
21 multiline-comment → /* multiline-comment-text */
22
23 comment-text → comment-text-item comment-text opt
24
25 comment-text-item → Any Unicode scalar value except U000A or U000D
26
27 multiline-comment-text → multiline-comment-text-item multiline-comment-text opt
28
29 multiline-comment-text-item → multiline-comment
30
31 multiline-comment-text-item → comment-text-item
32
33 multiline-comment-text-item → Any Unicode scalar value except /* or */ 1 GRAMMAR OF AN IDENTIFIER2 3 identifier → identifier-head identifier-characters opt4 5 identifier → identifier-head identifier-characters opt 6 7 identifier → implicit-parameter-name8 9 identifier-list → identifier | identifier , identifier-list
10
11 identifier-head → Upper- or lowercase letter A through Z
12
13 identifier-head → _
14
15 identifier-head → U00A8, U00AA, U00AD, U00AF, U00B2–U00B5, or U00B7–U00BA
16
17 identifier-head → U00BC–U00BE, U00C0–U00D6, U00D8–U00F6, or U00F8–U00FF
18
19 identifier-head → U0100–U02FF, U0370–U167F, U1681–U180D, or U180F–U1DBF
20
21 identifier-head → U1E00–U1FFF
22
23 identifier-head → U200B–U200D, U202A–U202E, U203F–U2040, U2054, or U2060–U206F
24
25 identifier-head → U2070–U20CF, U2100–U218F, U2460–U24FF, or U2776–U2793
26
27 identifier-head → U2C00–U2DFF or U2E80–U2FFF
28
29 identifier-head → U3004–U3007, U3021–U302F, U3031–U303F, or U3040–UD7FF
30
31 identifier-head → UF900–UFD3D, UFD40–UFDCF, UFDF0–UFE1F, or UFE30–UFE44
32
33 identifier-head → UFE47–UFFFD
34
35 identifier-head → U10000–U1FFFD, U20000–U2FFFD, U30000–U3FFFD, or U40000–U4FFFD
36
37 identifier-head → U50000–U5FFFD, U60000–U6FFFD, U70000–U7FFFD, or U80000–U8FFFD
38
39 identifier-head → U90000–U9FFFD, UA0000–UAFFFD, UB0000–UBFFFD, or UC0000–UCFFFD
40
41 identifier-head → UD0000–UDFFFD or UE0000–UEFFFD
42
43 identifier-character → Digit 0 through 9
44
45 identifier-character → U0300–U036F, U1DC0–U1DFF, U20D0–U20FF, or UFE20–UFE2F
46
47 identifier-character → identifier-head
48
49 identifier-characters → identifier-character identifier-characters opt
50
51 implicit-parameter-name → $ decimal-digits 1 GRAMMAR OF A LITERAL
2
3 literal → numeric-literal | string-literal | boolean-literal | nil-literal
4
5 numeric-literal → -opt integer-literal | -opt floating-point-literal
6
7 boolean-literal → true | false
8
9 nil-literal → nil 1 GRAMMAR OF AN INTEGER LITERAL2 3 integer-literal → binary-literal4 5 integer-literal → octal-literal6 7 integer-literal → decimal-literal8 9 integer-literal → hexadecimal-literal
10
11 binary-literal → 0b binary-digit binary-literal-characters opt
12
13 binary-digit → Digit 0 or 1
14
15 binary-literal-character → binary-digit | _
16
17 binary-literal-characters → binary-literal-character binary-literal-characters opt
18
19 octal-literal → 0o octal-digit octal-literal-characters opt
20
21 octal-digit → Digit 0 through 7
22
23 octal-literal-character → octal-digit | _
24
25 octal-literal-characters → octal-literal-character octal-literal-characters opt
26
27 decimal-literal → decimal-digit decimal-literal-characters opt
28
29 decimal-digit → Digit 0 through 9
30
31 decimal-digits → decimal-digit decimal-digits opt
32
33 decimal-literal-character → decimal-digit | _
34
35 decimal-literal-characters → decimal-literal-character decimal-literal-characters opt
36
37 hexadecimal-literal → 0x hexadecimal-digit hexadecimal-literal-characters opt
38
39 hexadecimal-digit → Digit 0 through 9, a through f, or A through F
40
41 hexadecimal-literal-character → hexadecimal-digit | _
42
43 hexadecimal-literal-characters → hexadecimal-literal-character hexadecimal-literal-characters opt 1 GRAMMAR OF A FLOATING-POINT LITERAL2 3 floating-point-literal → decimal-literal decimal-fraction opt decimal-exponent opt4 5 floating-point-literal → hexadecimal-literal hexadecimal-fraction opt hexadecimal-exponent6 7 decimal-fraction → . decimal-literal8 9 decimal-exponent → floating-point-e sign opt decimal-literal
10
11 hexadecimal-fraction → . hexadecimal-digit hexadecimal-literal-characters opt
12
13 hexadecimal-exponent → floating-point-p sign opt decimal-literal
14
15 floating-point-e → e | E
16
17 floating-point-p → p | P
18
19 sign → | - 1 GRAMMAR OF A STRING LITERAL2 3 string-literal → static-string-literal | interpolated-string-literal4 5 static-string-literal → quoted-text opt 6 7 static-string-literal → multiline-quoted-text opt 8 9 quoted-text → quoted-text-item quoted-text opt
10
11 quoted-text-item → escaped-character
12
13 quoted-text-item → Any Unicode scalar value except , \, U000A, or U000D
14
15 multiline-quoted-text → multiline-quoted-text-item multiline-quoted-text opt
16
17 multiline-quoted-text-item → escaped-character
18
19 multiline-quoted-text-item → Any Unicode scalar value except \
20
21 multiline-quoted-text-item → escaped-newline
22
23 interpolated-string-literal → interpolated-text opt
24
25 interpolated-string-literal → multiline-interpolated-text opt
26
27 interpolated-text → interpolated-text-item interpolated-text opt
28
29 interpolated-text-item → \( expression ) | quoted-text-item
30
31 multiline-interpolated-text → multiline-interpolated-text-item multiline-interpolated-text opt
32
33 multiline-interpolated-text-item → \( expression ) | multiline-quoted-text-item
34
35 escaped-character → \0 | \\ | \t | \n | \r | \ | \
36
37 escaped-character → \u { unicode-scalar-digits }
38
39 unicode-scalar-digits → Between one and eight hexadecimal digits
40
41 escaped-newline → \ whitespace opt line-break 1 GRAMMAR OF OPERATORS2 3 operator → operator-head operator-characters opt4 5 operator → dot-operator-head dot-operator-characters6 7 operator-head → / | | - | | ! | * | % | | | | | | ^ | ~ | ?8 9 operator-head → U00A1–U00A7
10
11 operator-head → U00A9 or U00AB
12
13 operator-head → U00AC or U00AE
14
15 operator-head → U00B0–U00B1, U00B6, U00BB, U00BF, U00D7, or U00F7
16
17 operator-head → U2016–U2017 or U2020–U2027
18
19 operator-head → U2030–U203E
20
21 operator-head → U2041–U2053
22
23 operator-head → U2055–U205E
24
25 operator-head → U2190–U23FF
26
27 operator-head → U2500–U2775
28
29 operator-head → U2794–U2BFF
30
31 operator-head → U2E00–U2E7F
32
33 operator-head → U3001–U3003
34
35 operator-head → U3008–U3020 or U3030
36
37 operator-character → operator-head
38
39 operator-character → U0300–U036F
40
41 operator-character → U1DC0–U1DFF
42
43 operator-character → U20D0–U20FF
44
45 operator-character → UFE00–UFE0F
46
47 operator-character → UFE20–UFE2F
48
49 operator-character → UE0100–UE01EF
50
51 operator-characters → operator-character operator-characters opt
52
53 dot-operator-head → .
54
55 dot-operator-character → . | operator-character
56
57 dot-operator-characters → dot-operator-character dot-operator-characters opt
58
59 binary-operator → operator
60
61 prefix-operator → operator
62
63 postfix-operator → operator 类型 1 GRAMMAR OF A TYPE2 3 type → array-type4 5 type → dictionary-type6 7 type → function-type8 9 type → type-identifier
10
11 type → tuple-type
12
13 type → optional-type
14
15 type → implicitly-unwrapped-optional-type
16
17 type → protocol-composition-type
18
19 type → metatype-type
20
21 type → Any
22
23 type → Self
24
25 type → ( type ) 1 GRAMMAR OF A TYPE ANNOTATION
2
3 type-annotation → : attributes opt inoutopt type 1 GRAMMAR OF A TYPE IDENTIFIER
2
3 type-identifier → type-name generic-argument-clause opt | type-name generic-argument-clause opt . type-identifier
4
5 type-name → identifier 1 GRAMMAR OF A TUPLE TYPE
2
3 tuple-type → ( ) | ( tuple-type-element , tuple-type-element-list )
4
5 tuple-type-element-list → tuple-type-element | tuple-type-element , tuple-type-element-list
6
7 tuple-type-element → element-name type-annotation | type
8
9 element-name → identifier 1 GRAMMAR OF A FUNCTION TYPE2 3 function-type → attributes opt function-type-argument-clause throwsopt - type4 5 function-type → attributes opt function-type-argument-clause rethrows - type6 7 function-type-argument-clause → ( )8 9 function-type-argument-clause → ( function-type-argument-list ...opt )
10
11 function-type-argument-list → function-type-argument | function-type-argument , function-type-argument-list
12
13 function-type-argument → attributes opt inoutopt type | argument-label type-annotation
14
15 argument-label → identifier 1 GRAMMAR OF AN ARRAY TYPE
2
3 array-type → [ type ] 1 GRAMMAR OF A DICTIONARY TYPE
2
3 dictionary-type → [ type : type ] 1 GRAMMAR OF AN OPTIONAL TYPE
2
3 optional-type → type ? 1 GRAMMAR OF AN IMPLICITLY UNWRAPPED OPTIONAL TYPE
2
3 implicitly-unwrapped-optional-type → type ! 1 GRAMMAR OF A PROTOCOL COMPOSITION TYPE
2
3 protocol-composition-type → type-identifier protocol-composition-continuation
4
5 protocol-composition-continuation → type-identifier | protocol-composition-type 1 GRAMMAR OF A METATYPE TYPE
2
3 metatype-type → type . Type | type . Protocol 1 GRAMMAR OF A TYPE INHERITANCE CLAUSE
2
3 type-inheritance-clause → : type-inheritance-list
4
5 type-inheritance-list → type-identifier | type-identifier , type-inheritance-list 表达式 1 GRAMMAR OF AN EXPRESSION
2
3 expression → try-operator opt prefix-expression binary-expressions opt
4
5 expression-list → expression | expression , expression-list 1 GRAMMAR OF A PREFIX EXPRESSION
2
3 prefix-expression → prefix-operator opt postfix-expression
4
5 prefix-expression → in-out-expression
6
7 in-out-expression → identifier 1 GRAMMAR OF A TRY EXPRESSION
2
3 try-operator → try | try ? | try ! 1 GRAMMAR OF A BINARY EXPRESSION2 3 binary-expression → binary-operator prefix-expression4 5 binary-expression → assignment-operator try-operator opt prefix-expression6 7 binary-expression → conditional-operator try-operator opt prefix-expression8 9 binary-expression → type-casting-operator
10
11 binary-expressions → binary-expression binary-expressions opt 1 GRAMMAR OF AN ASSIGNMENT OPERATOR
2
3 assignment-operator → 1 GRAMMAR OF A CONDITIONAL OPERATOR
2
3 conditional-operator → ? expression : 1 GRAMMAR OF A TYPE-CASTING OPERATOR
2
3 type-casting-operator → is type
4
5 type-casting-operator → as type
6
7 type-casting-operator → as ? type
8
9 type-casting-operator → as ! type 1 GRAMMAR OF A PRIMARY EXPRESSION2 3 primary-expression → identifier generic-argument-clause opt4 5 primary-expression → literal-expression6 7 primary-expression → self-expression8 9 primary-expression → superclass-expression
10
11 primary-expression → closure-expression
12
13 primary-expression → parenthesized-expression
14
15 primary-expression → tuple-expression
16
17 primary-expression → implicit-member-expression
18
19 primary-expression → wildcard-expression
20
21 primary-expression → key-path-expression
22
23 primary-expression → selector-expression
24
25 primary-expression → key-path-string-expression 1 GRAMMAR OF A LITERAL EXPRESSION2 3 literal-expression → literal4 5 literal-expression → array-literal | dictionary-literal | playground-literal6 7 literal-expression → #file | #line | #column | #function | #dsohandle8 9 array-literal → [ array-literal-items opt ]
10
11 array-literal-items → array-literal-item ,opt | array-literal-item , array-literal-items
12
13 array-literal-item → expression
14
15 dictionary-literal → [ dictionary-literal-items ] | [ : ]
16
17 dictionary-literal-items → dictionary-literal-item ,opt | dictionary-literal-item , dictionary-literal-items
18
19 dictionary-literal-item → expression : expression
20
21 playground-literal → #colorLiteral ( red : expression , green : expression , blue : expression , alpha : expression )
22
23 playground-literal → #fileLiteral ( resourceName : expression )
24
25 playground-literal → #imageLiteral ( resourceName : expression ) 1 GRAMMAR OF A SELF EXPRESSION
2
3 self-expression → self | self-method-expression | self-subscript-expression | self-initializer-expression
4
5 self-method-expression → self . identifier
6
7 self-subscript-expression → self [ function-call-argument-list ]
8
9 self-initializer-expression → self . init 1 GRAMMAR OF A SUPERCLASS EXPRESSION
2
3 superclass-expression → superclass-method-expression | superclass-subscript-expression | superclass-initializer-expression
4
5 superclass-method-expression → super . identifier
6
7 superclass-subscript-expression → super [ function-call-argument-list ]
8
9 superclass-initializer-expression → super . init 1 GRAMMAR OF A CLOSURE EXPRESSION2 3 closure-expression → { closure-signature opt statements opt }4 5 closure-signature → capture-list opt closure-parameter-clause throwsopt function-result opt in6 7 closure-signature → capture-list in8 9 closure-parameter-clause → ( ) | ( closure-parameter-list ) | identifier-list
10
11 closure-parameter-list → closure-parameter | closure-parameter , closure-parameter-list
12
13 closure-parameter → closure-parameter-name type-annotation opt
14
15 closure-parameter → closure-parameter-name type-annotation ...
16
17 closure-parameter-name → identifier
18
19 capture-list → [ capture-list-items ]
20
21 capture-list-items → capture-list-item | capture-list-item , capture-list-items
22
23 capture-list-item → capture-specifier opt expression
24
25 capture-specifier → weak | unowned | unowned(safe) | unowned(unsafe) 1 GRAMMAR OF A IMPLICIT MEMBER EXPRESSION
2
3 implicit-member-expression → . identifier 1 GRAMMAR OF A PARENTHESIZED EXPRESSION
2
3 parenthesized-expression → ( expression ) 1 GRAMMAR OF A TUPLE EXPRESSION
2
3 tuple-expression → ( ) | ( tuple-element , tuple-element-list )
4
5 tuple-element-list → tuple-element | tuple-element , tuple-element-list
6
7 tuple-element → expression | identifier : expression 1 GRAMMAR OF A WILDCARD EXPRESSION
2
3 wildcard-expression → _ 1 GRAMMAR OF A KEY-PATH EXPRESSION2 3 key-path-expression → \ type opt . key-path-components4 5 key-path-components → key-path-component | key-path-component . key-path-components6 7 key-path-component → identifier key-path-postfixes opt | key-path-postfixes8 9 key-path-postfixes → key-path-postfix key-path-postfixes opt
10
11 key-path-postfix → ? | ! | [ function-call-argument-list ] 1 GRAMMAR OF A SELECTOR EXPRESSION
2
3 selector-expression → #selector ( expression )
4
5 selector-expression → #selector ( getter: expression )
6
7 selector-expression → #selector ( setter: expression ) 1 GRAMMAR OF A KEY-PATH STRING EXPRESSION
2
3 key-path-string-expression → #keyPath ( expression ) 1 GRAMMAR OF A POSTFIX EXPRESSION2 3 postfix-expression → primary-expression4 5 postfix-expression → postfix-expression postfix-operator6 7 postfix-expression → function-call-expression8 9 postfix-expression → initializer-expression
10
11 postfix-expression → explicit-member-expression
12
13 postfix-expression → postfix-self-expression
14
15 postfix-expression → subscript-expression
16
17 postfix-expression → forced-value-expression
18
19 postfix-expression → optional-chaining-expression 1 GRAMMAR OF A FUNCTION CALL EXPRESSION2 3 function-call-expression → postfix-expression function-call-argument-clause4 5 function-call-expression → postfix-expression function-call-argument-clause opt trailing-closure6 7 function-call-argument-clause → ( ) | ( function-call-argument-list )8 9 function-call-argument-list → function-call-argument | function-call-argument , function-call-argument-list
10
11 function-call-argument → expression | identifier : expression
12
13 function-call-argument → operator | identifier : operator
14
15 trailing-closure → closure-expression 1 GRAMMAR OF AN INITIALIZER EXPRESSION
2
3 initializer-expression → postfix-expression . init
4
5 initializer-expression → postfix-expression . init ( argument-names ) 1 GRAMMAR OF AN EXPLICIT MEMBER EXPRESSION2 3 explicit-member-expression → postfix-expression . decimal-digits4 5 explicit-member-expression → postfix-expression . identifier generic-argument-clause opt6 7 explicit-member-expression → postfix-expression . identifier ( argument-names )8 9 argument-names → argument-name argument-names opt
10
11 argument-name → identifier : 1 GRAMMAR OF A SELF EXPRESSION
2
3 postfix-self-expression → postfix-expression . self 1 GRAMMAR OF A SUBSCRIPT EXPRESSION
2
3 subscript-expression → postfix-expression [ function-call-argument-list ] 1 GRAMMAR OF A FORCED-VALUE EXPRESSION
2
3 forced-value-expression → postfix-expression ! 1 GRAMMAR OF AN OPTIONAL-CHAINING EXPRESSION
2
3 optional-chaining-expression → postfix-expression ? 语句 1 GRAMMAR OF A STATEMENT2 3 statement → expression ;opt4 5 statement → declaration ;opt6 7 statement → loop-statement ;opt8 9 statement → branch-statement ;opt
10
11 statement → labeled-statement ;opt
12
13 statement → control-transfer-statement ;opt
14
15 statement → defer-statement ;opt
16
17 statement → do-statement ;opt
18
19 statement → compiler-control-statement
20
21 statements → statement statements opt 1 GRAMMAR OF A LOOP STATEMENT
2
3 loop-statement → for-in-statement
4
5 loop-statement → while-statement
6
7 loop-statement → repeat-while-statement 1 GRAMMAR OF A FOR-IN STATEMENT
2
3 for-in-statement → for caseopt pattern in expression where-clause opt code-block 1 GRAMMAR OF A WHILE STATEMENT2 3 while-statement → while condition-list code-block4 5 condition-list → condition | condition , condition-list6 7 condition → expression | availability-condition | case-condition | optional-binding-condition8 9 case-condition → case pattern initializer
10
11 optional-binding-condition → let pattern initializer | var pattern initializer 1 GRAMMAR OF A REPEAT-WHILE STATEMENT
2
3 repeat-while-statement → repeat code-block while expression 1 GRAMMAR OF A BRANCH STATEMENT
2
3 branch-statement → if-statement
4
5 branch-statement → guard-statement
6
7 branch-statement → switch-statement 1 GRAMMAR OF AN IF STATEMENT
2
3 if-statement → if condition-list code-block else-clause opt
4
5 else-clause → else code-block | else if-statement 1 GRAMMAR OF A GUARD STATEMENT
2
3 guard-statement → guard condition-list else code-block 1 GRAMMAR OF A SWITCH STATEMENT2 3 switch-statement → switch expression { switch-cases opt }4 5 switch-cases → switch-case switch-cases opt6 7 switch-case → case-label statements8 9 switch-case → default-label statements
10
11 switch-case → conditional-switch-case
12
13 case-label → case case-item-list :
14
15 case-item-list → pattern where-clause opt | pattern where-clause opt , case-item-list
16
17 default-label → default :
18
19 where-clause → where where-expression
20
21 where-expression → expression
22
23 conditional-switch-case → switch-if-directive-clause switch-elseif-directive-clauses opt switch-else-directive-clause opt endif-directive
24
25 switch-if-directive-clause → if-directive compilation-condition switch-cases opt
26
27 switch-elseif-directive-clauses → elseif-directive-clause switch-elseif-directive-clauses opt
28
29 switch-elseif-directive-clause → elseif-directive compilation-condition switch-cases opt
30
31 switch-else-directive-clause → else-directive switch-cases opt 1 GRAMMAR OF A LABELED STATEMENT2 3 labeled-statement → statement-label loop-statement4 5 labeled-statement → statement-label if-statement6 7 labeled-statement → statement-label switch-statement8 9 labeled-statement → statement-label do-statement
10
11 statement-label → label-name :
12
13 label-name → identifier 1 GRAMMAR OF A CONTROL TRANSFER STATEMENT2 3 control-transfer-statement → break-statement4 5 control-transfer-statement → continue-statement6 7 control-transfer-statement → fallthrough-statement8 9 control-transfer-statement → return-statement
10
11 control-transfer-statement → throw-statement 1 GRAMMAR OF A BREAK STATEMENT
2
3 break-statement → break label-name opt 1 GRAMMAR OF A CONTINUE STATEMENT
2
3 continue-statement → continue label-name opt 1 GRAMMAR OF A FALLTHROUGH STATEMENT
2
3 fallthrough-statement → fallthrough 1 GRAMMAR OF A RETURN STATEMENT
2
3 return-statement → return expression opt 1 GRAMMAR OF A THROW STATEMENT
2
3 throw-statement → throw expression 1 GRAMMAR OF A DEFER STATEMENT
2
3 defer-statement → defer code-block 1 GRAMMAR OF A DO STATEMENT
2
3 do-statement → do code-block catch-clauses opt
4
5 catch-clauses → catch-clause catch-clauses opt
6
7 catch-clause → catch pattern opt where-clause opt code-block 1 GRAMMAR OF A COMPILER CONTROL STATEMENT
2
3 compiler-control-statement → conditional-compilation-block
4
5 compiler-control-statement → line-control-statement
6
7 compiler-control-statement → diagnostic-statement 1 GRAMMAR OF A CONDITIONAL COMPILATION BLOCK2 3 conditional-compilation-block → if-directive-clause elseif-directive-clauses opt else-directive-clause opt endif-directive4 5 if-directive-clause → if-directive compilation-condition statements opt6 7 elseif-directive-clauses → elseif-directive-clause elseif-directive-clauses opt8 9 elseif-directive-clause → elseif-directive compilation-condition statements opt
10
11 else-directive-clause → else-directive statements opt
12
13 if-directive → #if
14
15 elseif-directive → #elseif
16
17 else-directive → #else
18
19 endif-directive → #endif
20
21 compilation-condition → platform-condition
22
23 compilation-condition → identifier
24
25 compilation-condition → boolean-literal
26
27 compilation-condition → ( compilation-condition )
28
29 compilation-condition → ! compilation-condition
30
31 compilation-condition → compilation-condition compilation-condition
32
33 compilation-condition → compilation-condition || compilation-condition
34
35 platform-condition → os ( operating-system )
36
37 platform-condition → arch ( architecture )
38
39 platform-condition → swift ( swift-version )
40
41 platform-condition → compiler ( swift-version )
42
43 platform-condition → canImport ( module-name )
44
45 platform-condition → targetEnvironment ( environment )
46
47 operating-system → macOS | iOS | watchOS | tvOS
48
49 architecture → i386 | x86_64 | arm | arm64
50
51 swift-version → decimal-digits swift-version-continuation opt
52
53 swift-version-continuation → . decimal-digits swift-version-continuation opt
54
55 module-name → identifier
56
57 environment → simulator 1 GRAMMAR OF A LINE CONTROL STATEMENT
2
3 line-control-statement → #sourceLocation ( file: file-name , line: line-number )
4
5 line-control-statement → #sourceLocation ( )
6
7 line-number → A decimal integer greater than zero
8
9 file-name → static-string-literal 1 GRAMMAR OF A COMPILE-TIME DIAGNOSTIC STATEMENT
2
3 diagnostic-statement → #error ( diagnostic-message )
4
5 diagnostic-statement → #warning ( diagnostic-message )
6
7 diagnostic-message → static-string-literal 1 GRAMMAR OF AN AVAILABILITY CONDITION2 3 availability-condition → #available ( availability-arguments )4 5 availability-arguments → availability-argument | availability-argument , availability-arguments6 7 availability-argument → platform-name platform-version8 9 availability-argument → *
10
11 platform-name → iOS | iOSApplicationExtension
12
13 platform-name → macOS | macOSApplicationExtension
14
15 platform-name → watchOS
16
17 platform-name → tvOS
18
19 platform-version → decimal-digits
20
21 platform-version → decimal-digits . decimal-digits
22
23 platform-version → decimal-digits . decimal-digits . decimal-digits 声明 1 GRAMMAR OF A DECLARATION2 3 declaration → import-declaration4 5 declaration → constant-declaration6 7 declaration → variable-declaration8 9 declaration → typealias-declaration
10
11 declaration → function-declaration
12
13 declaration → enum-declaration
14
15 declaration → struct-declaration
16
17 declaration → class-declaration
18
19 declaration → protocol-declaration
20
21 declaration → initializer-declaration
22
23 declaration → deinitializer-declaration
24
25 declaration → extension-declaration
26
27 declaration → subscript-declaration
28
29 declaration → operator-declaration
30
31 declaration → precedence-group-declaration
32
33 declarations → declaration declarations opt 1 GRAMMAR OF A TOP-LEVEL DECLARATION
2
3 top-level-declaration → statements opt 1 GRAMMAR OF A CODE BLOCK
2
3 code-block → { statements opt } 1 GRAMMAR OF AN IMPORT DECLARATION
2
3 import-declaration → attributes opt import import-kind opt import-path
4
5 import-kind → typealias | struct | class | enum | protocol | let | var | func
6
7 import-path → import-path-identifier | import-path-identifier . import-path
8
9 import-path-identifier → identifier | operator 1 GRAMMAR OF A CONSTANT DECLARATION
2
3 constant-declaration → attributes opt declaration-modifiers opt let pattern-initializer-list
4
5 pattern-initializer-list → pattern-initializer | pattern-initializer , pattern-initializer-list
6
7 pattern-initializer → pattern initializer opt
8
9 initializer → expression 1 GRAMMAR OF A VARIABLE DECLARATION2 3 variable-declaration → variable-declaration-head pattern-initializer-list4 5 variable-declaration → variable-declaration-head variable-name type-annotation code-block6 7 variable-declaration → variable-declaration-head variable-name type-annotation getter-setter-block8 9 variable-declaration → variable-declaration-head variable-name type-annotation getter-setter-keyword-block
10
11 variable-declaration → variable-declaration-head variable-name initializer willSet-didSet-block
12
13 variable-declaration → variable-declaration-head variable-name type-annotation initializer opt willSet-didSet-block
14
15 variable-declaration-head → attributes opt declaration-modifiers opt var
16
17 variable-name → identifier
18
19 getter-setter-block → code-block
20
21 getter-setter-block → { getter-clause setter-clause opt }
22
23 getter-setter-block → { setter-clause getter-clause }
24
25 getter-clause → attributes opt mutation-modifier opt get code-block
26
27 setter-clause → attributes opt mutation-modifier opt set setter-name opt code-block
28
29 setter-name → ( identifier )
30
31 getter-setter-keyword-block → { getter-keyword-clause setter-keyword-clause opt }
32
33 getter-setter-keyword-block → { setter-keyword-clause getter-keyword-clause }
34
35 getter-keyword-clause → attributes opt mutation-modifier opt get
36
37 setter-keyword-clause → attributes opt mutation-modifier opt set
38
39 willSet-didSet-block → { willSet-clause didSet-clause opt }
40
41 willSet-didSet-block → { didSet-clause willSet-clause opt }
42
43 willSet-clause → attributes opt willSet setter-name opt code-block
44
45 didSet-clause → attributes opt didSet setter-name opt code-block 1 GRAMMAR OF A TYPE ALIAS DECLARATION
2
3 typealias-declaration → attributes opt access-level-modifier opt typealias typealias-name generic-parameter-clause opt typealias-assignment
4
5 typealias-name → identifier
6
7 typealias-assignment → type 1 GRAMMAR OF A FUNCTION DECLARATION2 3 function-declaration → function-head function-name generic-parameter-clause opt function-signature generic-where-clause opt function-body opt4 5 function-head → attributes opt declaration-modifiers opt func6 7 function-name → identifier | operator8 9 function-signature → parameter-clause throwsopt function-result opt
10
11 function-signature → parameter-clause rethrows function-result opt
12
13 function-result → - attributes opt type
14
15 function-body → code-block
16
17 parameter-clause → ( ) | ( parameter-list )
18
19 parameter-list → parameter | parameter , parameter-list
20
21 parameter → external-parameter-name opt local-parameter-name type-annotation default-argument-clause opt
22
23 parameter → external-parameter-name opt local-parameter-name type-annotation
24
25 parameter → external-parameter-name opt local-parameter-name type-annotation ...
26
27 external-parameter-name → identifier
28
29 local-parameter-name → identifier
30
31 default-argument-clause → expression 1 GRAMMAR OF AN ENUMERATION DECLARATION2 3 enum-declaration → attributes opt access-level-modifier opt union-style-enum4 5 enum-declaration → attributes opt access-level-modifier opt raw-value-style-enum6 7 union-style-enum → indirectopt enum enum-name generic-parameter-clause opt type-inheritance-clause opt generic-where-clause opt { union-style-enum-members opt }8 9 union-style-enum-members → union-style-enum-member union-style-enum-members opt
10
11 union-style-enum-member → declaration | union-style-enum-case-clause | compiler-control-statement
12
13 union-style-enum-case-clause → attributes opt indirectopt case union-style-enum-case-list
14
15 union-style-enum-case-list → union-style-enum-case | union-style-enum-case , union-style-enum-case-list
16
17 union-style-enum-case → enum-case-name tuple-type opt
18
19 enum-name → identifier
20
21 enum-case-name → identifier
22
23 raw-value-style-enum → enum enum-name generic-parameter-clause opt type-inheritance-clause generic-where-clause opt { raw-value-style-enum-members }
24
25 raw-value-style-enum-members → raw-value-style-enum-member raw-value-style-enum-members opt
26
27 raw-value-style-enum-member → declaration | raw-value-style-enum-case-clause | compiler-control-statement
28
29 raw-value-style-enum-case-clause → attributes opt case raw-value-style-enum-case-list
30
31 raw-value-style-enum-case-list → raw-value-style-enum-case | raw-value-style-enum-case , raw-value-style-enum-case-list
32
33 raw-value-style-enum-case → enum-case-name raw-value-assignment opt
34
35 raw-value-assignment → raw-value-literal
36
37 raw-value-literal → numeric-literal | static-string-literal | boolean-literal 1 GRAMMAR OF A STRUCTURE DECLARATION2 3 struct-declaration → attributes opt access-level-modifier opt struct struct-name generic-parameter-clause opt type-inheritance-clause opt generic-where-clause opt struct-body4 5 struct-name → identifier6 7 struct-body → { struct-members opt }8 9 struct-members → struct-member struct-members opt
10
11 struct-member → declaration | compiler-control-statement 1 GRAMMAR OF A CLASS DECLARATION2 3 class-declaration → attributes opt access-level-modifier opt finalopt class class-name generic-parameter-clause opt type-inheritance-clause opt generic-where-clause opt class-body4 5 class-declaration → attributes opt final access-level-modifier opt class class-name generic-parameter-clause opt type-inheritance-clause opt generic-where-clause opt class-body6 7 class-name → identifier8 9 class-body → { class-members opt }
10
11 class-members → class-member class-members opt
12
13 class-member → declaration | compiler-control-statement 1 GRAMMAR OF A PROTOCOL DECLARATION2 3 protocol-declaration → attributes opt access-level-modifier opt protocol protocol-name type-inheritance-clause opt generic-where-clause opt protocol-body4 5 protocol-name → identifier6 7 protocol-body → { protocol-members opt }8 9 protocol-members → protocol-member protocol-members opt
10
11 protocol-member → protocol-member-declaration | compiler-control-statement
12
13 protocol-member-declaration → protocol-property-declaration
14
15 protocol-member-declaration → protocol-method-declaration
16
17 protocol-member-declaration → protocol-initializer-declaration
18
19 protocol-member-declaration → protocol-subscript-declaration
20
21 protocol-member-declaration → protocol-associated-type-declaration
22
23 protocol-member-declaration → typealias-declaration 1 GRAMMAR OF A PROTOCOL PROPERTY DECLARATION
2
3 protocol-property-declaration → variable-declaration-head variable-name type-annotation getter-setter-keyword-block 1 GRAMMAR OF A PROTOCOL METHOD DECLARATION
2
3 protocol-method-declaration → function-head function-name generic-parameter-clause opt function-signature generic-where-clause opt 1 GRAMMAR OF A PROTOCOL INITIALIZER DECLARATION
2
3 protocol-initializer-declaration → initializer-head generic-parameter-clause opt parameter-clause throwsopt generic-where-clause opt
4
5 protocol-initializer-declaration → initializer-head generic-parameter-clause opt parameter-clause rethrows generic-where-clause opt 1 GRAMMAR OF A PROTOCOL SUBSCRIPT DECLARATION
2
3 protocol-subscript-declaration → subscript-head subscript-result generic-where-clause opt getter-setter-keyword-block 1 GRAMMAR OF A PROTOCOL ASSOCIATED TYPE DECLARATION
2
3 protocol-associated-type-declaration → attributes opt access-level-modifier opt associatedtype typealias-name type-inheritance-clause opt typealias-assignment opt generic-where-clause opt 1 GRAMMAR OF AN INITIALIZER DECLARATION2 3 initializer-declaration → initializer-head generic-parameter-clause opt parameter-clause throwsopt generic-where-clause opt initializer-body4 5 initializer-declaration → initializer-head generic-parameter-clause opt parameter-clause rethrows generic-where-clause opt initializer-body6 7 initializer-head → attributes opt declaration-modifiers opt init8 9 initializer-head → attributes opt declaration-modifiers opt init ?
10
11 initializer-head → attributes opt declaration-modifiers opt init !
12
13 initializer-body → code-block 1 GRAMMAR OF A DEINITIALIZER DECLARATION
2
3 deinitializer-declaration → attributes opt deinit code-block 1 GRAMMAR OF AN EXTENSION DECLARATION
2
3 extension-declaration → attributes opt access-level-modifier opt extension type-identifier type-inheritance-clause opt generic-where-clause opt extension-body
4
5 extension-body → { extension-members opt }
6
7 extension-members → extension-member extension-members opt
8
9 extension-member → declaration | compiler-control-statement 1 GRAMMAR OF A SUBSCRIPT DECLARATION2 3 subscript-declaration → subscript-head subscript-result generic-where-clause opt code-block4 5 subscript-declaration → subscript-head subscript-result generic-where-clause opt getter-setter-block6 7 subscript-declaration → subscript-head subscript-result generic-where-clause opt getter-setter-keyword-block8 9 subscript-head → attributes opt declaration-modifiers opt subscript generic-parameter-clause opt parameter-clause
10
11 subscript-result → - attributes opt type 1 GRAMMAR OF AN OPERATOR DECLARATION2 3 operator-declaration → prefix-operator-declaration | postfix-operator-declaration | infix-operator-declaration4 5 prefix-operator-declaration → prefix operator operator6 7 postfix-operator-declaration → postfix operator operator8 9 infix-operator-declaration → infix operator operator infix-operator-group opt
10
11 infix-operator-group → : precedence-group-name 1 GRAMMAR OF A PRECEDENCE GROUP DECLARATION2 3 precedence-group-declaration → precedencegroup precedence-group-name { precedence-group-attributes opt }4 5 precedence-group-attributes → precedence-group-attribute precedence-group-attributes opt6 7 precedence-group-attribute → precedence-group-relation8 9 precedence-group-attribute → precedence-group-assignment
10
11 precedence-group-attribute → precedence-group-associativity
12
13 precedence-group-relation → higherThan : precedence-group-names
14
15 precedence-group-relation → lowerThan : precedence-group-names
16
17 precedence-group-assignment → assignment : boolean-literal
18
19 precedence-group-associativity → associativity : left
20
21 precedence-group-associativity → associativity : right
22
23 precedence-group-associativity → associativity : none
24
25 precedence-group-names → precedence-group-name | precedence-group-name , precedence-group-names
26
27 precedence-group-name → identifier 1 GRAMMAR OF A DECLARATION MODIFIER2 3 declaration-modifier → class | convenience | dynamic | final | infix | lazy | optional | override | postfix | prefix | required | static | unowned | unowned ( safe ) | unowned ( unsafe ) | weak4 5 declaration-modifier → access-level-modifier6 7 declaration-modifier → mutation-modifier8 9 declaration-modifiers → declaration-modifier declaration-modifiers opt
10
11 access-level-modifier → private | private ( set )
12
13 access-level-modifier → fileprivate | fileprivate ( set )
14
15 access-level-modifier → internal | internal ( set )
16
17 access-level-modifier → public | public ( set )
18
19 access-level-modifier → open | open ( set )
20
21 mutation-modifier → mutating | nonmutating 属性 1 GRAMMAR OF AN ATTRIBUTE2 3 attribute → attribute-name attribute-argument-clause opt4 5 attribute-name → identifier6 7 attribute-argument-clause → ( balanced-tokens opt )8 9 attributes → attribute attributes opt
10
11 balanced-tokens → balanced-token balanced-tokens opt
12
13 balanced-token → ( balanced-tokens opt )
14
15 balanced-token → [ balanced-tokens opt ]
16
17 balanced-token → { balanced-tokens opt }
18
19 balanced-token → Any identifier, keyword, literal, or operator
20
21 balanced-token → Any punctuation except (, ), [, ], {, or } 模式 1 GRAMMAR OF A PATTERN2 3 pattern → wildcard-pattern type-annotation opt4 5 pattern → identifier-pattern type-annotation opt6 7 pattern → value-binding-pattern8 9 pattern → tuple-pattern type-annotation opt
10
11 pattern → enum-case-pattern
12
13 pattern → optional-pattern
14
15 pattern → type-casting-pattern
16
17 pattern → expression-pattern 1 GRAMMAR OF A WILDCARD PATTERN
2
3 wildcard-pattern → _ 1 GRAMMAR OF AN IDENTIFIER PATTERN
2
3 identifier-pattern → identifier 1 GRAMMAR OF A VALUE-BINDING PATTERN
2
3 value-binding-pattern → var pattern | let pattern 1 GRAMMAR OF A TUPLE PATTERN
2
3 tuple-pattern → ( tuple-pattern-element-list opt )
4
5 tuple-pattern-element-list → tuple-pattern-element | tuple-pattern-element , tuple-pattern-element-list
6
7 tuple-pattern-element → pattern | identifier : pattern 1 GRAMMAR OF AN ENUMERATION CASE PATTERN
2
3 enum-case-pattern → type-identifier opt . enum-case-name tuple-pattern opt 1 GRAMMAR OF AN OPTIONAL PATTERN
2
3 optional-pattern → identifier-pattern ? 1 GRAMMAR OF A TYPE CASTING PATTERN
2
3 type-casting-pattern → is-pattern | as-pattern
4
5 is-pattern → is type
6
7 as-pattern → pattern as type 1 GRAMMAR OF AN EXPRESSION PATTERN
2
3 expression-pattern → expression 泛型和参数 1 GRAMMAR OF A GENERIC PARAMETER CLAUSE2 3 generic-parameter-clause → generic-parameter-list 4 5 generic-parameter-list → generic-parameter | generic-parameter , generic-parameter-list6 7 generic-parameter → type-name8 9 generic-parameter → type-name : type-identifier
10
11 generic-parameter → type-name : protocol-composition-type
12
13 generic-where-clause → where requirement-list
14
15 requirement-list → requirement | requirement , requirement-list
16
17 requirement → conformance-requirement | same-type-requirement
18
19 conformance-requirement → type-identifier : type-identifier
20
21 conformance-requirement → type-identifier : protocol-composition-type
22
23 same-type-requirement → type-identifier type 1 GRAMMAR OF A GENERIC ARGUMENT CLAUSE
2
3 generic-argument-clause → generic-argument-list
4
5 generic-argument-list → generic-argument | generic-argument , generic-argument-list
6
7 generic-argument → type 转载于:https://www.cnblogs.com/strengthen/p/9740754.html