Skip to content

Fix child name validation failures in testSingleTokenChoiceChildNaming #1854

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 1 commit into from
Jun 27, 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
12 changes: 8 additions & 4 deletions CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public let ATTRIBUTE_NODES: [Node] = [
parserFunction: "parseAttribute",
children: [
Child(
name: "AtSignToken",
name: "AtSign",
deprecatedName: "AtSignToken",
kind: .token(choices: [.token(tokenKind: "AtSignToken")]),
documentation: "The `@` sign."
),
Expand Down Expand Up @@ -157,7 +158,8 @@ public let ATTRIBUTE_NODES: [Node] = [
documentation: "The availability argument for the _specialize attribute",
children: [
Child(
name: "Label",
name: "AvailabilityLabel",
Comment on lines -160 to +161
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a deprecatedName here`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes. Thanks for catching it.

deprecatedName: "Label",
kind: .token(choices: [.keyword(text: "availability")]),
nameForDiagnostics: "label",
documentation: "The label of the argument"
Expand Down Expand Up @@ -789,7 +791,8 @@ public let ATTRIBUTE_NODES: [Node] = [
isOptional: true
),
Child(
name: "Dot",
name: "Period",
deprecatedName: "Dot",
kind: .token(choices: [.token(tokenKind: "PeriodToken")]),
isOptional: true
),
Expand Down Expand Up @@ -840,7 +843,8 @@ public let ATTRIBUTE_NODES: [Node] = [
],
children: [
Child(
name: "Label",
name: "TargetLabel",
deprecatedName: "Label",
kind: .token(choices: [.keyword(text: "target")]),
nameForDiagnostics: "label",
documentation: "The label of the argument"
Expand Down
27 changes: 18 additions & 9 deletions CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public let DECL_NODES: [Node] = [
nameForDiagnostics: "name"
),
Child(
name: "TrailingDot",
name: "TrailingPeriod",
deprecatedName: "TrailingDot",
kind: .token(choices: [.token(tokenKind: "PeriodToken")]),
isOptional: true
),
Expand Down Expand Up @@ -1436,7 +1437,8 @@ public let DECL_NODES: [Node] = [
isOptional: true
),
Child(
name: "PoundToken",
name: "Pound",
deprecatedName: "PoundToken",
kind: .token(choices: [.token(tokenKind: "PoundToken")]),
documentation: "The `#` sign."
),
Expand Down Expand Up @@ -1700,11 +1702,13 @@ public let DECL_NODES: [Node] = [
nameForDiagnostics: "'#sourceLocation' arguments",
children: [
Child(
name: "FileArgLabel",
name: "FileLabel",
deprecatedName: "FileArgLabel",
kind: .token(choices: [.keyword(text: "file")])
),
Child(
name: "FileArgColon",
name: "FileColon",
deprecatedName: "FileArgColon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
),
Child(
Expand All @@ -1717,11 +1721,13 @@ public let DECL_NODES: [Node] = [
kind: .token(choices: [.token(tokenKind: "CommaToken")])
),
Child(
name: "LineArgLabel",
name: "LineLabel",
deprecatedName: "LineArgLabel",
kind: .token(choices: [.keyword(text: "line")])
),
Child(
name: "LineArgColon",
name: "LineColon",
deprecatedName: "LineArgColon",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
),
Child(
Expand Down Expand Up @@ -1770,7 +1776,8 @@ public let DECL_NODES: [Node] = [
documentation: "Specifies the precedence of an operator when used in an operation that includes optional chaining.",
children: [
Child(
name: "AssignmentKeyword",
name: "AssignmentLabel",
deprecatedName: "AssignmentKeyword",
kind: .token(choices: [.keyword(text: "assignment")])
),
Child(
Expand All @@ -1795,7 +1802,8 @@ public let DECL_NODES: [Node] = [
documentation: "Specifies how a sequence of operators with the same precedence level are grouped together in the absence of grouping parentheses.",
children: [
Child(
name: "AssociativityKeyword",
name: "AssociativityLabel",
deprecatedName: "AssociativityKeyword",
kind: .token(choices: [.keyword(text: "associativity")]),
classification: "Keyword"
),
Expand Down Expand Up @@ -2034,7 +2042,8 @@ public let DECL_NODES: [Node] = [
kind: .collection(kind: .codeBlockItemList, collectionElementName: "Statement")
),
Child(
name: "EOFToken",
name: "EndOfFileToken",
deprecatedName: "EOFToken",
kind: .token(choices: [.token(tokenKind: "EOFToken")])
),
]
Expand Down
63 changes: 42 additions & 21 deletions CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public let EXPR_NODES: [Node] = [
isOptional: true
),
Child(
name: "ArrowToken",
name: "Arrow",
deprecatedName: "ArrowToken",
kind: .token(choices: [.token(tokenKind: "ArrowToken")])
),
]
Expand All @@ -97,7 +98,8 @@ public let EXPR_NODES: [Node] = [
kind: .node(kind: .expr)
),
Child(
name: "AsTok",
name: "AsKeyword",
deprecatedName: "AsTok",
kind: .token(choices: [.keyword(text: "as")])
),
Child(
Expand All @@ -119,7 +121,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: nil,
children: [
Child(
name: "AssignToken",
name: "Equal",
deprecatedName: "AssignToken",
kind: .token(choices: [.token(tokenKind: "EqualToken")])
)
]
Expand Down Expand Up @@ -151,7 +154,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "operator",
children: [
Child(
name: "OperatorToken",
name: "Operator",
deprecatedName: "OperatorToken",
kind: .token(choices: [.token(tokenKind: "BinaryOperatorToken")])
)
]
Expand Down Expand Up @@ -320,7 +324,8 @@ public let EXPR_NODES: [Node] = [
isOptional: true
),
Child(
name: "AssignToken",
name: "Equal",
deprecatedName: "AssignToken",
kind: .token(choices: [.token(tokenKind: "EqualToken")]),
isOptional: true
),
Expand Down Expand Up @@ -554,7 +559,8 @@ public let EXPR_NODES: [Node] = [
isOptional: true
),
Child(
name: "InTok",
name: "InKeyword",
deprecatedName: "InTok",
kind: .token(choices: [.keyword(text: "in")])
),
]
Expand Down Expand Up @@ -727,7 +733,8 @@ public let EXPR_NODES: [Node] = [
kind: .token(choices: [.token(tokenKind: "BackslashToken")])
),
Child(
name: "Delimiter",
name: "RawStringDelimiter",
deprecatedName: "Delimiter",
kind: .token(choices: [.token(tokenKind: "RawStringDelimiterToken")]),
isOptional: true
),
Expand Down Expand Up @@ -760,7 +767,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "floating literal",
children: [
Child(
name: "FloatingDigits",
name: "Digits",
deprecatedName: "FloatingDigits",
kind: .token(choices: [.token(tokenKind: "FloatingLiteralToken")])
)
]
Expand Down Expand Up @@ -982,7 +990,8 @@ public let EXPR_NODES: [Node] = [
documentation: "The expression which will be checked to determine whether it can be cast to a specific type."
),
Child(
name: "IsTok",
name: "IsKeyword",
deprecatedName: "IsTok",
kind: .token(choices: [.keyword(text: "is")]),
documentation: "The `is` keyword for this expression."
),
Expand Down Expand Up @@ -1107,7 +1116,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "key path subscript component",
children: [
Child(
name: "LeftBracket",
name: "LeftSquare",
deprecatedName: "LeftBracket",
kind: .token(choices: [.token(tokenKind: "LeftSquareToken")])
),
Child(
Expand All @@ -1116,7 +1126,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "arguments"
),
Child(
name: "RightBracket",
name: "RightSquare",
deprecatedName: "RightBracket",
kind: .token(choices: [.token(tokenKind: "RightSquareToken")])
),
]
Expand All @@ -1132,7 +1143,8 @@ public let EXPR_NODES: [Node] = [
],
children: [
Child(
name: "PoundToken",
name: "Pound",
deprecatedName: "PoundToken",
kind: .token(choices: [.token(tokenKind: "PoundToken")]),
documentation: "The `#` sign."
),
Expand Down Expand Up @@ -1185,7 +1197,8 @@ public let EXPR_NODES: [Node] = [
isOptional: true
),
Child(
name: "Dot",
name: "Period",
deprecatedName: "Dot",
kind: .token(choices: [.token(tokenKind: "PeriodToken")])
),
Child(
Expand Down Expand Up @@ -1356,7 +1369,8 @@ public let EXPR_NODES: [Node] = [
kind: .node(kind: .expr)
),
Child(
name: "OperatorToken",
name: "Operator",
deprecatedName: "OperatorToken",
kind: .token(choices: [.token(tokenKind: "PostfixOperatorToken")])
),
]
Expand All @@ -1371,7 +1385,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "operator",
children: [
Child(
name: "OperatorToken",
name: "Operator",
deprecatedName: "OperatorToken",
kind: .token(choices: [.token(tokenKind: "PrefixOperatorToken")]),
isOptional: true
),
Expand Down Expand Up @@ -1507,7 +1522,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "called expression"
),
Child(
name: "LeftBracket",
name: "LeftSquare",
deprecatedName: "LeftBracket",
kind: .token(choices: [.token(tokenKind: "LeftSquareToken")])
),
Child(
Expand All @@ -1516,7 +1532,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "arguments"
),
Child(
name: "RightBracket",
name: "RightSquare",
deprecatedName: "RightBracket",
kind: .token(choices: [.token(tokenKind: "RightSquareToken")])
),
Child(
Expand Down Expand Up @@ -1689,7 +1706,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "first choice"
),
Child(
name: "ColonMark",
name: "Colon",
deprecatedName: "ColonMark",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
),
Child(
Expand Down Expand Up @@ -1812,7 +1830,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "'as'",
children: [
Child(
name: "AsTok",
name: "AsKeyword",
deprecatedName: "AsTok",
kind: .token(choices: [.keyword(text: "as")])
),
Child(
Expand All @@ -1832,7 +1851,8 @@ public let EXPR_NODES: [Node] = [
nameForDiagnostics: "'is'",
children: [
Child(
name: "IsTok",
name: "IsKeyword",
deprecatedName: "IsTok",
kind: .token(choices: [.keyword(text: "is")])
)
]
Expand Down Expand Up @@ -1867,7 +1887,8 @@ public let EXPR_NODES: [Node] = [
kind: .node(kind: .expr)
),
Child(
name: "ColonMark",
name: "Colon",
deprecatedName: "ColonMark",
kind: .token(choices: [.token(tokenKind: "ColonToken")])
),
]
Expand Down
15 changes: 10 additions & 5 deletions CodeGeneration/Sources/SyntaxSupport/GenericNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public let GENERIC_NODES: [Node] = [
parserFunction: "parseGenericParameters",
children: [
Child(
name: "LeftAngleBracket",
name: "LeftAngle",
deprecatedName: "LeftAngleBracket",
kind: .token(choices: [.token(tokenKind: "LeftAngleToken")])
),
Child(
Expand All @@ -54,7 +55,8 @@ public let GENERIC_NODES: [Node] = [
isOptional: true
),
Child(
name: "RightAngleBracket",
name: "RightAngle",
deprecatedName: "RightAngleBracket",
kind: .token(choices: [.token(tokenKind: "RightAngleToken")])
),
]
Expand Down Expand Up @@ -85,7 +87,8 @@ public let GENERIC_NODES: [Node] = [
isOptional: true
),
Child(
name: "Each",
name: "EachKeyword",
deprecatedName: "Each",
kind: .token(choices: [.keyword(text: "each")]),
nameForDiagnostics: "parameter pack specifier",
isOptional: true
Expand Down Expand Up @@ -238,15 +241,17 @@ public let GENERIC_NODES: [Node] = [
nameForDiagnostics: "primary associated type clause",
children: [
Child(
name: "LeftAngleBracket",
name: "LeftAngle",
deprecatedName: "LeftAngleBracket",
kind: .token(choices: [.token(tokenKind: "LeftAngleToken")])
),
Child(
name: "PrimaryAssociatedTypeList",
kind: .collection(kind: .primaryAssociatedTypeList, collectionElementName: "PrimaryAssociatedType")
),
Child(
name: "RightAngleBracket",
name: "RightAngle",
deprecatedName: "RightAngleBracket",
kind: .token(choices: [.token(tokenKind: "RightAngleToken")])
),
]
Expand Down
6 changes: 4 additions & 2 deletions CodeGeneration/Sources/SyntaxSupport/PatternNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ public let PATTERN_NODES: [Node] = [
],
children: [
Child(
name: "LabelName",
name: "Label",
deprecatedName: "LabelName",
kind: .token(choices: [.token(tokenKind: "IdentifierToken")]),
nameForDiagnostics: "label",
isOptional: true
),
Child(
name: "LabelColon",
name: "Colon",
deprecatedName: "LabelColon",
kind: .token(choices: [.token(tokenKind: "ColonToken")]),
isOptional: true
),
Expand Down
Loading