Skip to content

Don’t generate BasicFormat+Extensions.swift and SyntaxClassifcation.swift #1915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public let ATTRIBUTE_NODES: [Node] = [
name: "AttributeName",
kind: .node(kind: .type),
nameForDiagnostics: "name",
documentation: "The name of the attribute.",
classification: "Attribute"
documentation: "The name of the attribute."
),
Child(
name: "LeftParen",
Expand Down Expand Up @@ -191,8 +190,7 @@ public let ATTRIBUTE_NODES: [Node] = [
children: [
Child(
name: "AvailabilityVersionRestriction",
kind: .node(kind: .availabilityVersionRestriction),
classification: "Keyword"
kind: .node(kind: .availabilityVersionRestriction)
),
Child(
name: "TrailingComma",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public let AVAILABILITY_NODES: [Node] = [
kind: .token(choices: [.token(tokenKind: "IdentifierToken")]),
nameForDiagnostics: "platform",
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.",
classification: "Keyword"
"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."
),
Child(
name: "Version",
Expand Down
11 changes: 1 addition & 10 deletions CodeGeneration/Sources/SyntaxSupport/Child.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public class Child {
public let kind: ChildKind
public let nameForDiagnostics: String?
public let documentation: String?
public let forceClassification: Bool
public let isIndented: Bool
public let isOptional: Bool
public let classification: SyntaxClassification?

public var syntaxNodeKind: SyntaxNodeKind {
switch kind {
Expand Down Expand Up @@ -166,10 +163,7 @@ public class Child {
kind: ChildKind,
nameForDiagnostics: String? = nil,
documentation: String? = nil,
isOptional: Bool = false,
classification: String? = nil,
forceClassification: Bool = false,
isIndented: Bool = false
isOptional: Bool = false
) {
if let firstCharInName = name.first {
precondition(firstCharInName.isUppercase == true, "The first letter of a child’s name should be uppercase")
Expand All @@ -179,9 +173,6 @@ public class Child {
self.kind = kind
self.nameForDiagnostics = nameForDiagnostics
self.documentation = documentation
self.classification = classificationByName(classification)
self.forceClassification = forceClassification
self.isIndented = isIndented
self.isOptional = isOptional
}
}
73 changes: 0 additions & 73 deletions CodeGeneration/Sources/SyntaxSupport/Classification.swift

This file was deleted.

3 changes: 1 addition & 2 deletions CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ public let COMMON_NODES: [Node] = [
Child(
name: "Statements",
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement"),
nameForDiagnostics: "statements",
isIndented: true
nameForDiagnostics: "statements"
),
Child(
name: "RightBrace",
Expand Down
33 changes: 11 additions & 22 deletions CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public let DECL_NODES: [Node] = [
),
Child(
name: "Accessors",
kind: .collection(kind: .accessorList, collectionElementName: "Accessor"),
isIndented: true
kind: .collection(kind: .accessorList, collectionElementName: "Accessor")
),
Child(
name: "RightBrace",
Expand Down Expand Up @@ -543,8 +542,7 @@ public let DECL_NODES: [Node] = [
.keyword(text: "static"),
.keyword(text: "unowned"),
.keyword(text: "weak"),
]),
classification: "Attribute"
])
),
Child(
name: "Detail",
Expand Down Expand Up @@ -681,8 +679,7 @@ public let DECL_NODES: [Node] = [
name: "ParameterList",
kind: .collection(kind: .enumCaseParameterList, collectionElementName: "Parameter"),
nameForDiagnostics: "parameters",
documentation: "The actual parameters.",
isIndented: true
documentation: "The actual parameters."
),
Child(
name: "RightParen",
Expand Down Expand Up @@ -1130,15 +1127,13 @@ public let DECL_NODES: [Node] = [
children: [
Child(
name: "PoundKeyword",
kind: .token(choices: [.token(tokenKind: "PoundIfToken"), .token(tokenKind: "PoundElseifToken"), .token(tokenKind: "PoundElseToken")]),
classification: "BuildConfigId"
kind: .token(choices: [.token(tokenKind: "PoundIfToken"), .token(tokenKind: "PoundElseifToken"), .token(tokenKind: "PoundElseToken")])
),
Child(
name: "Condition",
kind: .node(kind: .expr),
nameForDiagnostics: "condition",
isOptional: true,
classification: "BuildConfigId"
isOptional: true
),
Child(
name: "Elements",
Expand Down Expand Up @@ -1182,8 +1177,7 @@ public let DECL_NODES: [Node] = [
),
Child(
name: "PoundEndif",
kind: .token(choices: [.token(tokenKind: "PoundEndifToken")]),
classification: "BuildConfigId"
kind: .token(choices: [.token(tokenKind: "PoundEndifToken")])
),
]
),
Expand Down Expand Up @@ -1509,8 +1503,7 @@ public let DECL_NODES: [Node] = [
),
Child(
name: "Members",
kind: .collection(kind: .memberDeclList, collectionElementName: "Member"),
isIndented: true
kind: .collection(kind: .memberDeclList, collectionElementName: "Member")
),
Child(
name: "RightBrace",
Expand Down Expand Up @@ -1600,8 +1593,7 @@ public let DECL_NODES: [Node] = [
),
Child(
name: "Identifier",
kind: .token(choices: [.token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "PrefixOperatorToken"), .token(tokenKind: "PostfixOperatorToken")]),
classification: "OperatorIdentifier"
kind: .token(choices: [.token(tokenKind: "BinaryOperatorToken"), .token(tokenKind: "PrefixOperatorToken"), .token(tokenKind: "PostfixOperatorToken")])
),
Child(
name: "OperatorPrecedenceAndTypes",
Expand Down Expand Up @@ -1652,8 +1644,7 @@ public let DECL_NODES: [Node] = [
Child(
name: "ParameterList",
kind: .collection(kind: .functionParameterList, collectionElementName: "Parameter"),
nameForDiagnostics: "parameters",
isIndented: true
nameForDiagnostics: "parameters"
),
Child(
name: "RightParen",
Expand Down Expand Up @@ -1824,8 +1815,7 @@ public let DECL_NODES: [Node] = [
Child(
name: "AssociativityLabel",
deprecatedName: "AssociativityKeyword",
kind: .token(choices: [.keyword(text: "associativity")]),
classification: "Keyword"
kind: .token(choices: [.keyword(text: "associativity")])
),
Child(
name: "Colon",
Expand Down Expand Up @@ -1942,8 +1932,7 @@ public let DECL_NODES: [Node] = [
name: "HigherThanOrLowerThanLabel",
deprecatedName: "HigherThanOrLowerThan",
kind: .token(choices: [.keyword(text: "higherThan"), .keyword(text: "lowerThan")]),
documentation: "The relation to specified other precedence groups.",
classification: "Keyword"
documentation: "The relation to specified other precedence groups."
),
Child(
name: "Colon",
Expand Down
32 changes: 10 additions & 22 deletions CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public let EXPR_NODES: [Node] = [
),
Child(
name: "Elements",
kind: .collection(kind: .arrayElementList, collectionElementName: "Element"),
isIndented: true
kind: .collection(kind: .arrayElementList, collectionElementName: "Element")
),
Child(
name: "RightSquare",
Expand Down Expand Up @@ -447,8 +446,7 @@ public let EXPR_NODES: [Node] = [
name: "ParameterList",
kind: .collection(kind: .closureParameterList, collectionElementName: "Parameter"),
nameForDiagnostics: "parameters",
documentation: "The actual parameters.",
isIndented: true
documentation: "The actual parameters."
),
Child(
name: "RightParen",
Expand Down Expand Up @@ -478,8 +476,7 @@ public let EXPR_NODES: [Node] = [
),
Child(
name: "Statements",
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement"),
isIndented: true
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement")
),
Child(
name: "RightBrace",
Expand Down Expand Up @@ -648,8 +645,7 @@ public let EXPR_NODES: [Node] = [
Child(
name: "ValueExpression",
kind: .node(kind: .expr),
nameForDiagnostics: "value",
isIndented: true
nameForDiagnostics: "value"
),
Child(
name: "TrailingComma",
Expand Down Expand Up @@ -680,8 +676,7 @@ public let EXPR_NODES: [Node] = [
name: "Elements",
kind: .node(kind: .dictionaryElementList)
),
]),
isIndented: true
])
),
Child(
name: "RightSquare",
Expand Down Expand Up @@ -745,19 +740,15 @@ public let EXPR_NODES: [Node] = [
),
Child(
name: "LeftParen",
kind: .token(choices: [.token(tokenKind: "LeftParenToken")]),
classification: "StringInterpolationAnchor",
forceClassification: true
kind: .token(choices: [.token(tokenKind: "LeftParenToken")])
),
Child(
name: "Expressions",
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Expression")
),
Child(
name: "RightParen",
kind: .token(choices: [.token(tokenKind: "RightParenToken")]),
classification: "StringInterpolationAnchor",
forceClassification: true
kind: .token(choices: [.token(tokenKind: "RightParenToken")])
),
]
),
Expand Down Expand Up @@ -816,8 +807,7 @@ public let EXPR_NODES: [Node] = [
Child(
name: "ArgumentList",
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Argument"),
nameForDiagnostics: "arguments",
isIndented: true
nameForDiagnostics: "arguments"
),
Child(
name: "RightParen",
Expand Down Expand Up @@ -1630,8 +1620,7 @@ public let EXPR_NODES: [Node] = [
),
Child(
name: "Statements",
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement"),
isIndented: true
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement")
),
]
),
Expand Down Expand Up @@ -1805,8 +1794,7 @@ public let EXPR_NODES: [Node] = [
Child(
name: "Elements",
deprecatedName: "ElementList",
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Element"),
isIndented: true
kind: .collection(kind: .tupleExprElementList, collectionElementName: "Element")
),
Child(
name: "RightParen",
Expand Down
Loading