Skip to content

Prevent incorrect node_choices and ignore token_choices #1034

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 7 commits into from
Oct 28, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,15 @@ public let ATTRIBUTE_NODES: [Node] = [
description: "The arguments of the attribute. In case the attributetakes multiple arguments, they are gather in theappropriate takes first.",
isOptional: true,
nodeChoices: [
Child(name: "Identifier",
kind: "IdentifierToken",
tokenChoices: [
"Identifier"
]),
Child(name: "String",
kind: "StringLiteralToken",
tokenChoices: [
"StringLiteral"
]),
Child(name: "Integer",
kind: "IntegerLiteralToken",
Child(name: "Token",
kind: "Token",
tokenChoices: [
"Identifier",
"StringLiteral",
"IntegerLiteral"
]),
Child(name: "StringExpr",
kind: "StringLiteralExpr"),
Child(name: "Availability",
kind: "AvailabilitySpecList"),
Child(name: "SpecializeArguments",
Expand All @@ -119,6 +113,8 @@ public let ATTRIBUTE_NODES: [Node] = [
kind: "ConventionAttributeArguments"),
Child(name: "ConventionWitnessMethodArguments",
kind: "ConventionWitnessMethodAttributeArguments"),
Child(name: "OpaqueReturnTypeOfAttributeArguments",
kind: "OpaqueReturnTypeOfAttributeArguments"),
Child(name: "TokenList",
kind: "TokenList",
collectionElementName: "Token")
Expand All @@ -141,7 +137,7 @@ public let ATTRIBUTE_NODES: [Node] = [
kind: "SyntaxCollection",
element: "Syntax",
elementName: "Attribute",
elementChoices: ["Attribute", "CustomAttribute"],
elementChoices: ["Attribute", "CustomAttribute", "IfConfigDecl"],
omitWhenEmpty: true),

Node(name: "SpecializeAttributeSpecList",
Expand Down Expand Up @@ -275,19 +271,11 @@ public let ATTRIBUTE_NODES: [Node] = [
kind: "Syntax",
children: [
Child(name: "DeclBaseName",
kind: "Syntax",
kind: "Token",
description: "The base name of the protocol's requirement.",
nodeChoices: [
Child(name: "Identifier",
kind: "IdentifierToken",
tokenChoices: [
"Identifier"
]),
Child(name: "Operator",
kind: "PrefixOperatorToken",
tokenChoices: [
"PrefixOperator"
])
tokenChoices: [
"Identifier",
"PrefixOperator"
]),
Child(name: "DeclNameArguments",
kind: "DeclNameArguments",
Expand Down Expand Up @@ -445,23 +433,11 @@ public let ATTRIBUTE_NODES: [Node] = [
],
children: [
Child(name: "Parameter",
kind: "Syntax",
nodeChoices: [
Child(name: "Self",
kind: "SelfToken",
tokenChoices: [
"Self"
]),
Child(name: "Name",
kind: "IdentifierToken",
tokenChoices: [
"Identifier"
]),
Child(name: "Index",
kind: "IntegerLiteralToken",
tokenChoices: [
"IntegerLiteral"
])
kind: "Token",
tokenChoices: [
"Self",
"Identifier",
"IntegerLiteral"
]),
Child(name: "TrailingComma",
kind: "CommaToken",
Expand Down Expand Up @@ -561,24 +537,12 @@ public let ATTRIBUTE_NODES: [Node] = [
kind: "Syntax",
children: [
Child(name: "Name",
kind: "Syntax",
kind: "Token",
description: "The base name of the referenced function.",
nodeChoices: [
Child(name: "Identifier",
kind: "IdentifierToken",
tokenChoices: [
"Identifier"
]),
Child(name: "PrefixOperator",
kind: "PrefixOperatorToken",
tokenChoices: [
"PrefixOperator"
]),
Child(name: "SpacedBinaryOperator",
kind: "SpacedBinaryOperatorToken",
tokenChoices: [
"SpacedBinaryOperator"
])
tokenChoices: [
"Identifier",
"PrefixOperator",
"SpacedBinaryOperator"
]),
Child(name: "Arguments",
kind: "DeclNameArguments",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,18 @@ public let AVAILABILITY_NODES: [Node] = [
kind: "Syntax",
description: "The actual argument",
nodeChoices: [
Child(name: "Star",
kind: "SpacedBinaryOperatorToken",
tokenChoices: [
"SpacedBinaryOperator"
],
textChoices: [
"*"
]),
Child(name: "IdentifierRestriction",
kind: "IdentifierToken",
Child(name: "Token",
kind: "Token",
tokenChoices: [
"SpacedBinaryOperator",
"Identifier"
]),
Child(name: "AvailabilityVersionRestriction",
kind: "AvailabilityVersionRestriction"),
Child(name: "AvailabilityLabeledArgument",
kind: "AvailabilityLabeledArgument")
kind: "AvailabilityLabeledArgument"),
Child(name: "TokenList",
kind: "TokenList")
]),
Child(name: "TrailingComma",
kind: "CommaToken",
Expand Down Expand Up @@ -108,19 +103,11 @@ public let AVAILABILITY_NODES: [Node] = [
kind: "Syntax",
children: [
Child(name: "MajorMinor",
kind: "Syntax",
kind: "Token",
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.",
nodeChoices: [
Child(name: "Major",
kind: "IntegerLiteralToken",
tokenChoices: [
"IntegerLiteral"
]),
Child(name: "MajorMinor",
kind: "FloatingLiteralToken",
tokenChoices: [
"FloatingLiteral"
])
tokenChoices: [
"IntegerLiteral",
"FloatingLiteral"
]),
Child(name: "PatchPeriod",
kind: "PeriodToken",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public let DECL_NODES: [Node] = [
Child(name: "Decls",
kind: "MemberDeclList"),
Child(name: "PostfixExpression",
kind: "Expr")
kind: "Expr"),
Child(name: "Attributes",
kind: "AttributeList")
])
]),

Expand Down
Loading