Skip to content

Replace string-based token references with Token enum in CodeGeneration #2006

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
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
80 changes: 40 additions & 40 deletions CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "AtSign",
deprecatedName: "AtSignToken",
kind: .token(choices: [.token(tokenKind: "AtSignToken")]),
kind: .token(choices: [.token(.atSign)]),
documentation: "The `@` sign."
),
Child(
Expand All @@ -50,7 +50,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "LeftParen",
kind: .token(choices: [.token(tokenKind: "LeftParenToken")]),
kind: .token(choices: [.token(.leftParen)]),
documentation: "If the attribute takes arguments, the opening parenthesis.",
isOptional: true
),
Expand Down Expand Up @@ -144,7 +144,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "RightParen",
kind: .token(choices: [.token(tokenKind: "RightParenToken")]),
kind: .token(choices: [.token(.rightParen)]),
documentation: "If the attribute takes arguments, the closing parenthesis.",
isOptional: true
),
Expand All @@ -166,7 +166,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating the label and the value"
),
Child(
Expand All @@ -176,7 +176,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Semicolon",
kind: .token(choices: [.token(tokenKind: "SemicolonToken")])
kind: .token(choices: [.token(.semicolon)])
),
]
),
Expand All @@ -196,7 +196,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "TrailingComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "A trailing comma if the argument is followed by another argument",
isOptional: true
),
Expand Down Expand Up @@ -227,7 +227,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating \"before\" and the parameter list."
),
Child(
Expand All @@ -248,12 +248,12 @@ public let ATTRIBUTE_NODES: [Node] = [
children: [
Child(
name: "ConventionLabel",
kind: .token(choices: [.token(tokenKind: "IdentifierToken")]),
kind: .token(choices: [.token(.identifier)]),
documentation: "The convention label."
),
Child(
name: "Comma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
isOptional: true
),
Child(
Expand All @@ -263,7 +263,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
isOptional: true
),
Child(
Expand All @@ -287,11 +287,11 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
kind: .token(choices: [.token(.colon)])
),
Child(
name: "ProtocolName",
kind: .token(choices: [.token(tokenKind: "IdentifierToken")])
kind: .token(choices: [.token(.identifier)])
),
]
),
Expand All @@ -316,7 +316,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating the \"of\" label and the original declaration name."
),
Child(
Expand All @@ -326,7 +326,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Period",
kind: .token(choices: [.token(tokenKind: "PeriodToken")]),
kind: .token(choices: [.token(.period)]),
documentation: "The period separating the original declaration name and the accessor name.",
isOptional: true
),
Expand All @@ -339,7 +339,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Comma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
isOptional: true
),
Child(
Expand Down Expand Up @@ -373,11 +373,11 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "Argument",
deprecatedName: "Parameter",
kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "IntegerLiteralToken"), .keyword(text: "self")])
kind: .token(choices: [.token(.identifier), .token(.integerLiteral), .keyword(text: "self")])
),
Child(
name: "TrailingComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
isOptional: true
),
]
Expand All @@ -398,7 +398,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating \"wrt\" and the parameter list."
),
Child(
Expand Down Expand Up @@ -430,7 +430,7 @@ public let ATTRIBUTE_NODES: [Node] = [
children: [
Child(
name: "LeftParen",
kind: .token(choices: [.token(tokenKind: "LeftParenToken")])
kind: .token(choices: [.token(.leftParen)])
),
Child(
name: "Arguments",
Expand All @@ -440,7 +440,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "RightParen",
kind: .token(choices: [.token(tokenKind: "RightParenToken")])
kind: .token(choices: [.token(.rightParen)])
),
]
),
Expand All @@ -465,7 +465,7 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "KindSpecifierComma",
deprecatedName: "DiffKindComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "The comma following the differentiability kind, if it exists.",
isOptional: true
),
Expand All @@ -478,7 +478,7 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "ArgumentsComma",
deprecatedName: "DiffParamsComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "The comma following the differentiability arguments clause, if it exists.",
isOptional: true
),
Expand Down Expand Up @@ -507,15 +507,15 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
kind: .token(choices: [.token(.colon)])
),
Child(
name: "Value",
kind: .nodeChoices(choices: [
Child(
name: "Token",
kind: .token(choices: [
.token(tokenKind: "IdentifierToken"),
.token(.identifier),
.keyword(text: "private"),
.keyword(text: "fileprivate"),
.keyword(text: "internal"),
Expand All @@ -531,7 +531,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "TrailingComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "A trailing comma if this argument is followed by another one",
isOptional: true
),
Expand All @@ -558,7 +558,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
kind: .token(choices: [.token(.colon)])
),
Child(
name: "DeclName",
Expand Down Expand Up @@ -588,7 +588,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Comma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
isOptional: true
),
Child(
Expand Down Expand Up @@ -616,7 +616,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Comma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "The comma separating the type and method name"
),
Child(
Expand Down Expand Up @@ -656,7 +656,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating the label and the value"
),
Child(
Expand All @@ -667,7 +667,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "TrailingComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "A trailing comma if this argument is followed by another one",
isOptional: true
),
Expand All @@ -690,7 +690,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
isOptional: true
),
]
Expand Down Expand Up @@ -718,11 +718,11 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Comma",
kind: .token(choices: [.token(tokenKind: "CommaToken")])
kind: .token(choices: [.token(.comma)])
),
Child(
name: "Ordinal",
kind: .token(choices: [.token(tokenKind: "IntegerLiteralToken")]),
kind: .token(choices: [.token(.integerLiteral)]),
documentation: "The ordinal corresponding to the 'some' keyword that introduced this opaque type."
),
]
Expand All @@ -740,15 +740,15 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
kind: .token(choices: [.token(.colon)])
),
Child(
name: "ModuleName",
kind: .node(kind: .stringLiteralExpr)
),
Child(
name: "Comma",
kind: .token(choices: [.token(tokenKind: "CommaToken")])
kind: .token(choices: [.token(.comma)])
),
Child(
name: "Platforms",
Expand Down Expand Up @@ -782,7 +782,7 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "Period",
deprecatedName: "Dot",
kind: .token(choices: [.token(tokenKind: "PeriodToken")]),
kind: .token(choices: [.token(.period)]),
isOptional: true
),
Child(
Expand Down Expand Up @@ -827,7 +827,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
kind: .token(choices: [.token(.colon)]),
documentation: "The colon separating the label and the value"
),
Child(
Expand All @@ -839,7 +839,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "TrailingComma",
kind: .token(choices: [.token(tokenKind: "CommaToken")]),
kind: .token(choices: [.token(.comma)]),
documentation: "A trailing comma if this argument is followed by another one",
isOptional: true
),
Expand All @@ -858,7 +858,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
kind: .token(choices: [.token(.colon)])
),
Child(
name: "Message",
Expand All @@ -879,7 +879,7 @@ public let ATTRIBUTE_NODES: [Node] = [
),
Child(
name: "Colon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
kind: .token(choices: [.token(.colon)])
),
Child(
name: "Filename",
Expand Down
Loading