Skip to content

Commit 69c9c53

Browse files
authored
Merge pull request #1915 from ahoppen/ahoppen/less-generation
Don’t generate BasicFormat+Extensions.swift and SyntaxClassifcation.swift
2 parents e990c2a + 8ffd59a commit 69c9c53

18 files changed

+128
-593
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public let ATTRIBUTE_NODES: [Node] = [
4646
name: "AttributeName",
4747
kind: .node(kind: .type),
4848
nameForDiagnostics: "name",
49-
documentation: "The name of the attribute.",
50-
classification: "Attribute"
49+
documentation: "The name of the attribute."
5150
),
5251
Child(
5352
name: "LeftParen",
@@ -191,8 +190,7 @@ public let ATTRIBUTE_NODES: [Node] = [
191190
children: [
192191
Child(
193192
name: "AvailabilityVersionRestriction",
194-
kind: .node(kind: .availabilityVersionRestriction),
195-
classification: "Keyword"
193+
kind: .node(kind: .availabilityVersionRestriction)
196194
),
197195
Child(
198196
name: "TrailingComma",

CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ public let AVAILABILITY_NODES: [Node] = [
118118
kind: .token(choices: [.token(tokenKind: "IdentifierToken")]),
119119
nameForDiagnostics: "platform",
120120
documentation:
121-
"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.",
122-
classification: "Keyword"
121+
"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."
123122
),
124123
Child(
125124
name: "Version",

CodeGeneration/Sources/SyntaxSupport/Child.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ public class Child {
6161
public let kind: ChildKind
6262
public let nameForDiagnostics: String?
6363
public let documentation: String?
64-
public let forceClassification: Bool
65-
public let isIndented: Bool
6664
public let isOptional: Bool
67-
public let classification: SyntaxClassification?
6865

6966
public var syntaxNodeKind: SyntaxNodeKind {
7067
switch kind {
@@ -166,10 +163,7 @@ public class Child {
166163
kind: ChildKind,
167164
nameForDiagnostics: String? = nil,
168165
documentation: String? = nil,
169-
isOptional: Bool = false,
170-
classification: String? = nil,
171-
forceClassification: Bool = false,
172-
isIndented: Bool = false
166+
isOptional: Bool = false
173167
) {
174168
if let firstCharInName = name.first {
175169
precondition(firstCharInName.isUppercase == true, "The first letter of a child’s name should be uppercase")
@@ -179,9 +173,6 @@ public class Child {
179173
self.kind = kind
180174
self.nameForDiagnostics = nameForDiagnostics
181175
self.documentation = documentation
182-
self.classification = classificationByName(classification)
183-
self.forceClassification = forceClassification
184-
self.isIndented = isIndented
185176
self.isOptional = isOptional
186177
}
187178
}

CodeGeneration/Sources/SyntaxSupport/Classification.swift

Lines changed: 0 additions & 73 deletions
This file was deleted.

CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ public let COMMON_NODES: [Node] = [
7171
Child(
7272
name: "Statements",
7373
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement"),
74-
nameForDiagnostics: "statements",
75-
isIndented: true
74+
nameForDiagnostics: "statements"
7675
),
7776
Child(
7877
name: "RightBrace",

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public let DECL_NODES: [Node] = [
5656
),
5757
Child(
5858
name: "Accessors",
59-
kind: .collection(kind: .accessorList, collectionElementName: "Accessor"),
60-
isIndented: true
59+
kind: .collection(kind: .accessorList, collectionElementName: "Accessor")
6160
),
6261
Child(
6362
name: "RightBrace",
@@ -543,8 +542,7 @@ public let DECL_NODES: [Node] = [
543542
.keyword(text: "static"),
544543
.keyword(text: "unowned"),
545544
.keyword(text: "weak"),
546-
]),
547-
classification: "Attribute"
545+
])
548546
),
549547
Child(
550548
name: "Detail",
@@ -681,8 +679,7 @@ public let DECL_NODES: [Node] = [
681679
name: "ParameterList",
682680
kind: .collection(kind: .enumCaseParameterList, collectionElementName: "Parameter"),
683681
nameForDiagnostics: "parameters",
684-
documentation: "The actual parameters.",
685-
isIndented: true
682+
documentation: "The actual parameters."
686683
),
687684
Child(
688685
name: "RightParen",
@@ -1130,15 +1127,13 @@ public let DECL_NODES: [Node] = [
11301127
children: [
11311128
Child(
11321129
name: "PoundKeyword",
1133-
kind: .token(choices: [.token(tokenKind: "PoundIfToken"), .token(tokenKind: "PoundElseifToken"), .token(tokenKind: "PoundElseToken")]),
1134-
classification: "BuildConfigId"
1130+
kind: .token(choices: [.token(tokenKind: "PoundIfToken"), .token(tokenKind: "PoundElseifToken"), .token(tokenKind: "PoundElseToken")])
11351131
),
11361132
Child(
11371133
name: "Condition",
11381134
kind: .node(kind: .expr),
11391135
nameForDiagnostics: "condition",
1140-
isOptional: true,
1141-
classification: "BuildConfigId"
1136+
isOptional: true
11421137
),
11431138
Child(
11441139
name: "Elements",
@@ -1182,8 +1177,7 @@ public let DECL_NODES: [Node] = [
11821177
),
11831178
Child(
11841179
name: "PoundEndif",
1185-
kind: .token(choices: [.token(tokenKind: "PoundEndifToken")]),
1186-
classification: "BuildConfigId"
1180+
kind: .token(choices: [.token(tokenKind: "PoundEndifToken")])
11871181
),
11881182
]
11891183
),
@@ -1509,8 +1503,7 @@ public let DECL_NODES: [Node] = [
15091503
),
15101504
Child(
15111505
name: "Members",
1512-
kind: .collection(kind: .memberDeclList, collectionElementName: "Member"),
1513-
isIndented: true
1506+
kind: .collection(kind: .memberDeclList, collectionElementName: "Member")
15141507
),
15151508
Child(
15161509
name: "RightBrace",
@@ -1600,8 +1593,7 @@ public let DECL_NODES: [Node] = [
16001593
),
16011594
Child(
16021595
name: "Identifier",
1603-
kind: .token(choices: [.token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "PrefixOperatorToken"), .token(tokenKind: "PostfixOperatorToken")]),
1604-
classification: "OperatorIdentifier"
1596+
kind: .token(choices: [.token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "PrefixOperatorToken"), .token(tokenKind: "PostfixOperatorToken")])
16051597
),
16061598
Child(
16071599
name: "OperatorPrecedenceAndTypes",
@@ -1652,8 +1644,7 @@ public let DECL_NODES: [Node] = [
16521644
Child(
16531645
name: "ParameterList",
16541646
kind: .collection(kind: .functionParameterList, collectionElementName: "Parameter"),
1655-
nameForDiagnostics: "parameters",
1656-
isIndented: true
1647+
nameForDiagnostics: "parameters"
16571648
),
16581649
Child(
16591650
name: "RightParen",
@@ -1824,8 +1815,7 @@ public let DECL_NODES: [Node] = [
18241815
Child(
18251816
name: "AssociativityLabel",
18261817
deprecatedName: "AssociativityKeyword",
1827-
kind: .token(choices: [.keyword(text: "associativity")]),
1828-
classification: "Keyword"
1818+
kind: .token(choices: [.keyword(text: "associativity")])
18291819
),
18301820
Child(
18311821
name: "Colon",
@@ -1942,8 +1932,7 @@ public let DECL_NODES: [Node] = [
19421932
name: "HigherThanOrLowerThanLabel",
19431933
deprecatedName: "HigherThanOrLowerThan",
19441934
kind: .token(choices: [.keyword(text: "higherThan"), .keyword(text: "lowerThan")]),
1945-
documentation: "The relation to specified other precedence groups.",
1946-
classification: "Keyword"
1935+
documentation: "The relation to specified other precedence groups."
19471936
),
19481937
Child(
19491938
name: "Colon",

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public let EXPR_NODES: [Node] = [
5353
),
5454
Child(
5555
name: "Elements",
56-
kind: .collection(kind: .arrayElementList, collectionElementName: "Element"),
57-
isIndented: true
56+
kind: .collection(kind: .arrayElementList, collectionElementName: "Element")
5857
),
5958
Child(
6059
name: "RightSquare",
@@ -447,8 +446,7 @@ public let EXPR_NODES: [Node] = [
447446
name: "ParameterList",
448447
kind: .collection(kind: .closureParameterList, collectionElementName: "Parameter"),
449448
nameForDiagnostics: "parameters",
450-
documentation: "The actual parameters.",
451-
isIndented: true
449+
documentation: "The actual parameters."
452450
),
453451
Child(
454452
name: "RightParen",
@@ -478,8 +476,7 @@ public let EXPR_NODES: [Node] = [
478476
),
479477
Child(
480478
name: "Statements",
481-
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement"),
482-
isIndented: true
479+
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement")
483480
),
484481
Child(
485482
name: "RightBrace",
@@ -648,8 +645,7 @@ public let EXPR_NODES: [Node] = [
648645
Child(
649646
name: "ValueExpression",
650647
kind: .node(kind: .expr),
651-
nameForDiagnostics: "value",
652-
isIndented: true
648+
nameForDiagnostics: "value"
653649
),
654650
Child(
655651
name: "TrailingComma",
@@ -680,8 +676,7 @@ public let EXPR_NODES: [Node] = [
680676
name: "Elements",
681677
kind: .node(kind: .dictionaryElementList)
682678
),
683-
]),
684-
isIndented: true
679+
])
685680
),
686681
Child(
687682
name: "RightSquare",
@@ -745,19 +740,15 @@ public let EXPR_NODES: [Node] = [
745740
),
746741
Child(
747742
name: "LeftParen",
748-
kind: .token(choices: [.token(tokenKind: "LeftParenToken")]),
749-
classification: "StringInterpolationAnchor",
750-
forceClassification: true
743+
kind: .token(choices: [.token(tokenKind: "LeftParenToken")])
751744
),
752745
Child(
753746
name: "Expressions",
754747
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Expression")
755748
),
756749
Child(
757750
name: "RightParen",
758-
kind: .token(choices: [.token(tokenKind: "RightParenToken")]),
759-
classification: "StringInterpolationAnchor",
760-
forceClassification: true
751+
kind: .token(choices: [.token(tokenKind: "RightParenToken")])
761752
),
762753
]
763754
),
@@ -816,8 +807,7 @@ public let EXPR_NODES: [Node] = [
816807
Child(
817808
name: "ArgumentList",
818809
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument"),
819-
nameForDiagnostics: "arguments",
820-
isIndented: true
810+
nameForDiagnostics: "arguments"
821811
),
822812
Child(
823813
name: "RightParen",
@@ -1630,8 +1620,7 @@ public let EXPR_NODES: [Node] = [
16301620
),
16311621
Child(
16321622
name: "Statements",
1633-
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement"),
1634-
isIndented: true
1623+
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement")
16351624
),
16361625
]
16371626
),
@@ -1805,8 +1794,7 @@ public let EXPR_NODES: [Node] = [
18051794
Child(
18061795
name: "Elements",
18071796
deprecatedName: "ElementList",
1808-
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Element"),
1809-
isIndented: true
1797+
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Element")
18101798
),
18111799
Child(
18121800
name: "RightParen",

0 commit comments

Comments
 (0)