归档到目前的贡献者 (#881)
* 修改第二章部分细节 * update control flow * 调整 Functions 章节细节 * 重新整理翻译工作主要贡献者记录 * 更新贡献者记录文件 1. 移除与官方文档无关内容 2. 归档主要贡献者记录并附录在文档最后一页
This commit is contained in:
@ -1,17 +1,4 @@
|
||||
# 关于语言参考(About the Language Reference)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[dabing1022](https://github.com/dabing1022)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[KYawn](https://github.com/KYawn)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页内容包括:
|
||||
|
||||
- [如何阅读语法](#how_to_read_the_grammar)
|
||||
|
||||
|
||||
@ -1,32 +1,4 @@
|
||||
# 词法结构(Lexical Structure)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[superkam](https://github.com/superkam)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[buginux](https://github.com/buginux)
|
||||
|
||||
> 2.1
|
||||
> 翻译:[mmoaay](https://github.com/mmoaay)
|
||||
|
||||
> 2.2
|
||||
> 翻译+校对:[星夜暮晨](https://github.com/semperidem)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
- [空白与注释](#whitespace_and_comments)
|
||||
- [标识符](#identifiers)
|
||||
- [关键字和标点符号](#keywords)
|
||||
- [字面量](#literals)
|
||||
- [整数字面量](#integer_literals)
|
||||
- [浮点数字面量](#floating_point_literals)
|
||||
- [字符串字面量](#string_literals)
|
||||
- [运算符](#operators)
|
||||
|
||||
Swift 的*“词法结构(lexical structure)”* 描述了能构成该语言中有效符号(token)的字符序列。这些合法符号组成了语言中最底层的构建基块,并在之后的章节中用于描述语言的其他部分。一个合法符号由一个标识符(identifier)、关键字(keyword)、标点符号(punctuation)、字面量(literal)或运算符(operator)组成。
|
||||
|
||||
|
||||
@ -1,18 +1,4 @@
|
||||
# 类型(Types)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[lyuka](https://github.com/lyuka)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[EudeMorgen](https://github.com/EudeMorgen)
|
||||
|
||||
> 2.1
|
||||
> 翻译:[mmoaay](https://github.com/mmoaay)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
|
||||
@ -1,51 +1,4 @@
|
||||
# 表达式(Expressions)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[sg552](https://github.com/sg552)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[EudeMorgen](https://github.com/EudeMorgen)
|
||||
|
||||
> 2.1
|
||||
> 翻译:[mmoaay](https://github.com/mmoaay)
|
||||
|
||||
> 2.2
|
||||
> 校对:[175](https://github.com/Brian175)
|
||||
|
||||
> 3.0
|
||||
> 翻译+校对:[chenmingjia](https://github.com/chenmingjia)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
- [前缀表达式](#prefix_expressions)
|
||||
- [try 运算符](#try_operator)
|
||||
- [二元表达式](#binary_expressions)
|
||||
- [赋值表达式](#assignment_operator)
|
||||
- [三元条件运算符](#ternary_conditional_operator)
|
||||
- [类型转换运算符](#type-casting_operators)
|
||||
- [基本表达式](#primary_expressions)
|
||||
- [字面量表达式](#literal_expression)
|
||||
- [self 表达式](#self_expression)
|
||||
- [超类表达式](#superclass_expression)
|
||||
- [闭包表达式](#closure_expression)
|
||||
- [隐式成员表达式](#implicit_member_expression)
|
||||
- [圆括号表达式](#parenthesized_expression)
|
||||
- [通配符表达式](#wildcard_expression)
|
||||
- [选择器表达式](#selector_expression)
|
||||
- [后缀表达式](#postfix_expressions)
|
||||
- [函数调用表达式](#function_call_expression)
|
||||
- [构造器表达式](#initializer_expression)
|
||||
- [显式成员表达式](#explicit_member_expression)
|
||||
- [后缀 self 表达式](#postfix_self_expression)
|
||||
- [dynamicType 表达式](#dynamic_type_expression)
|
||||
- [下标表达式](#subscript_expression)
|
||||
- [强制取值表达式](#forced-Value_expression)
|
||||
- [可选链表达式](#optional-chaining_expression)
|
||||
|
||||
Swift 中存在四种表达式:前缀表达式,二元表达式,基本表达式和后缀表达式。表达式在返回一个值的同时还可以引发副作用。
|
||||
|
||||
|
||||
@ -1,46 +1,5 @@
|
||||
<a name="statement_statements"></a>
|
||||
# 语句(Statements)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[coverxit](https://github.com/coverxit)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb), [coverxit](https://github.com/coverxit), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[littledogboy](https://github.com/littledogboy)
|
||||
|
||||
> 2.2
|
||||
> 翻译:[chenmingbiao](https://github.com/chenmingbiao)
|
||||
|
||||
> 3.0
|
||||
> 翻译:[chenmingjia](https://github.com/chenmingjia)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
- [循环语句](#loop_statements)
|
||||
- [For-In 语句](#for-in_statements)
|
||||
- [While 语句](#while_statements)
|
||||
- [Repeat-While 语句](#repeat-while_statements)
|
||||
- [分支语句](#branch_statements)
|
||||
- [If 语句](#if_statements)
|
||||
- [Guard 语句](#guard_statements)
|
||||
- [Switch 语句](#switch_statements)
|
||||
- [带标签的语句](#labeled_statements)
|
||||
- [控制转移语句](#control_transfer_statements)
|
||||
- [Break 语句](#break_statement)
|
||||
- [Continue 语句](#continue_statement)
|
||||
- [Fallthrough 语句](#fallthrough_statements)
|
||||
- [Return 语句](#return_statements)
|
||||
- [Throw 语句](#throw_statements)
|
||||
- [Defer 语句](#defer_statements)
|
||||
- [Do 语句](#do_statements)
|
||||
- [编译器控制语句](#compiler_control_statements)
|
||||
- [编译配置语句](#build_config_statements)
|
||||
- [行控制语句](#line_control_statements)
|
||||
- [可用性条件](#availability_condition)
|
||||
|
||||
在 Swift 中,有三种类型的语句:简单语句、编译器控制语句和控制流语句。简单语句是最常见的,用于构造表达式或者声明。编译器控制语句允许程序改变编译器的行为,包含编译配置语句和行控制语句。
|
||||
|
||||
|
||||
@ -1,68 +1,5 @@
|
||||
<a name="declarations"></a>
|
||||
# 声明(Declarations)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[marsprince](https://github.com/marsprince) [Lenhoon](https://github.com/marsprince)[(微博)](http://www.weibo.com/lenhoon)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[Lenhoon](https://github.com/Lenhoon),
|
||||
> [BridgeQ](https://github.com/WXGBridgeQ)
|
||||
|
||||
> 2.1
|
||||
> 翻译:[mmoaay](https://github.com/mmoaay), [shanks](http://codebuild.me)
|
||||
> 校对:[shanks](http://codebuild.me)
|
||||
|
||||
> 2.2
|
||||
> 翻译:[星夜暮晨](https://github.com/SemperIdem)
|
||||
|
||||
> 3.0
|
||||
> 翻译:[chenmingjia](https://github.com/chenmingjia)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
- [顶级代码](#top-level_code)
|
||||
- [代码块](#code_blocks)
|
||||
- [导入声明](#import_declaration)
|
||||
- [常量声明](#constant_declaration)
|
||||
- [变量声明](#variable_declaration)
|
||||
- [存储型变量和存储型变量属性](#stored_variables_and_stored_variable_properties)
|
||||
- [计算型变量和计算型属性](#computed_variables_and_computed_properties)
|
||||
- [存储型变量和属性的观察器](#stored_variable_observers_and_property_observers)
|
||||
- [类型变量属性](#type_variable_properties)
|
||||
- [类型别名声明](#type_alias_declaration)
|
||||
- [函数声明](#function_declaration)
|
||||
- [参数名](#parameter_names)
|
||||
- [输入输出参数](#in-out_parameters)
|
||||
- [特殊参数](#special_kinds_of_parameters)
|
||||
- [特殊方法](#special_kinds_of_methods)
|
||||
- [抛出错误的函数和方法](#throwing_functions_and_methods)
|
||||
- [重抛错误的函数和方法](#rethrowing_functions_and_methods)
|
||||
- [枚举声明](#enumeration_declaration)
|
||||
- [任意类型的枚举用例](#enumerations_with_cases_of_any_type)
|
||||
- [递归枚举](#enumerations_with_indirection)
|
||||
- [拥有原始值的枚举用例](#enumerations_with_cases_of_a_raw-value_type)
|
||||
- [访问枚举用例](#accessing_enumeration_cases)
|
||||
- [结构体声明](#structure_declaration)
|
||||
- [类声明](#class_declaration)
|
||||
- [协议声明](#protocol_declaration)
|
||||
- [协议属性声明](#protocol_property_declaration)
|
||||
- [协议方法声明](#protocol_method_declaration)
|
||||
- [协议构造器声明](#protocol_initializer_declaration)
|
||||
- [协议下标声明](#protocol_subscript_declaration)
|
||||
- [协议关联类型声明](#protocol_associated_type_declaration)
|
||||
- [构造器声明](#initializer_declaration)
|
||||
- [可失败构造器](#failable_initializers)
|
||||
- [析构器声明](#deinitializer_declaration)
|
||||
- [扩展声明](#extension_declaration)
|
||||
- [下标声明](#subscript_declaration)
|
||||
- [运算符声明](#operator_declaration)
|
||||
- [声明修饰符](#declaration_modifiers)
|
||||
- [访问控制级别](#access_control_levels)
|
||||
|
||||
*声明(declaration)* 用以向程序里引入新的名字或者结构。举例来说,可以使用声明来引入函数和方法,变量和常量,或者定义新的具有命名的枚举、结构、类和协议类型。还可以使用声明来扩展一个既有的具有命名的类型的行为,或者在程序里引入在其它地方声明的符号。
|
||||
|
||||
|
||||
@ -1,24 +1,4 @@
|
||||
# 特性(Attributes)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[Hawstein](https://github.com/Hawstein)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[KYawn](https://github.com/KYawn)
|
||||
|
||||
> 2.1
|
||||
> 翻译:[小铁匠 Linus](https://github.com/kevin833752)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页内容包括:
|
||||
|
||||
- [声明特性](#declaration_attributes)
|
||||
- [Interface Builder 使用的声明特性](#declaration_attributes_used_by_interface_builder)
|
||||
- [类型特性](#type_attributes)
|
||||
|
||||
特性提供了有关声明和类型的更多信息。在 Swift 中有两种特性,分别用于修饰声明和类型。
|
||||
|
||||
|
||||
@ -1,29 +1,4 @@
|
||||
# 模式(Patterns)
|
||||
-----------------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[honghaoz](https://github.com/honghaoz)
|
||||
> 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[ray16897188](https://github.com/ray16897188),
|
||||
|
||||
> 2.1
|
||||
> 翻译:[BridgeQ](https://github.com/WXGBridgeQ)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页内容包括:
|
||||
|
||||
- [通配符模式(Wildcard Pattern)](#wildcard_pattern)
|
||||
- [标识符模式(Identifier Pattern)](#identifier_pattern)
|
||||
- [值绑定模式(Value-Binding Pattern)](#value-binding_pattern)
|
||||
- [元组模式(Tuple Pattern)](#tuple_pattern)
|
||||
- [枚举用例模式(Enumeration Case Pattern)](#enumeration_case_pattern)
|
||||
- [可选模式(Optional Pattern)](#optional_pattern)
|
||||
- [类型转换模式(Type-Casting Pattern)](#type-casting_patterns)
|
||||
- [表达式模式(Expression Pattern)](#expression_pattern)
|
||||
|
||||
*模式*代表单个值或者复合值的结构。例如,元组 `(1, 2)` 的结构是由逗号分隔的,包含两个元素的列表。因为模式代表一种值的结构,而不是特定的某个值,你可以利用模式来匹配各种各样的值。比如,`(x, y)` 可以匹配元组 `(1, 2)`,以及任何含两个元素的元组。除了利用模式匹配一个值以外,你可以从复合值中提取出部分或全部值,然后分别把各个部分的值和一个常量或变量绑定起来。
|
||||
|
||||
|
||||
@ -1,24 +1,4 @@
|
||||
# 泛型参数(Generic Parameters and Arguments)
|
||||
---------
|
||||
|
||||
> 1.0
|
||||
> 翻译:[fd5788](https://github.com/fd5788)
|
||||
> 校对:[yankuangshi](https://github.com/yankuangshi), [stanzhai](https://github.com/stanzhai)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[wardenNScaiyi](https:github.com/wardenNScaiyi)
|
||||
|
||||
> 3.0
|
||||
> 翻译+校对:[chenmingjia](https:github.com/chenmingjia)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
- [泛型形参子句](#generic_parameter)
|
||||
- [Where 子句](#where_clauses)
|
||||
- [泛型实参子句](#generic_argument)
|
||||
|
||||
本节涉及泛型类型、泛型函数以及泛型构造器的参数,包括形参和实参。声明泛型类型、函数或构造器时,须指定相应的类型参数。类型参数相当于一个占位符,当实例化泛型类型、调用泛型函数或泛型构造器时,就用具体的类型实参替代之。
|
||||
|
||||
|
||||
@ -1,26 +1,4 @@
|
||||
# 语法总结(Summary of the Grammar)
|
||||
-----
|
||||
|
||||
> 1.0
|
||||
> 翻译:[stanzhai](https://github.com/stanzhai)
|
||||
> 校对:[xielingwang](https://github.com/xielingwang)
|
||||
|
||||
> 2.0
|
||||
> 翻译+校对:[miaosiqi](https://github.com/miaosiqi)
|
||||
|
||||
> 4.1
|
||||
> 翻译+校对:[mylittleswift](https://github.com/mylittleswift)
|
||||
|
||||
本页包含内容:
|
||||
|
||||
* [语句(Statements)](#statements)
|
||||
* [泛型参数(Generic Parameters and Arguments)](#generic_parameters_and_arguments)
|
||||
* [声明(Declarations)](#declarations)
|
||||
* [模式(Patterns)](#patterns)
|
||||
* [属性(Attributes)](#attributes)
|
||||
* [表达式(Expressions)](#expressions)
|
||||
* [词法结构(Lexical Structure)](#lexical_structure)
|
||||
* [类型(Types)](#types)
|
||||
|
||||
<a name="statements"></a>
|
||||
## 语句
|
||||
|
||||
Reference in New Issue
Block a user