Skip to content

Commit 1a7ae03

Browse files
authored
Merge pull request #1714 from ahoppen/ahoppen/line-length
Reduce line-length to 160 characters
2 parents 873cbce + 9626030 commit 1a7ae03

File tree

55 files changed

+520
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+520
-128
lines changed

.swift-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 1,
3-
"lineLength": 1000,
3+
"lineLength": 160,
44
"indentation": {
55
"spaces": 2
66
},

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,13 @@ public let ATTRIBUTE_NODES: [Node] = [
298298
children: [
299299
Child(
300300
name: "DeclBaseName",
301-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "BinaryOperatorToken"), .keyword(text: "init"), .keyword(text: "self"), .keyword(text: "Self")]),
301+
kind: .token(choices: [
302+
.token(tokenKind: "IdentifierToken"),
303+
.token(tokenKind: "BinaryOperatorToken"),
304+
.keyword(text: "init"),
305+
.keyword(text: "self"),
306+
.keyword(text: "Self"),
307+
]),
302308
nameForDiagnostics: "base name",
303309
documentation: "The base name of the protocol's requirement."
304310
),
@@ -322,7 +328,8 @@ public let ATTRIBUTE_NODES: [Node] = [
322328
kind: .derivativeRegistrationAttributeArguments,
323329
base: .syntax,
324330
nameForDiagnostics: "attribute arguments",
325-
documentation: "The arguments for the '@derivative(of:)' and '@transpose(of:)' attributes: the 'of:' label, the original declaration name, and an optional differentiability parameter list.",
331+
documentation:
332+
"The arguments for the '@derivative(of:)' and '@transpose(of:)' attributes: the 'of:' label, the original declaration name, and an optional differentiability parameter list.",
326333
children: [
327334
Child(
328335
name: "OfLabel",
@@ -461,7 +468,8 @@ public let ATTRIBUTE_NODES: [Node] = [
461468
kind: .differentiableAttributeArguments,
462469
base: .syntax,
463470
nameForDiagnostics: "'@differentiable' arguments",
464-
documentation: "The arguments for the `@differentiable` attribute: an optional differentiability kind, an optional differentiability parameter clause, and an optional 'where' clause.",
471+
documentation:
472+
"The arguments for the `@differentiable` attribute: an optional differentiability kind, an optional differentiability parameter clause, and an optional 'where' clause.",
465473
children: [
466474
Child(
467475
name: "DiffKind",
@@ -515,7 +523,14 @@ public let ATTRIBUTE_NODES: [Node] = [
515523
kind: .nodeChoices(choices: [
516524
Child(
517525
name: "Token",
518-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "private"), .keyword(text: "fileprivate"), .keyword(text: "internal"), .keyword(text: "public"), .keyword(text: "open")])
526+
kind: .token(choices: [
527+
.token(tokenKind: "IdentifierToken"),
528+
.keyword(text: "private"),
529+
.keyword(text: "fileprivate"),
530+
.keyword(text: "internal"),
531+
.keyword(text: "public"),
532+
.keyword(text: "open"),
533+
])
519534
), // Keywords can be: public, internal, private, fileprivate, open
520535
Child(
521536
name: "String",
@@ -670,7 +685,8 @@ public let ATTRIBUTE_NODES: [Node] = [
670685
kind: .objCSelectorPiece,
671686
base: .syntax,
672687
nameForDiagnostics: "Objective-C selector piece",
673-
documentation: "A piece of an Objective-C selector. Either consisting of just an identifier for a nullary selector, an identifier and a colon for a labeled argument or just a colon for an unlabeled argument",
688+
documentation:
689+
"A piece of an Objective-C selector. Either consisting of just an identifier for a nullary selector, an identifier and a colon for a labeled argument or just a colon for an unlabeled argument",
674690
children: [
675691
Child(
676692
name: "Name",
@@ -776,7 +792,13 @@ public let ATTRIBUTE_NODES: [Node] = [
776792
),
777793
Child(
778794
name: "Name",
779-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "self"), .keyword(text: "Self"), .keyword(text: "init"), .token(tokenKind: "BinaryOperatorToken")]),
795+
kind: .token(choices: [
796+
.token(tokenKind: "IdentifierToken"),
797+
.keyword(text: "self"),
798+
.keyword(text: "Self"),
799+
.keyword(text: "init"),
800+
.token(tokenKind: "BinaryOperatorToken"),
801+
]),
780802
nameForDiagnostics: "base name",
781803
documentation: "The base name of the referenced function."
782804
),

CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ public let AVAILABILITY_NODES: [Node] = [
2727
kind: .nodeChoices(choices: [
2828
Child(
2929
name: "Token",
30-
kind: .token(choices: [.token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false)
30+
kind: .token(
31+
choices: [.token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "IdentifierToken")],
32+
requiresLeadingSpace: false,
33+
requiresTrailingSpace: false
34+
)
3135
),
3236
Child(
3337
name: "AvailabilityVersionRestriction",
@@ -59,7 +63,13 @@ public let AVAILABILITY_NODES: [Node] = [
5963
children: [
6064
Child(
6165
name: "Label",
62-
kind: .token(choices: [.keyword(text: "message"), .keyword(text: "renamed"), .keyword(text: "introduced"), .keyword(text: "obsoleted"), .keyword(text: "deprecated")]),
66+
kind: .token(choices: [
67+
.keyword(text: "message"),
68+
.keyword(text: "renamed"),
69+
.keyword(text: "introduced"),
70+
.keyword(text: "obsoleted"),
71+
.keyword(text: "deprecated"),
72+
]),
6373
nameForDiagnostics: "label",
6474
documentation: "The label of the argument"
6575
),
@@ -106,7 +116,8 @@ public let AVAILABILITY_NODES: [Node] = [
106116
name: "Platform",
107117
kind: .token(choices: [.token(tokenKind: "IdentifierToken")]),
108118
nameForDiagnostics: "platform",
109-
documentation: "The name of the OS on which the availability should be restricted or 'swift' if the availability should be restricted based on a Swift version.",
119+
documentation:
120+
"The name of the OS on which the availability should be restricted or 'swift' if the availability should be restricted based on a Swift version.",
110121
classification: "Keyword"
111122
),
112123
Child(

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ public let DECL_NODES: [Node] = [
1818
children: [
1919
Child(
2020
name: "Name",
21-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "PrefixOperatorToken"), .token(tokenKind: "PostfixOperatorToken")]),
21+
kind: .token(choices: [
22+
.token(tokenKind: "IdentifierToken"),
23+
.token(tokenKind: "BinaryOperatorToken"),
24+
.token(tokenKind: "PrefixOperatorToken"),
25+
.token(tokenKind: "PostfixOperatorToken"),
26+
]),
2227
nameForDiagnostics: "name"
2328
),
2429
Child(
@@ -81,7 +86,20 @@ public let DECL_NODES: [Node] = [
8186
),
8287
Child(
8388
name: "AccessorKind",
84-
kind: .token(choices: [.keyword(text: "get"), .keyword(text: "set"), .keyword(text: "didSet"), .keyword(text: "willSet"), .keyword(text: "unsafeAddress"), .keyword(text: "addressWithOwner"), .keyword(text: "addressWithNativeOwner"), .keyword(text: "unsafeMutableAddress"), .keyword(text: "mutableAddressWithOwner"), .keyword(text: "mutableAddressWithNativeOwner"), .keyword(text: "_read"), .keyword(text: "_modify")])
89+
kind: .token(choices: [
90+
.keyword(text: "get"),
91+
.keyword(text: "set"),
92+
.keyword(text: "didSet"),
93+
.keyword(text: "willSet"),
94+
.keyword(text: "unsafeAddress"),
95+
.keyword(text: "addressWithOwner"),
96+
.keyword(text: "addressWithNativeOwner"),
97+
.keyword(text: "unsafeMutableAddress"),
98+
.keyword(text: "mutableAddressWithOwner"),
99+
.keyword(text: "mutableAddressWithNativeOwner"),
100+
.keyword(text: "_read"),
101+
.keyword(text: "_modify"),
102+
])
85103
),
86104
Child(
87105
name: "Parameter",
@@ -373,7 +391,8 @@ public let DECL_NODES: [Node] = [
373391
Child(
374392
name: "MemberBlock",
375393
kind: .node(kind: .memberDeclBlock),
376-
documentation: "The members of the class declaration. As class extension declarations may declare additional members, the contents of this member block isn't guaranteed to be a complete list of members for this type."
394+
documentation:
395+
"The members of the class declaration. As class extension declarations may declare additional members, the contents of this member block isn't guaranteed to be a complete list of members for this type."
377396
),
378397
]
379398
),
@@ -766,7 +785,8 @@ public let DECL_NODES: [Node] = [
766785
Child(
767786
name: "MemberBlock",
768787
kind: .node(kind: .memberDeclBlock),
769-
documentation: "The cases and other members associated with this enum declaration. Because enum extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type."
788+
documentation:
789+
"The cases and other members associated with this enum declaration. Because enum extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type."
770790
),
771791
]
772792
),
@@ -854,7 +874,12 @@ public let DECL_NODES: [Node] = [
854874
),
855875
Child(
856876
name: "Identifier",
857-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "PrefixOperatorToken"), .token(tokenKind: "PostfixOperatorToken")])
877+
kind: .token(choices: [
878+
.token(tokenKind: "IdentifierToken"),
879+
.token(tokenKind: "BinaryOperatorToken"),
880+
.token(tokenKind: "PrefixOperatorToken"),
881+
.token(tokenKind: "PostfixOperatorToken"),
882+
])
858883
),
859884
Child(
860885
name: "GenericParameterClause",
@@ -1085,7 +1110,17 @@ public let DECL_NODES: [Node] = [
10851110
),
10861111
Child(
10871112
name: "ImportKind",
1088-
kind: .token(choices: [.keyword(text: "typealias"), .keyword(text: "struct"), .keyword(text: "class"), .keyword(text: "enum"), .keyword(text: "protocol"), .keyword(text: "var"), .keyword(text: "let"), .keyword(text: "func"), .keyword(text: "inout")]),
1113+
kind: .token(choices: [
1114+
.keyword(text: "typealias"),
1115+
.keyword(text: "struct"),
1116+
.keyword(text: "class"),
1117+
.keyword(text: "enum"),
1118+
.keyword(text: "protocol"),
1119+
.keyword(text: "var"),
1120+
.keyword(text: "let"),
1121+
.keyword(text: "func"),
1122+
.keyword(text: "inout"),
1123+
]),
10891124
documentation: "The kind of declaration being imported. For example, a struct can be imported from a specific module.",
10901125
isOptional: true
10911126
),
@@ -1181,7 +1216,11 @@ public let DECL_NODES: [Node] = [
11811216
),
11821217
Child(
11831218
name: "OptionalMark",
1184-
kind: .token(choices: [.token(tokenKind: "PostfixQuestionMarkToken"), .token(tokenKind: "InfixQuestionMarkToken"), .token(tokenKind: "ExclamationMarkToken")]),
1219+
kind: .token(choices: [
1220+
.token(tokenKind: "PostfixQuestionMarkToken"),
1221+
.token(tokenKind: "InfixQuestionMarkToken"),
1222+
.token(tokenKind: "ExclamationMarkToken"),
1223+
]),
11851224
documentation: "If the initializer is failable, a question mark to indicate that.",
11861225
isOptional: true
11871226
),
@@ -1638,7 +1677,8 @@ public let DECL_NODES: [Node] = [
16381677
Child(
16391678
name: "Flag",
16401679
kind: .token(choices: [.keyword(text: "true"), .keyword(text: "false")]),
1641-
documentation: "When true, an operator in the corresponding precedence group uses the same grouping rules during optional chaining as the assignment operators from the standard library. Otherwise, operators in the precedence group follows the same optional chaining rules as operators that don't perform assignment."
1680+
documentation:
1681+
"When true, an operator in the corresponding precedence group uses the same grouping rules during optional chaining as the assignment operators from the standard library. Otherwise, operators in the precedence group follows the same optional chaining rules as operators that don't perform assignment."
16421682
),
16431683
]
16441684
),
@@ -1663,7 +1703,8 @@ public let DECL_NODES: [Node] = [
16631703
Child(
16641704
name: "Value",
16651705
kind: .token(choices: [.keyword(text: "left"), .keyword(text: "right"), .keyword(text: "none")]),
1666-
documentation: "Operators that are `left`-associative group left-to-right. Operators that are `right`-associative group right-to-left. Operators that are specified with an associativity of `none` don't associate at all"
1706+
documentation:
1707+
"Operators that are `left`-associative group left-to-right. Operators that are `right`-associative group right-to-left. Operators that are specified with an associativity of `none` don't associate at all"
16671708
),
16681709
]
16691710
),
@@ -2017,7 +2058,8 @@ public let DECL_NODES: [Node] = [
20172058
Child(
20182059
name: "MemberBlock",
20192060
kind: .node(kind: .memberDeclBlock),
2020-
documentation: "The members of the struct declaration. Because struct extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type."
2061+
documentation:
2062+
"The members of the struct declaration. Because struct extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type."
20212063
),
20222064
]
20232065
),

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ public let EXPR_NODES: [Node] = [
382382
Child(
383383
name: "SecondName",
384384
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "WildcardToken")]),
385-
documentation: "If this is specified, it is the name by which the parameter can be referenced inside the closure body. If it is `nil`, the closure parameter is referenced by the first name.",
385+
documentation:
386+
"If this is specified, it is the name by which the parameter can be referenced inside the closure body. If it is `nil`, the closure parameter is referenced by the first name.",
386387
isOptional: true
387388
),
388389
Child(
@@ -831,7 +832,14 @@ public let EXPR_NODES: [Node] = [
831832
children: [
832833
Child(
833834
name: "Identifier",
834-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "self"), .keyword(text: "Self"), .keyword(text: "init"), .token(tokenKind: "DollarIdentifierToken"), .token(tokenKind: "BinaryOperatorToken")])
835+
kind: .token(choices: [
836+
.token(tokenKind: "IdentifierToken"),
837+
.keyword(text: "self"),
838+
.keyword(text: "Self"),
839+
.keyword(text: "init"),
840+
.token(tokenKind: "DollarIdentifierToken"),
841+
.token(tokenKind: "BinaryOperatorToken"),
842+
])
835843
),
836844
Child(
837845
name: "DeclNameArguments",
@@ -1067,7 +1075,15 @@ public let EXPR_NODES: [Node] = [
10671075
children: [
10681076
Child(
10691077
name: "Identifier",
1070-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "self"), .keyword(text: "Self"), .keyword(text: "init"), .token(tokenKind: "DollarIdentifierToken"), .token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "IntegerLiteralToken")])
1078+
kind: .token(choices: [
1079+
.token(tokenKind: "IdentifierToken"),
1080+
.keyword(text: "self"),
1081+
.keyword(text: "Self"),
1082+
.keyword(text: "init"),
1083+
.token(tokenKind: "DollarIdentifierToken"),
1084+
.token(tokenKind: "BinaryOperatorToken"),
1085+
.token(tokenKind: "IntegerLiteralToken"),
1086+
])
10711087
),
10721088
Child(
10731089
name: "DeclNameArguments",

CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,15 @@ public let GENERIC_NODES: [Node] = [
190190
),
191191
Child(
192192
name: "LayoutConstraint",
193-
kind: .token(choices: [.keyword(text: "_Trivial"), .keyword(text: "_TrivialAtMost"), .keyword(text: "_UnknownLayout"), .keyword(text: "_RefCountedObject"), .keyword(text: "_NativeRefCountedObject"), .keyword(text: "_Class"), .keyword(text: "_NativeClass")])
193+
kind: .token(choices: [
194+
.keyword(text: "_Trivial"),
195+
.keyword(text: "_TrivialAtMost"),
196+
.keyword(text: "_UnknownLayout"),
197+
.keyword(text: "_RefCountedObject"),
198+
.keyword(text: "_NativeRefCountedObject"),
199+
.keyword(text: "_Class"),
200+
.keyword(text: "_NativeClass"),
201+
])
194202
),
195203
Child(
196204
name: "LeftParen",

CodeGeneration/Sources/SyntaxSupport/TokenSpec.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,14 @@ public let SYNTAX_TOKENS: [TokenSpec] = [
171171
PunctuatorSpec(name: "AtSign", kind: "at_sign", text: "@", classification: "Attribute"),
172172
PunctuatorSpec(name: "Backslash", kind: "backslash", text: "\\"),
173173
PunctuatorSpec(name: "Backtick", kind: "backtick", text: "`"),
174-
MiscSpec(name: "BinaryOperator", kind: "oper_binary", nameForDiagnostics: "binary operator", classification: "OperatorIdentifier", requiresLeadingSpace: true, requiresTrailingSpace: true),
174+
MiscSpec(
175+
name: "BinaryOperator",
176+
kind: "oper_binary",
177+
nameForDiagnostics: "binary operator",
178+
classification: "OperatorIdentifier",
179+
requiresLeadingSpace: true,
180+
requiresTrailingSpace: true
181+
),
175182
PunctuatorSpec(name: "Colon", kind: "colon", text: ":", requiresTrailingSpace: true),
176183
PunctuatorSpec(name: "Comma", kind: "comma", text: ",", requiresTrailingSpace: true),
177184
MiscSpec(name: "DollarIdentifier", kind: "dollarident", nameForDiagnostics: "dollar identifier", classification: "DollarIdentifier"),

CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ public let TYPE_NODES: [Node] = [
4444
children: [
4545
Child(
4646
name: "Specifier",
47-
kind: .token(choices: [.keyword(text: "inout"), .keyword(text: "__shared"), .keyword(text: "__owned"), .keyword(text: "isolated"), .keyword(text: "_const"), .keyword(text: "borrowing"), .keyword(text: "consuming")]),
47+
kind: .token(choices: [
48+
.keyword(text: "inout"),
49+
.keyword(text: "__shared"),
50+
.keyword(text: "__owned"),
51+
.keyword(text: "isolated"),
52+
.keyword(text: "_const"),
53+
.keyword(text: "borrowing"),
54+
.keyword(text: "consuming"),
55+
]),
4856
isOptional: true
4957
),
5058
Child(
@@ -408,7 +416,14 @@ public let TYPE_NODES: [Node] = [
408416
children: [
409417
Child(
410418
name: "Name",
411-
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "self"), .keyword(text: "Self"), .keyword(text: "Any"), .token(tokenKind: "KeywordToken"), .token(tokenKind: "WildcardToken")]),
419+
kind: .token(choices: [
420+
.token(tokenKind: "IdentifierToken"),
421+
.keyword(text: "self"),
422+
.keyword(text: "Self"),
423+
.keyword(text: "Any"),
424+
.token(tokenKind: "KeywordToken"),
425+
.token(tokenKind: "WildcardToken"),
426+
]),
412427
classification: "TypeIdentifier"
413428
),
414429
Child(

CodeGeneration/Sources/generate-swiftsyntax/GenerateSwiftSyntax.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ struct GenerateSwiftSyntax: ParsableCommand {
120120
GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["BuildableCollectionNodes.swift"], buildableCollectionNodesFile),
121121
GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["BuildableNodes.swift"], buildableNodesFile),
122122
GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["ResultBuilders.swift"], resultBuildersFile),
123-
GeneratedFileSpec(swiftSyntaxBuilderGeneratedDir + ["SyntaxExpressibleByStringInterpolationConformances.swift"], syntaxExpressibleByStringInterpolationConformancesFile),
123+
GeneratedFileSpec(
124+
swiftSyntaxBuilderGeneratedDir + ["SyntaxExpressibleByStringInterpolationConformances.swift"],
125+
syntaxExpressibleByStringInterpolationConformancesFile
126+
),
124127
]
125128
+ BASE_KIND_FILES.map { baseKind in
126129
GeneratedFileSpec(swiftSyntaxGeneratedDir + ["syntaxNodes", baseKind.value], syntaxNode(emitKind: baseKind.key))

0 commit comments

Comments
 (0)