diff --git a/.DS_Store b/.DS_Store
deleted file mode 100644
index 5008ddfc..00000000
Binary files a/.DS_Store and /dev/null differ
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..e43b0f98
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
diff --git a/source/.DS_Store b/source/.DS_Store
deleted file mode 100755
index 85d5a50d..00000000
Binary files a/source/.DS_Store and /dev/null differ
diff --git a/source/README.md b/source/README.md
index c924f489..1f38eb67 100755
--- a/source/README.md
+++ b/source/README.md
@@ -1,5 +1,4 @@
-> Swift 兴趣交流群:307017261
-
+> Swift 兴趣交流群:307017261
> [Swift 开发者社区](http://swiftist.org)
@@ -27,42 +26,59 @@ lifedim说他平时12点就会睡,1点47分,发给我校对后的文档。
全体人员名单(排名不分先后):
-- numbbbbb
-- coverxit
-- wh1100717
-- TimothyYe
-- honghaoz
-- Hawstein
-- JaySurplus
-- stanzhai
-- lyuka
-- geek5nan
-- xielingwang
-- yankuangshi
-- dabing1022
-- siemenliu
-- fd5788
-- youkugems
-- haolloyin
-- superkam
-- vclwei
-- sg552
-- bzsy
-- pyanfield
-- ericzyh
-- 088haizi
-- viztor
-- pp-prog
-- baocaixiong
-- marsprince
-- shinyzhu
-- happyming
-- menlongsheng
-- zq54zquan
-- Evilcome
-- lslxdx
-- yeahdongcn
-- zqp
-- xiehurricane
-- Jasonbroker
-- aquaporcus
+- [numbbbbb](https://github.com/numbbbbb)
+- [stanzhai](https://github.com/stanzhai)
+- [coverxit](https://github.com/coverxit)
+- [wh1100717](https://github.com/wh1100717)
+- [TimothyYe](https://github.com/TimothyYe)
+- [honghaoz](https://github.com/honghaoz)
+- [lyuka](https://github.com/lyuka)
+- [JaySurplus](https://github.com/JaySurplus)
+- [Hawstein](https://github.com/Hawstein)
+- [geek5nan](https://github.com/geek5nan)
+- [yankuangshi](https://github.com/yankuangshi)
+- [xielingwang](https://github.com/xielingwang)
+- [yulingtianxia](https://github.com/yulingtianxia)
+- [twlkyao](https://github.com/twlkyao)
+- [dabing1022](https://github.com/dabing1022)
+- [vclwei](https://github.com/vclwei)
+- [fd5788](https://github.com/fd5788)
+- [siemenliu](https://github.com/siemenliu)
+- [youkugems](https://github.com/youkugems)
+- [haolloyin](https://github.com/haolloyin)
+- [wxstars](https://github.com/wxstars)
+- [IceskYsl](https://github.com/IceskYsl)
+- [sg552](https://github.com/sg552)
+- [superkam](https://github.com/superkam)
+- [zac1st1k](https://github.com/zac1st1k)
+- [bzsy](https://github.com/bzsy)
+- [pyanfield](https://github.com/pyanfield)
+- [ericzyh](https://github.com/ericzyh)
+- [peiyucn](https://github.com/peiyucn)
+- [sunfiled](https://github.com/sunfiled)
+- [lzw120](https://github.com/lzw120)
+- [viztor](https://github.com/viztor)
+- [wongzigii](https://github.com/wongzigii)
+- [umcsdon](https://github.com/umcsdon)
+- [zq54zquan](https://github.com/zq54zquan)
+- [xiehurricane](https://github.com/xiehurricane)
+- [Jasonbroker](https://github.com/Jasonbroker)
+- [tualatrix](https://github.com/tualatrix)
+- [pp-prog](https://github.com/pp-prog)
+- [088haizi](https://github.com/088haizi)
+- [baocaixiong](https://github.com/baocaixiong)
+- [yeahdongcn](https://github.com/yeahdongcn)
+- [shinyzhu](https://github.com/shinyzhu)
+- [lslxdx](https://github.com/lslxdx)
+- [Evilcome](https://github.com/Evilcome)
+- [zqp](https://github.com/zqp)
+- [NicePiao](https://github.com/NicePiao)
+- [LunaticM](https://github.com/LunaticM)
+- [menlongsheng](https://github.com/menlongsheng)
+- [lifedim](https://github.com/lifedim)
+- [happyming](https://github.com/happyming)
+- [bruce0505](https://github.com/bruce0505)
+- [Lin-H](https://github.com/Lin-H)
+- [takalard](https://github.com/takalard)
+- [ChildhoodAndy](https://github.com/ChildhoodAndy)
+- [marsprince](https://github.com/marsprince)
diff --git a/source/chapter2/04_Collection_Types.md b/source/chapter2/04_Collection_Types.md
index 267923c7..f8bd9710 100755
--- a/source/chapter2/04_Collection_Types.md
+++ b/source/chapter2/04_Collection_Types.md
@@ -1,5 +1,5 @@
-> 翻译:zqp
-> 校对:shinyzhu
+> 翻译:zqp
+> 校对:shinyzhu, stanzhai
# 集合类型 (Collection Types)
-----------------
@@ -14,7 +14,7 @@ Swift 语言提供经典的数组和字典两种集合类型来存储集合数
Swift 语言里的数组和字典中存储的数据值类型必须明确。 这意味着我们不能把不正确的数据类型插入其中。 同时这也说明我们完全可以对获取出的值类型非常自信。 Swift 对显式类型集合的使用确保了我们的代码对工作所需要的类型非常清楚,也让我们在开发中可以早早地找到任何的类型不匹配错误。
-> 注意:
+> 注意:
Swift 的数组结构在被声明成常量和变量或者被传入函数与方法中时会相对于其他类型展现出不同的特性。 获取更多信息请参见[集合的可变性](#mutability_of_collections)与[集合在赋值和复制中的行为](09_Classes_and_Structures.html#assignment_and_copy_behavior_for_collection_types)章节。
@@ -44,8 +44,8 @@ var shoppingList: String[] = ["Eggs", "Milk"]
`shoppingList`变量被声明为“字符串值类型的数组“,记作`String[]`。 因为这个数组被规定只有`String`一种数据结构,所以只有`String`类型可以在其中被存取。 在这里,`shoppinglist`数组由两个`String`值(`"Eggs"` 和`"Milk"`)构造,并且由字面量定义。
-> 注意:
-> `Shoppinglist`数组被声明为变量(`var`关键字创建)而不是常量(`let`创建)是因为以后可能会有更多的数据项被插入其中。
+> 注意:
+> `Shoppinglist`数组被声明为变量(`var`关键字创建)而不是常量(`let`创建)是因为以后可能会有更多的数据项被插入其中。
在这个例子中,字面量仅仅包含两个`String`值。匹配了该数组的变量声明(只能包含`String`的数组),所以这个字面量的分配过程就是允许用两个初始项来构造`shoppinglist`。
@@ -123,14 +123,8 @@ shoppingList[4...6] = ["Bananas", "Apples"]
// shoppingList 现在有六项
```
-<<<<<<< HEAD
-> 注意:
->我们不能使用下标语法在数组尾部添加新项。如果我们试着用这种方法对索引越界的数据进行检索或者设置新值的操作,我们会引发一个运行期错误。我们可以使用索引值和数组的`count`属性进行比较来在使用某个索引之前先检验是否有效。除了当`count`等于 0 时(说明这是个空数组),最大索引值一直是`count - 1`,因为数组都是零起索引。
-=======
-> 注意:
->
->我们不能使用下标语法在数组尾部添加新项。如果我们试着用这种方法对索引越界的数据进行检索或者设置新值的操作,我们会引发一个运行时错误。我们可以使用索引值和数组的`count`属性进行比较来在使用某个索引之前先检验是否有效。除了当`count`等于 0 时(说明这是个空数组),最大索引值一直是`count - 1`,因为数组都是零起索引。
->>>>>>> a516af6a531a104ec88da0d236ecf389a5ec72af
+> 注意:
+>我们不能使用下标语法在数组尾部添加新项。如果我们试着用这种方法对索引越界的数据进行检索或者设置新值的操作,我们会引发一个运行期错误。我们可以使用索引值和数组的`count`属性进行比较来在使用某个索引之前先检验是否有效。除了当`count`等于 0 时(说明这是个空数组),最大索引值一直是`count - 1`,因为数组都是零起索引。
调用数组的`insert(atIndex:)`方法来在某个具体索引值之前添加数据项:
@@ -271,8 +265,8 @@ var airports: Dictionary = ["TYO": "Tokyo", "DUB": "Dublin"]
`airports`字典被定义为一种`Dictionary`,它意味着这个字典的键和值都是`String`类型。
-> 注意:
-> `airports`字典被声明为变量(用`var`关键字)而不是常量(`let`关键字)因为后来更多的机场信息会被添加到这个示例字典中。
+> 注意:
+> `airports`字典被声明为变量(用`var`关键字)而不是常量(`let`关键字)因为后来更多的机场信息会被添加到这个示例字典中。
`airports`字典使用字典字面量初始化,包含两个键值对。第一对的键是`TYO`,值是`Tokyo`。第二对的键是`DUB`,值是`Dublin`。
@@ -364,6 +358,7 @@ for (airportCode, airportName) in airports {
// TYO: Tokyo
// LHR: London Heathrow
```
+
`for-in`循环请参见[For 循环](05_Control_Flow.html#for_loops)。
我们也可以通过访问它的`keys`或者`values`属性(都是可遍历集合)检索一个字典的键或者值:
@@ -374,9 +369,7 @@ for airportCode in airports.keys {
}
// Airport code: TYO
// Airport code: LHR
-```
-```swift
for airportName in airports.values {
println("Airport name: \(airportName)")
}
@@ -389,15 +382,13 @@ for airportName in airports.values {
```swift
let airportCodes = Array(airports.keys)
// airportCodes is ["TYO", "LHR"]
-```
-```swift
let airportNames = Array(airports.values)
// airportNames is ["Tokyo", "London Heathrow"]
```
-> 注意:
-> Swift 的字典类型是无序集合类型。其中字典键,值,键值对在遍历的时候会重新排列,而且其中顺序是不固定的。
+> 注意:
+> Swift 的字典类型是无序集合类型。其中字典键,值,键值对在遍历的时候会重新排列,而且其中顺序是不固定的。
### 创建一个空字典
@@ -420,8 +411,8 @@ namesOfIntegers = [:]
// namesOfIntegers 又成为了一个 Int, String类型的空字典
```
-> 注意:
-> 在后台,Swift 的数组和字典都是由泛型集合来实现的,想了解更多泛型和集合信息请参见[泛型](22_Generics.html)。
+> 注意:
+> 在后台,Swift 的数组和字典都是由泛型集合来实现的,想了解更多泛型和集合信息请参见[泛型](22_Generics.html)。
## 集合的可变性
@@ -433,6 +424,5 @@ namesOfIntegers = [:]
Swift 数组的可变性行为同时影响了数组实例如何被分配和修改,想获取更多信息,请参见[集合在赋值和复制中的行为](09_Classes_and_Structures.html#assignment_and_copy_behavior_for_collection_types)。
-> 注意:
-> 在我们不需要改变数组大小的时候创建不可变数组是很好的习惯。如此 Swift 编译器可以优化我们创建的集合。
-
+> 注意:
+> 在我们不需要改变数组大小的时候创建不可变数组是很好的习惯。如此 Swift 编译器可以优化我们创建的集合。
\ No newline at end of file
diff --git a/source/chapter3/09_Summary_of_the_Grammar.md b/source/chapter3/09_Summary_of_the_Grammar.md
index 0827d646..b8494427 100755
--- a/source/chapter3/09_Summary_of_the_Grammar.md
+++ b/source/chapter3/09_Summary_of_the_Grammar.md
@@ -1,5 +1,4 @@
-> 翻译:stanzhai
-
+> 翻译:stanzhai
> 校对:xielingwang
# 语法总结
@@ -28,7 +27,7 @@ _________________
> *语句* → [*控制转移语句*](..\chapter3\10_Statements.html#control_transfer_statement) **;** _可选_
> *多条语句(Statements)* → [*语句*](..\chapter3\10_Statements.html#statement) [*多条语句(Statements)*](..\chapter3\10_Statements.html#statements) _可选_
-
+
> 循环语句语法
> *循环语句* → [*for语句*](..\chapter3\10_Statements.html#for_statement)
@@ -36,43 +35,43 @@ _________________
> *循环语句* → [*while语句*](..\chapter3\10_Statements.html#wheetatype类型ile_statement)
> *循环语句* → [*do-while语句*](..\chapter3\10_Statements.html#do_while_statement)
-
+
> For 循环语法
> *for语句* → **for** [*for初始条件*](..\chapter3\10_Statements.html#for_init) _可选_ **;** [*表达式*](..\chapter3\04_Expressions.html#expression) _可选_ **;** [*表达式*](..\chapter3\04_Expressions.html#expression) _可选_ [*代码块*](..\chapter3\05_Declarations.html#code_block)
> *for语句* → **for** **(** [*for初始条件*](..\chapter3\10_Statements.html#for_init) _可选_ **;** [*表达式*](..\chapter3\04_Expressions.html#expression) _可选_ **;** [*表达式*](..\chapter3\04_Expressions.html#expression) _可选_ **)** [*代码块*](..\chapter3\05_Declarations.html#code_block)
> *for初始条件* → [*变量声明*](..\chapter3\05_Declarations.html#variable_declaration) | [*表达式列表*](..\chapter3\04_Expressions.html#expression_list)
-
+
> For-In 循环语法
> *for-in语句* → **for** [*模式*](..\chapter3\07_Patterns.html#pattern) **in** [*表达式*](..\chapter3\04_Expressions.html#expression) [*代码块*](..\chapter3\05_Declarations.html#code_block)
-
+
> While 循环语法
> *while语句* → **while** [*while条件*](..\chapter3\10_Statements.html#while_condition) [*代码块*](..\chapter3\05_Declarations.html#code_block)
> *while条件* → [*表达式*](..\chapter3\04_Expressions.html#expression) | [*声明*](..\chapter3\05_Declarations.html#declaration)
-
+
> Do-While 循环语法
> *do-while语句* → **do** [*代码块*](..\chapter3\05_Declarations.html#code_block) **while** [*while条件*](..\chapter3\10_Statements.html#while_condition)
-
+
> 分支语句语法
> *分支语句* → [*if语句*](..\chapter3\10_Statements.html#if_statement)
> *分支语句* → [*switch语句*](..\chapter3\10_Statements.html#switch_statement)
-
+
> If语句语法
> *if语句* → **if** [*if条件*](..\chapter3\10_Statements.html#if_condition) [*代码块*](..\chapter3\05_Declarations.html#code_block) [*else子句(Clause)*](..\chapter3\10_Statements.html#else_clause) _可选_
> *if条件* → [*表达式*](..\chapter3\04_Expressions.html#expression) | [*声明*](..\chapter3\05_Declarations.html#declaration)
> *else子句(Clause)* → **else** [*代码块*](..\chapter3\05_Declarations.html#code_block) | **else** [*if语句*](..\chapter3\10_Statements.html#if_statement)
-
+
> Switch语句语法
> *switch语句* → **switch** [*表达式*](..\chapter3\04_Expressions.html#expression) **{** [*SwitchCase列表*](..\chapter3\10_Statements.html#switch_cases) _可选_ **}**
@@ -85,14 +84,14 @@ _________________
> *guard-clause* → **where** [*guard-expression*](..\chapter3\10_Statements.html#guard_expression)
> *guard-expression* → [*表达式*](..\chapter3\04_Expressions.html#expression)
-
+
> 标记语句语法
> *标记语句(Labeled Statement)* → [*语句标签*](..\chapter3\10_Statements.html#statement_label) [*循环语句*](..\chapter3\10_Statements.html#loop_statement) | [*语句标签*](..\chapter3\10_Statements.html#statement_label) [*switch语句*](..\chapter3\10_Statements.html#switch_statement)
> *语句标签* → [*标签名称*](..\chapter3\10_Statements.html#label_name) **:**
> *标签名称* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
-
+
> 控制传递语句(Control Transfer Statement) 语法
> *控制传递语句* → [*break语句*](..\chapter3\10_Statements.html#break_statement)
@@ -100,22 +99,22 @@ _________________
> *控制传递语句* → [*fallthrough语句*](..\chapter3\10_Statements.html#fallthrough_statement)
> *控制传递语句* → [*return语句*](..\chapter3\10_Statements.html#return_statement)
-
+
> Break 语句语法
> *break语句* → **break** [*标签名称*](..\chapter3\10_Statements.html#label_name) _可选_
-
+
> Continue 语句语法
> *continue语句* → **continue** [*标签名称*](..\chapter3\10_Statements.html#label_name) _可选_
-
+
> Fallthrough 语句语法
> *fallthrough语句* → **fallthrough**
-
+
> Return 语句语法
> *return语句* → **return** [*表达式*](..\chapter3\04_Expressions.html#expression) _可选_
@@ -136,7 +135,7 @@ _________________
> *一致性约束* → [*类型标识*](..\chapter3\03_Types.html#type_identifier) **:** [*协议合成类型*](..\chapter3\03_Types.html#protocol_composition_type)
> *同类型约束* → [*类型标识*](..\chapter3\03_Types.html#type_identifier) **==** [*类型标识*](..\chapter3\03_Types.html#type_identifier)
-
+
> 泛型实参子句语法
> *(泛型参数子句Generic Argument Clause)* → **<** [*泛型参数列表*](GenericParametersAndArguments.html#generic_argument_list) **>**
@@ -165,17 +164,17 @@ _________________
> *声明描述符(Specifiers)列表* → [*声明描述符(Specifier)*](..\chapter3\05_Declarations.html#declaration_specifier) [*声明描述符(Specifiers)列表*](..\chapter3\05_Declarations.html#declaration_specifiers) _可选_
> *声明描述符(Specifier)* → **class** | **mutating** | **nonmutating** | **override** | **static** | **unowned** | **unowned(safe)** | **unowned(unsafe)** | **weak**
-
+
> 顶级(Top Level) 声明语法
> *顶级声明* → [*多条语句(Statements)*](..\chapter3\10_Statements.html#statements) _可选_
-
+
> 代码块语法
> *代码块* → **{** [*多条语句(Statements)*](..\chapter3\10_Statements.html#statements) _可选_ **}**
-
+
> 导入(Import)声明语法
> *导入声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **import** [*导入类型*](..\chapter3\05_Declarations.html#import_kind) _可选_ [*导入路径*](..\chapter3\05_Declarations.html#import_path)
@@ -183,7 +182,7 @@ _________________
> *导入路径* → [*导入路径标识符*](..\chapter3\05_Declarations.html#import_path_identifier) | [*导入路径标识符*](..\chapter3\05_Declarations.html#import_path_identifier) **.** [*导入路径*](..\chapter3\05_Declarations.html#import_path)
> *导入路径标识符* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier) | [*运算符*](..\chapter3\02_Lexical_Structure.html#operator)
-
+
> 常数声明语法
> *常量声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*声明描述符(Specifiers)列表*](..\chapter3\05_Declarations.html#declaration_specifiers) _可选_ **let** [*模式构造器列表*](..\chapter3\05_Declarations.html#pattern_initializer_list)
@@ -191,7 +190,7 @@ _________________
> *模式构造器* → [*模式*](..\chapter3\07_Patterns.html#pattern) [*构造器*](..\chapter3\05_Declarations.html#initializer) _可选_
> *构造器* → **=** [*表达式*](..\chapter3\04_Expressions.html#expression)
-
+
> 变量声明语法
> *变量声明* → [*变量声明头(Head)*](..\chapter3\05_Declarations.html#variable_declaration_head) [*模式构造器列表*](..\chapter3\05_Declarations.html#pattern_initializer_list)
@@ -215,7 +214,7 @@ _________________
> *willSet子句* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **willSet** [*setter名称*](..\chapter3\05_Declarations.html#setter_name) _可选_ [*代码块*](..\chapter3\05_Declarations.html#code_block)
> *didSet子句* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **didSet** [*setter名称*](..\chapter3\05_Declarations.html#setter_name) _可选_ [*代码块*](..\chapter3\05_Declarations.html#code_block)
-
+
> 类型别名声明语法
> *类型别名声明* → [*类型别名头(Head)*](..\chapter3\05_Declarations.html#typealias_head) [*类型别名赋值*](..\chapter3\05_Declarations.html#typealias_assignment)
@@ -223,7 +222,7 @@ _________________
> *类型别名名称* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
> *类型别名赋值* → **=** [*类型*](..\chapter3\03_Types.html#type)
-
+
> 函数声明语法
> *函数声明* → [*函数头*](..\chapter3\05_Declarations.html#function_head) [*函数名*](..\chapter3\05_Declarations.html#function_name) [*泛型参数子句*](GenericParametersAndArguments.html#generic_parameter_clause) _可选_ [*函数签名(Signature)*](..\chapter3\05_Declarations.html#function_signature) [*函数体*](..\chapter3\05_Declarations.html#function_body)
@@ -242,7 +241,7 @@ _________________
> *本地参数名* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier) | **_**
> *默认参数子句* → **=** [*表达式*](..\chapter3\04_Expressions.html#expression)
-
+
> 枚举声明语法
> *枚举声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*联合式枚举*](..\chapter3\05_Declarations.html#union_style_enum) | [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*原始值式枚举*](..\chapter3\05_Declarations.html#raw_value_style_enum)
@@ -262,21 +261,21 @@ _________________
> *原始值式枚举case* → [*枚举的case名*](..\chapter3\05_Declarations.html#enum_case_name) [*原始值赋值*](..\chapter3\05_Declarations.html#raw_value_assignment) _可选_
> *原始值赋值* → **=** [*字面量*](..\chapter3\02_Lexical_Structure.html#literal)
-
+
> 结构体声明语法
> *结构体声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **struct** [*结构体名称*](..\chapter3\05_Declarations.html#struct_name) [*泛型参数子句*](GenericParametersAndArguments.html#generic_parameter_clause) _可选_ [*类型继承子句*](..\chapter3\03_Types.html#type_inheritance_clause) _可选_ [*结构体主体*](..\chapter3\05_Declarations.html#struct_body)
> *结构体名称* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
> *结构体主体* → **{** [*声明(Declarations)列表*](..\chapter3\05_Declarations.html#declarations) _可选_ **}**
-
+
> 类声明语法
> *类声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **class** [*类名*](..\chapter3\05_Declarations.html#class_name) [*泛型参数子句*](GenericParametersAndArguments.html#generic_parameter_clause) _可选_ [*类型继承子句*](..\chapter3\03_Types.html#type_inheritance_clause) _可选_ [*类主体*](..\chapter3\05_Declarations.html#class_body)
> *类名* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
> *类主体* → **{** [*声明(Declarations)列表*](..\chapter3\05_Declarations.html#declarations) _可选_ **}**
-
+
> 协议(Protocol)声明语法
> *协议声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **protocol** [*协议名*](..\chapter3\05_Declarations.html#protocol_name) [*类型继承子句*](..\chapter3\03_Types.html#type_inheritance_clause) _可选_ [*协议主体*](..\chapter3\05_Declarations.html#protocol_body)
@@ -289,50 +288,50 @@ _________________
> *协议成员声明* → [*协议关联类型声明*](..\chapter3\05_Declarations.html#protocol_associated_type_declaration)
> *协议成员声明(Declarations)列表* → [*协议成员声明*](..\chapter3\05_Declarations.html#protocol_member_declaration) [*协议成员声明(Declarations)列表*](..\chapter3\05_Declarations.html#protocol_member_declarations) _可选_
-
+
> 协议属性声明语法
> *协议属性声明* → [*变量声明头(Head)*](..\chapter3\05_Declarations.html#variable_declaration_head) [*变量名*](..\chapter3\05_Declarations.html#variable_name) [*类型注解*](..\chapter3\03_Types.html#type_annotation) [*getter-setter关键字(Keyword)块*](..\chapter3\05_Declarations.html#getter_setter_keyword_block)
-
+
> 协议方法声明语法
> *协议方法声明* → [*函数头*](..\chapter3\05_Declarations.html#function_head) [*函数名*](..\chapter3\05_Declarations.html#function_name) [*泛型参数子句*](GenericParametersAndArguments.html#generic_parameter_clause) _可选_ [*函数签名(Signature)*](..\chapter3\05_Declarations.html#function_signature)
-
+
> 协议构造器声明语法
> *协议构造器声明* → [*构造器头(Head)*](..\chapter3\05_Declarations.html#initializer_head) [*泛型参数子句*](GenericParametersAndArguments.html#generic_parameter_clause) _可选_ [*参数子句*](..\chapter3\05_Declarations.html#parameter_clause)
-
+
> 协议下标脚本声明语法
> *协议下标脚本声明* → [*下标脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*下标脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*getter-setter关键字(Keyword)块*](..\chapter3\05_Declarations.html#getter_setter_keyword_block)
-
+
> 协议关联类型声明语法
> *协议关联类型声明* → [*类型别名头(Head)*](..\chapter3\05_Declarations.html#typealias_head) [*类型继承子句*](..\chapter3\03_Types.html#type_inheritance_clause) _可选_ [*类型别名赋值*](..\chapter3\05_Declarations.html#typealias_assignment) _可选_
-
+
> 构造器声明语法
> *构造器声明* → [*构造器头(Head)*](..\chapter3\05_Declarations.html#initializer_head) [*泛型参数子句*](GenericParametersAndArguments.html#generic_parameter_clause) _可选_ [*参数子句*](..\chapter3\05_Declarations.html#parameter_clause) [*构造器主体*](..\chapter3\05_Declarations.html#initializer_body)
> *构造器头(Head)* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **convenience** _可选_ **init**
> *构造器主体* → [*代码块*](..\chapter3\05_Declarations.html#code_block)
-
+
> 析构器声明语法
> *析构器声明* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **deinit** [*代码块*](..\chapter3\05_Declarations.html#code_block)
-
+
> 扩展(Extension)声明语法
> *扩展声明* → **extension** [*类型标识*](..\chapter3\03_Types.html#type_identifier) [*类型继承子句*](..\chapter3\03_Types.html#type_inheritance_clause) _可选_ [*extension-body*](..\chapter3\05_Declarations.html#extension_body)
> *extension-body* → **{** [*声明(Declarations)列表*](..\chapter3\05_Declarations.html#declarations) _可选_ **}**
-
+
> 下标脚本声明语法
> *下标脚本声明* → [*下标脚本头(Head)*](..\chapter3\05_Declarations.html#subscript_head) [*下标脚本结果(Result)*](..\chapter3\05_Declarations.html#subscript_result) [*代码块*](..\chapter3\05_Declarations.html#code_block)
@@ -341,7 +340,7 @@ _________________
> *下标脚本头(Head)* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **subscript** [*参数子句*](..\chapter3\05_Declarations.html#parameter_clause)
> *下标脚本结果(Result)* → **->** [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*类型*](..\chapter3\03_Types.html#type)
-
+
> 运算符声明语法
> *运算符声明* → [*前置运算符声明*](..\chapter3\05_Declarations.html#prefix_operator_declaration) | [*后置运算符声明*](..\chapter3\05_Declarations.html#postfix_operator_declaration) | [*中置运算符声明*](..\chapter3\05_Declarations.html#infix_operator_declaration)
@@ -366,41 +365,41 @@ _________________
> *模式* → [*type-casting-pattern*](..\chapter3\07_Patterns.html#type_casting_pattern)
> *模式* → [*表达式模式*](..\chapter3\07_Patterns.html#expression_pattern)
-
+
> 通配符模式语法
> *通配符模式* → **_**
-
+
> 标识符模式语法
> *标识符模式* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
-
+
> 值绑定(Value Binding)模式语法
> *值绑定模式* → **var** [*模式*](..\chapter3\07_Patterns.html#pattern) | **let** [*模式*](..\chapter3\07_Patterns.html#pattern)
-
+
> 元组模式语法
> *元组模式* → **(** [*元组模式元素列表*](..\chapter3\07_Patterns.html#tuple_pattern_element_list) _可选_ **)**
> *元组模式元素列表* → [*元组模式元素*](..\chapter3\07_Patterns.html#tuple_pattern_element) | [*元组模式元素*](..\chapter3\07_Patterns.html#tuple_pattern_element) **,** [*元组模式元素列表*](..\chapter3\07_Patterns.html#tuple_pattern_element_list)
> *元组模式元素* → [*模式*](..\chapter3\07_Patterns.html#pattern)
-
+
> 枚举用例模式语法
> *enum-case-pattern* → [*类型标识*](..\chapter3\03_Types.html#type_identifier) _可选_ **.** [*枚举的case名*](..\chapter3\05_Declarations.html#enum_case_name) [*元组模式*](..\chapter3\07_Patterns.html#tuple_pattern) _可选_
-
+
> 类型转换模式语法
> *type-casting-pattern* → [*is模式*](..\chapter3\07_Patterns.html#is_pattern) | [*as模式*](..\chapter3\07_Patterns.html#as_pattern)
> *is模式* → **is** [*类型*](..\chapter3\03_Types.html#type)
> *as模式* → [*模式*](..\chapter3\07_Patterns.html#pattern) **as** [*类型*](..\chapter3\03_Types.html#type)
-
+
> 表达式模式语法
> *表达式模式* → [*表达式*](..\chapter3\04_Expressions.html#expression)
@@ -427,14 +426,14 @@ _________________
> *表达式* → [*前置表达式*](..\chapter3\04_Expressions.html#prefix_expression) [*二元表达式列表*](..\chapter3\04_Expressions.html#binary_expressions) _可选_
> *表达式列表* → [*表达式*](..\chapter3\04_Expressions.html#expression) | [*表达式*](..\chapter3\04_Expressions.html#expression) **,** [*表达式列表*](..\chapter3\04_Expressions.html#expression_list)
-
+
> 前置表达式语法
> *前置表达式* → [*前置运算符*](..\chapter3\02_Lexical_Structure.html#prefix_operator) _可选_ [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression)
> *前置表达式* → [*写入写出(in-out)表达式*](..\chapter3\04_Expressions.html#in_out_expression)
> *写入写出(in-out)表达式* → **&** [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
-
+
> 二元表达式语法
> *二元表达式* → [*二元运算符*](..\chapter3\02_Lexical_Structure.html#binary_operator) [*前置表达式*](..\chapter3\04_Expressions.html#prefix_expression)
@@ -443,22 +442,22 @@ _________________
> *二元表达式* → [*类型转换运算符*](..\chapter3\04_Expressions.html#type_casting_operator)
> *二元表达式列表* → [*二元表达式*](..\chapter3\04_Expressions.html#binary_expression) [*二元表达式列表*](..\chapter3\04_Expressions.html#binary_expressions) _可选_
-
+
> 赋值运算符语法
> *赋值运算符* → **=**
-
+
> 三元条件运算符语法
> *三元条件运算符* → **?** [*表达式*](..\chapter3\04_Expressions.html#expression) **:**
-
+
> 类型转换运算符语法
> *类型转换运算符* → **is** [*类型*](..\chapter3\03_Types.html#type) | **as** **?** _可选_ [*类型*](..\chapter3\03_Types.html#type)
-
+
> 主表达式语法
> *主表达式* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier) [*泛型参数子句*](GenericParametersAndArguments.html#generic_argument_clause) _可选_
@@ -470,7 +469,7 @@ _________________
> *主表达式* → [*隐式成员表达式*](..\chapter3\04_Expressions.html#implicit_member_expression)
> *主表达式* → [*通配符表达式*](..\chapter3\04_Expressions.html#wildcard_expression)
-
+
> 字面量表达式语法
> *字面量表达式* → [*字面量*](..\chapter3\02_Lexical_Structure.html#literal)
@@ -483,7 +482,7 @@ _________________
> *字典字面量项列表* → [*字典字面量项*](..\chapter3\04_Expressions.html#dictionary_literal_item) **,** _可选_ | [*字典字面量项*](..\chapter3\04_Expressions.html#dictionary_literal_item) **,** [*字典字面量项列表*](..\chapter3\04_Expressions.html#dictionary_literal_items)
> *字典字面量项* → [*表达式*](..\chapter3\04_Expressions.html#expression) **:** [*表达式*](..\chapter3\04_Expressions.html#expression)
-
+
> Self 表达式语法
> *self表达式* → **self**
@@ -491,7 +490,7 @@ _________________
> *self表达式* → **self** **[** [*表达式*](..\chapter3\04_Expressions.html#expression) **]**
> *self表达式* → **self** **.** **init**
-
+
> 超类表达式语法
> *超类表达式* → [*超类方法表达式*](..\chapter3\04_Expressions.html#superclass_method_expression) | [*超类下标表达式*](..\chapter3\04_Expressions.html#超类下标表达式) | [*超类构造器表达式*](..\chapter3\04_Expressions.html#superclass_initializer_expression)
@@ -499,7 +498,7 @@ _________________
> *超类下标表达式* → **super** **[** [*表达式*](..\chapter3\04_Expressions.html#expression) **]**
> *超类构造器表达式* → **super** **.** **init**
-
+
> 闭包表达式语法
> *闭包表达式* → **{** [*闭包签名(Signational)*](..\chapter3\04_Expressions.html#closure_signature) _可选_ [*多条语句(Statements)*](..\chapter3\10_Statements.html#statements) **}**
@@ -511,24 +510,24 @@ _________________
> *捕获(Capature)列表* → **[** [*捕获(Capature)说明符*](..\chapter3\04_Expressions.html#capture_specifier) [*表达式*](..\chapter3\04_Expressions.html#expression) **]**
> *捕获(Capature)说明符* → **weak** | **unowned** | **unowned(safe)** | **unowned(unsafe)**
-
+
> 隐式成员表达式语法
> *隐式成员表达式* → **.** [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
-
+
> 圆括号表达式(Parenthesized Expression)语法
> *圆括号表达式* → **(** [*表达式元素列表*](..\chapter3\04_Expressions.html#expression_element_list) _可选_ **)**
> *表达式元素列表* → [*表达式元素*](..\chapter3\04_Expressions.html#expression_element) | [*表达式元素*](..\chapter3\04_Expressions.html#expression_element) **,** [*表达式元素列表*](..\chapter3\04_Expressions.html#expression_element_list)
> *表达式元素* → [*表达式*](..\chapter3\04_Expressions.html#expression) | [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier) **:** [*表达式*](..\chapter3\04_Expressions.html#expression)
-
+
> 通配符表达式语法
> *通配符表达式* → **_**
-
+
> 后置表达式语法
> *后置表达式* → [*主表达式*](..\chapter3\04_Expressions.html#primary_expression)
@@ -542,45 +541,45 @@ _________________
> *后置表达式* → [*强制取值(Forced Value)表达式*](..\chapter3\04_Expressions.html#forced_value_expression)
> *后置表达式* → [*可选链(Optional Chaining)表达式*](..\chapter3\04_Expressions.html#optional_chaining_expression)
-
+
> 函数调用表达式语法
> *函数调用表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) [*圆括号表达式*](..\chapter3\04_Expressions.html#parenthesized_expression)
> *函数调用表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) [*圆括号表达式*](..\chapter3\04_Expressions.html#parenthesized_expression) _可选_ [*后置闭包(Trailing Closure)*](..\chapter3\04_Expressions.html#trailing_closure)
> *后置闭包(Trailing Closure)* → [*闭包表达式*](..\chapter3\04_Expressions.html#closure_expression)
-
+
> 构造器表达式语法
> *构造器表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **.** **init**
-
+
> 显式成员表达式语法
> *显示成员表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **.** [*十进制数字*](..\chapter3\02_Lexical_Structure.html#decimal_digit)
> *显示成员表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **.** [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier) [*泛型参数子句*](GenericParametersAndArguments.html#generic_argument_clause) _可选_
-
+
> 后置Self 表达式语法
> *后置self表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **.** **self**
-
+
> 动态类型表达式语法
> *动态类型表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **.** **dynamicType**
-
+
> 附属脚本表达式语法
> *附属脚本表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **[** [*表达式列表*](..\chapter3\04_Expressions.html#expression_list) **]**
-
+
> 强制取值(Forced Value)语法
> *强制取值(Forced Value)表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **!**
-
+
> 可选链表达式语法
> *可选链表达式* → [*后置表达式*](..\chapter3\04_Expressions.html#postfix_expression) **?**
@@ -614,12 +613,12 @@ _________________
> *标识符字符列表* → [*标识符字符*](..\chapter3\02_Lexical_Structure.html#identifier_character) [*标识符字符列表*](..\chapter3\02_Lexical_Structure.html#identifier_characters) _可选_
> *隐式参数名* → **$** [*十进制数字列表*](..\chapter3\02_Lexical_Structure.html#decimal_digits)
-
+
> 字面量语法
> *字面量* → [*整型字面量*](..\chapter3\02_Lexical_Structure.html#integer_literal) | [*浮点数字面量*](..\chapter3\02_Lexical_Structure.html#floating_point_literal) | [*字符串字面量*](..\chapter3\02_Lexical_Structure.html#string_literal)
-
+
> 整型字面量语法
> *整型字面量* → [*二进制字面量*](..\chapter3\02_Lexical_Structure.html#binary_literal)
@@ -644,7 +643,7 @@ _________________
> *十六进制字符* → [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) | **_**
> *十六进制字面量字符列表* → [*十六进制字符*](..\chapter3\02_Lexical_Structure.html#hexadecimal_literal_character) [*十六进制字面量字符列表*](..\chapter3\02_Lexical_Structure.html#hexadecimal_literal_characters) _可选_
-
+
> 浮点型字面量语法
> *浮点数字面量* → [*十进制字面量*](..\chapter3\02_Lexical_Structure.html#decimal_literal) [*十进制分数*](..\chapter3\02_Lexical_Structure.html#decimal_fraction) _可选_ [*十进制指数*](..\chapter3\02_Lexical_Structure.html#decimal_exponent) _可选_
@@ -657,7 +656,7 @@ _________________
> *浮点数p* → **p** | **P**
> *正负号* → **+** | **-**
-
+
> 字符型字面量语法
> *字符串字面量* → **"** [*引用文本*](..\chapter3\02_Lexical_Structure.html#quoted_text) **"**
@@ -670,7 +669,7 @@ _________________
> *转义字符* → **\u** [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit)
> *转义字符* → **\U** [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit) [*十六进制数字*](..\chapter3\02_Lexical_Structure.html#hexadecimal_digit)
-
+
> 运算符语法语法
> *运算符* → [*运算符字符*](..\chapter3\02_Lexical_Structure.html#operator_character) [*运算符*](..\chapter3\02_Lexical_Structure.html#operator) _可选_
@@ -685,18 +684,18 @@ _________________
> 类型语法
> *类型* → [*数组类型*](..\chapter3\03_Types.html#array_type) | [*函数类型*](..\chapter3\03_Types.html#function_type) | [*类型标识*](..\chapter3\03_Types.html#type_identifier) | [*元组类型*](..\chapter3\03_Types.html#tuple_type) | [*可选类型*](..\chapter3\03_Types.html#optional_type) | [*隐式解析可选类型*](..\chapter3\03_Types.html#implicitly_unwrapped_optional_type) | [*协议合成类型*](..\chapter3\03_Types.html#protocol_composition_type) | [*元型类型*](..\chapter3\03_Types.html#metatype_type)
-
+
> 类型注解语法
> *类型注解* → **:** [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ [*类型*](..\chapter3\03_Types.html#type)
-
+
> 类型标识语法
> *类型标识* → [*类型名称*](..\chapter3\03_Types.html#type_name) [*泛型参数子句*](GenericParametersAndArguments.html#generic_argument_clause) _可选_ | [*类型名称*](..\chapter3\03_Types.html#type_name) [*泛型参数子句*](GenericParametersAndArguments.html#generic_argument_clause) _可选_ **.** [*类型标识*](..\chapter3\03_Types.html#type_identifier)
> *类名* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
-
+
> 元组类型语法
> *元组类型* → **(** [*元组类型主体*](..\chapter3\03_Types.html#tuple_type_body) _可选_ **)**
@@ -705,39 +704,39 @@ _________________
> *元组类型的元素* → [*特性(Attributes)列表*](..\chapter3\06_Attributes.html#attributes) _可选_ **inout** _可选_ [*类型*](..\chapter3\03_Types.html#type) | **inout** _可选_ [*元素名*](..\chapter3\03_Types.html#element_name) [*类型注解*](..\chapter3\03_Types.html#type_annotation)
> *元素名* → [*标识符*](..\chapter3\02_Lexical_Structure.html#identifier)
-
+
> 函数类型语法
> *函数类型* → [*类型*](..\chapter3\03_Types.html#type) **->** [*类型*](..\chapter3\03_Types.html#type)
-
+
> 数组类型语法
> *数组类型* → [*类型*](..\chapter3\03_Types.html#type) **[** **]** | [*数组类型*](..\chapter3\03_Types.html#array_type) **[** **]**
-
+
> 可选类型语法
> *可选类型* → [*类型*](..\chapter3\03_Types.html#type) **?**
-
+
> 隐式解析可选类型(Implicitly Unwrapped Optional Type)语法
> *隐式解析可选类型* → [*类型*](..\chapter3\03_Types.html#type) **!**
-
+
> 协议合成类型语法
> *协议合成类型* → **protocol** **<** [*协议标识符列表*](..\chapter3\03_Types.html#protocol_identifier_list) _可选_ **>**
> *协议标识符列表* → [*协议标识符*](..\chapter3\03_Types.html#protocol_identifier) | [*协议标识符*](..\chapter3\03_Types.html#protocol_identifier) **,** [*协议标识符列表*](..\chapter3\03_Types.html#protocol_identifier_list)
> *协议标识符* → [*类型标识*](..\chapter3\03_Types.html#type_identifier)
-
+
> 元(Metatype)类型语法
> *元类型* → [*类型*](..\chapter3\03_Types.html#type) **.** **Type** | [*类型*](..\chapter3\03_Types.html#type) **.** **Protocol**
-
+
> 类型继承子句语法
> *类型继承子句* → **:** [*类型继承列表*](..\chapter3\03_Types.html#type_inheritance_list)