Skip to content

Commit 5881fce

Browse files
authored
Merge pull request #1034 from ahoppen/ahoppen/raw-node-choices
Prevent incorrect `node_choices` and ignore `token_choices`
2 parents 41b0bd8 + f7b50bc commit 5881fce

30 files changed

+3325
-2353
lines changed

CodeGeneration/Sources/SyntaxSupport/gyb_generated/AttributeNodes.swift

Lines changed: 23 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,15 @@ public let ATTRIBUTE_NODES: [Node] = [
8484
description: "The arguments of the attribute. In case the attributetakes multiple arguments, they are gather in theappropriate takes first.",
8585
isOptional: true,
8686
nodeChoices: [
87-
Child(name: "Identifier",
88-
kind: "IdentifierToken",
89-
tokenChoices: [
90-
"Identifier"
91-
]),
92-
Child(name: "String",
93-
kind: "StringLiteralToken",
94-
tokenChoices: [
95-
"StringLiteral"
96-
]),
97-
Child(name: "Integer",
98-
kind: "IntegerLiteralToken",
87+
Child(name: "Token",
88+
kind: "Token",
9989
tokenChoices: [
90+
"Identifier",
91+
"StringLiteral",
10092
"IntegerLiteral"
10193
]),
94+
Child(name: "StringExpr",
95+
kind: "StringLiteralExpr"),
10296
Child(name: "Availability",
10397
kind: "AvailabilitySpecList"),
10498
Child(name: "SpecializeArguments",
@@ -119,6 +113,8 @@ public let ATTRIBUTE_NODES: [Node] = [
119113
kind: "ConventionAttributeArguments"),
120114
Child(name: "ConventionWitnessMethodArguments",
121115
kind: "ConventionWitnessMethodAttributeArguments"),
116+
Child(name: "OpaqueReturnTypeOfAttributeArguments",
117+
kind: "OpaqueReturnTypeOfAttributeArguments"),
122118
Child(name: "TokenList",
123119
kind: "TokenList",
124120
collectionElementName: "Token")
@@ -141,7 +137,7 @@ public let ATTRIBUTE_NODES: [Node] = [
141137
kind: "SyntaxCollection",
142138
element: "Syntax",
143139
elementName: "Attribute",
144-
elementChoices: ["Attribute", "CustomAttribute"],
140+
elementChoices: ["Attribute", "CustomAttribute", "IfConfigDecl"],
145141
omitWhenEmpty: true),
146142

147143
Node(name: "SpecializeAttributeSpecList",
@@ -275,19 +271,11 @@ public let ATTRIBUTE_NODES: [Node] = [
275271
kind: "Syntax",
276272
children: [
277273
Child(name: "DeclBaseName",
278-
kind: "Syntax",
274+
kind: "Token",
279275
description: "The base name of the protocol's requirement.",
280-
nodeChoices: [
281-
Child(name: "Identifier",
282-
kind: "IdentifierToken",
283-
tokenChoices: [
284-
"Identifier"
285-
]),
286-
Child(name: "Operator",
287-
kind: "PrefixOperatorToken",
288-
tokenChoices: [
289-
"PrefixOperator"
290-
])
276+
tokenChoices: [
277+
"Identifier",
278+
"PrefixOperator"
291279
]),
292280
Child(name: "DeclNameArguments",
293281
kind: "DeclNameArguments",
@@ -445,23 +433,11 @@ public let ATTRIBUTE_NODES: [Node] = [
445433
],
446434
children: [
447435
Child(name: "Parameter",
448-
kind: "Syntax",
449-
nodeChoices: [
450-
Child(name: "Self",
451-
kind: "SelfToken",
452-
tokenChoices: [
453-
"Self"
454-
]),
455-
Child(name: "Name",
456-
kind: "IdentifierToken",
457-
tokenChoices: [
458-
"Identifier"
459-
]),
460-
Child(name: "Index",
461-
kind: "IntegerLiteralToken",
462-
tokenChoices: [
463-
"IntegerLiteral"
464-
])
436+
kind: "Token",
437+
tokenChoices: [
438+
"Self",
439+
"Identifier",
440+
"IntegerLiteral"
465441
]),
466442
Child(name: "TrailingComma",
467443
kind: "CommaToken",
@@ -561,24 +537,12 @@ public let ATTRIBUTE_NODES: [Node] = [
561537
kind: "Syntax",
562538
children: [
563539
Child(name: "Name",
564-
kind: "Syntax",
540+
kind: "Token",
565541
description: "The base name of the referenced function.",
566-
nodeChoices: [
567-
Child(name: "Identifier",
568-
kind: "IdentifierToken",
569-
tokenChoices: [
570-
"Identifier"
571-
]),
572-
Child(name: "PrefixOperator",
573-
kind: "PrefixOperatorToken",
574-
tokenChoices: [
575-
"PrefixOperator"
576-
]),
577-
Child(name: "SpacedBinaryOperator",
578-
kind: "SpacedBinaryOperatorToken",
579-
tokenChoices: [
580-
"SpacedBinaryOperator"
581-
])
542+
tokenChoices: [
543+
"Identifier",
544+
"PrefixOperator",
545+
"SpacedBinaryOperator"
582546
]),
583547
Child(name: "Arguments",
584548
kind: "DeclNameArguments",

CodeGeneration/Sources/SyntaxSupport/gyb_generated/AvailabilityNodes.swift

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,18 @@ public let AVAILABILITY_NODES: [Node] = [
2727
kind: "Syntax",
2828
description: "The actual argument",
2929
nodeChoices: [
30-
Child(name: "Star",
31-
kind: "SpacedBinaryOperatorToken",
32-
tokenChoices: [
33-
"SpacedBinaryOperator"
34-
],
35-
textChoices: [
36-
"*"
37-
]),
38-
Child(name: "IdentifierRestriction",
39-
kind: "IdentifierToken",
30+
Child(name: "Token",
31+
kind: "Token",
4032
tokenChoices: [
33+
"SpacedBinaryOperator",
4134
"Identifier"
4235
]),
4336
Child(name: "AvailabilityVersionRestriction",
4437
kind: "AvailabilityVersionRestriction"),
4538
Child(name: "AvailabilityLabeledArgument",
46-
kind: "AvailabilityLabeledArgument")
39+
kind: "AvailabilityLabeledArgument"),
40+
Child(name: "TokenList",
41+
kind: "TokenList")
4742
]),
4843
Child(name: "TrailingComma",
4944
kind: "CommaToken",
@@ -108,19 +103,11 @@ public let AVAILABILITY_NODES: [Node] = [
108103
kind: "Syntax",
109104
children: [
110105
Child(name: "MajorMinor",
111-
kind: "Syntax",
106+
kind: "Token",
112107
description: "In case the version consists only of the major version, aninteger literal that specifies the major version. In casethe version consists of major and minor version number, afloating literal in which the decimal part is interpretedas the minor version.",
113-
nodeChoices: [
114-
Child(name: "Major",
115-
kind: "IntegerLiteralToken",
116-
tokenChoices: [
117-
"IntegerLiteral"
118-
]),
119-
Child(name: "MajorMinor",
120-
kind: "FloatingLiteralToken",
121-
tokenChoices: [
122-
"FloatingLiteral"
123-
])
108+
tokenChoices: [
109+
"IntegerLiteral",
110+
"FloatingLiteral"
124111
]),
125112
Child(name: "PatchPeriod",
126113
kind: "PeriodToken",

CodeGeneration/Sources/SyntaxSupport/gyb_generated/DeclNodes.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ public let DECL_NODES: [Node] = [
192192
Child(name: "Decls",
193193
kind: "MemberDeclList"),
194194
Child(name: "PostfixExpression",
195-
kind: "Expr")
195+
kind: "Expr"),
196+
Child(name: "Attributes",
197+
kind: "AttributeList")
196198
])
197199
]),
198200

0 commit comments

Comments
 (0)