diff --git a/CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift b/CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift index 84676b38d3d..d754f437fb4 100644 --- a/CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift @@ -39,19 +39,19 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "AtSignToken", kind: .token(choices: [.token(tokenKind: "AtSignToken")]), - description: "The `@` sign." + documentation: "The `@` sign." ), Child( name: "AttributeName", kind: .node(kind: .type), nameForDiagnostics: "name", - description: "The name of the attribute.", + documentation: "The name of the attribute.", classification: "Attribute" ), Child( name: "LeftParen", kind: .token(choices: [.token(tokenKind: "LeftParenToken")]), - description: "If the attribute takes arguments, the opening parenthesis.", + documentation: "If the attribute takes arguments, the opening parenthesis.", isOptional: true ), Child( @@ -138,13 +138,13 @@ public let ATTRIBUTE_NODES: [Node] = [ kind: .node(kind: .documentationAttributeArguments) ), ]), - description: "The arguments of the attribute. In case the attribute takes multiple arguments, they are gather in the appropriate takes first.", + documentation: "The arguments of the attribute. In case the attribute takes multiple arguments, they are gather in the appropriate takes first.", isOptional: true ), Child( name: "RightParen", kind: .token(choices: [.token(tokenKind: "RightParenToken")]), - description: "If the attribute takes arguments, the closing parenthesis.", + documentation: "If the attribute takes arguments, the closing parenthesis.", isOptional: true ), ] @@ -160,12 +160,12 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "Label", kind: .token(choices: [.keyword(text: "availability")]), nameForDiagnostics: "label", - description: "The label of the argument" + documentation: "The label of the argument" ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating the label and the value" + documentation: "The colon separating the label and the value" ), Child( name: "AvailabilityList", @@ -193,7 +193,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "A trailing comma if the argument is followed by another argument", + documentation: "A trailing comma if the argument is followed by another argument", isOptional: true ), ] @@ -219,17 +219,17 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "BeforeLabel", kind: .token(choices: [.keyword(text: "before")]), - description: "The \"before\" label." + documentation: "The \"before\" label." ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating \"before\" and the parameter list." + documentation: "The colon separating \"before\" and the parameter list." ), Child( name: "VersionList", kind: .collection(kind: .availabilityVersionRestrictionList, collectionElementName: "Availability"), - description: "The list of OS versions in which the declaration became ABI stable." + documentation: "The list of OS versions in which the declaration became ABI stable." ), ] ), @@ -244,7 +244,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "ConventionLabel", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "The convention label." + documentation: "The convention label." ), Child( name: "Comma", @@ -300,13 +300,13 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "DeclBaseName", kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "BinaryOperatorToken"), .keyword(text: "init"), .keyword(text: "self"), .keyword(text: "Self")]), nameForDiagnostics: "base name", - description: "The base name of the protocol's requirement." + documentation: "The base name of the protocol's requirement." ), Child( name: "DeclNameArguments", kind: .node(kind: .declNameArguments), nameForDiagnostics: "arguments", - description: "The argument labels of the protocol's requirement if it is a function requirement.", + documentation: "The argument labels of the protocol's requirement if it is a function requirement.", isOptional: true ), ] @@ -327,28 +327,28 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "OfLabel", kind: .token(choices: [.keyword(text: "of")]), - description: "The \"of\" label." + documentation: "The \"of\" label." ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating the \"of\" label and the original declaration name." + documentation: "The colon separating the \"of\" label and the original declaration name." ), Child( name: "OriginalDeclName", kind: .node(kind: .qualifiedDeclName), - description: "The referenced original declaration name." + documentation: "The referenced original declaration name." ), Child( name: "Period", kind: .token(choices: [.token(tokenKind: "PeriodToken")]), - description: "The period separating the original declaration name and the accessor name.", + documentation: "The period separating the original declaration name and the accessor name.", isOptional: true ), Child( name: "AccessorKind", kind: .token(choices: [.keyword(text: "get"), .keyword(text: "set")]), - description: "The accessor name.", + documentation: "The accessor name.", isOptional: true ), Child( @@ -406,12 +406,12 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "WrtLabel", kind: .token(choices: [.keyword(text: "wrt")]), - description: "The \"wrt\" label." + documentation: "The \"wrt\" label." ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating \"wrt\" and the parameter list." + documentation: "The colon separating \"wrt\" and the parameter list." ), Child( name: "Parameters", @@ -444,7 +444,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "DiffParams", kind: .collection(kind: .differentiabilityParamList, collectionElementName: "DifferentiabilityParam"), - description: "The parameters for differentiation." + documentation: "The parameters for differentiation." ), Child( name: "RightParen", @@ -471,7 +471,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "DiffKindComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "The comma following the differentiability kind, if it exists.", + documentation: "The comma following the differentiability kind, if it exists.", isOptional: true ), Child( @@ -482,7 +482,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "DiffParamsComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "The comma following the differentiability parameters clause, if it exists.", + documentation: "The comma following the differentiability parameters clause, if it exists.", isOptional: true ), Child( @@ -526,7 +526,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "A trailing comma if this argument is followed by another one", + documentation: "A trailing comma if this argument is followed by another one", isOptional: true ), ] @@ -605,24 +605,24 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "Type", kind: .node(kind: .type), nameForDiagnostics: "type", - description: "The type for which the method with this attribute implements a requirement." + documentation: "The type for which the method with this attribute implements a requirement." ), Child( name: "Comma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "The comma separating the type and method name" + documentation: "The comma separating the type and method name" ), Child( name: "DeclBaseName", kind: .node(kind: .token), nameForDiagnostics: "declaration base name", - description: "The base name of the protocol's requirement." + documentation: "The base name of the protocol's requirement." ), Child( name: "DeclNameArguments", kind: .node(kind: .declNameArguments), nameForDiagnostics: "declaration name arguments", - description: "The argument labels of the protocol's requirement if it is a function requirement.", + documentation: "The argument labels of the protocol's requirement if it is a function requirement.", isOptional: true ), ] @@ -643,23 +643,23 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "Label", kind: .node(kind: .token), nameForDiagnostics: "label", - description: "The label of the argument" + documentation: "The label of the argument" ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating the label and the value" + documentation: "The colon separating the label and the value" ), Child( name: "Value", kind: .node(kind: .token), nameForDiagnostics: "value", - description: "The value for this argument" + documentation: "The value for this argument" ), Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "A trailing comma if this argument is followed by another one", + documentation: "A trailing comma if this argument is followed by another one", isOptional: true ), ] @@ -704,7 +704,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "MangledName", kind: .node(kind: .stringLiteralExpr), - description: "The mangled name of a declaration." + documentation: "The mangled name of a declaration." ), Child( name: "Comma", @@ -713,7 +713,7 @@ public let ATTRIBUTE_NODES: [Node] = [ Child( name: "Ordinal", kind: .token(choices: [.token(tokenKind: "IntegerLiteralToken")]), - description: "The ordinal corresponding to the 'some' keyword that introduced this opaque type." + documentation: "The ordinal corresponding to the 'some' keyword that introduced this opaque type." ), ] ), @@ -766,7 +766,7 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "BaseType", kind: .node(kind: .type), nameForDiagnostics: "base type", - description: "The base type of the qualified name, optionally specified.", + documentation: "The base type of the qualified name, optionally specified.", isOptional: true ), Child( @@ -778,13 +778,13 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "Name", kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .keyword(text: "self"), .keyword(text: "Self"), .keyword(text: "init"), .token(tokenKind: "BinaryOperatorToken")]), nameForDiagnostics: "base name", - description: "The base name of the referenced function." + documentation: "The base name of the referenced function." ), Child( name: "Arguments", kind: .node(kind: .declNameArguments), nameForDiagnostics: "arguments", - description: "The argument labels of the referenced function, optionally specified.", + documentation: "The argument labels of the referenced function, optionally specified.", isOptional: true ), ] @@ -818,23 +818,23 @@ public let ATTRIBUTE_NODES: [Node] = [ name: "Label", kind: .token(choices: [.keyword(text: "target")]), nameForDiagnostics: "label", - description: "The label of the argument" + documentation: "The label of the argument" ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating the label and the value" + documentation: "The colon separating the label and the value" ), Child( name: "Declname", kind: .node(kind: .declName), nameForDiagnostics: "declaration name", - description: "The value for this argument" + documentation: "The value for this argument" ), Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "A trailing comma if this argument is followed by another one", + documentation: "A trailing comma if this argument is followed by another one", isOptional: true ), ] diff --git a/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift b/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift index cf801b8f2fa..f25ae4f4c75 100644 --- a/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/AvailabilityNodes.swift @@ -38,12 +38,12 @@ public let AVAILABILITY_NODES: [Node] = [ kind: .node(kind: .availabilityLabeledArgument) ), ]), - description: "The actual argument" + documentation: "The actual argument" ), Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "A trailing comma if the argument is followed by another argument", + documentation: "A trailing comma if the argument is followed by another argument", isOptional: true ), ] @@ -61,12 +61,12 @@ public let AVAILABILITY_NODES: [Node] = [ name: "Label", kind: .token(choices: [.keyword(text: "message"), .keyword(text: "renamed"), .keyword(text: "introduced"), .keyword(text: "obsoleted"), .keyword(text: "deprecated")]), nameForDiagnostics: "label", - description: "The label of the argument" + documentation: "The label of the argument" ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating label and value" + documentation: "The colon separating label and value" ), Child( name: "Value", @@ -81,7 +81,7 @@ public let AVAILABILITY_NODES: [Node] = [ ), ]), nameForDiagnostics: "value", - description: "The value of this labeled argument" + documentation: "The value of this labeled argument" ), ] ), @@ -106,7 +106,7 @@ public let AVAILABILITY_NODES: [Node] = [ name: "Platform", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), nameForDiagnostics: "platform", - description: "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.", + 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" ), Child( @@ -128,12 +128,12 @@ public let AVAILABILITY_NODES: [Node] = [ Child( name: "Period", kind: .token(choices: [.token(tokenKind: "PeriodToken")]), - description: "The period of this version component" + documentation: "The period of this version component" ), Child( name: "Number", kind: .token(choices: [.token(tokenKind: "IntegerLiteralToken")]), - description: "The version number of this component" + documentation: "The version number of this component" ), ] ), @@ -156,12 +156,12 @@ public let AVAILABILITY_NODES: [Node] = [ Child( name: "Major", kind: .token(choices: [.token(tokenKind: "IntegerLiteralToken")]), - description: "The major version." + documentation: "The major version." ), Child( name: "Components", kind: .collection(kind: .versionComponentList, collectionElementName: "VersionComponent"), - description: "Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`", + documentation: "Any version components that are not the major version . For example, for `1.2.0`, this will contain `.2.0`", isOptional: true ), ] diff --git a/CodeGeneration/Sources/SyntaxSupport/Child.swift b/CodeGeneration/Sources/SyntaxSupport/Child.swift index 6b2b755e14f..1d8134bbafe 100644 --- a/CodeGeneration/Sources/SyntaxSupport/Child.swift +++ b/CodeGeneration/Sources/SyntaxSupport/Child.swift @@ -59,7 +59,7 @@ public class Child { public let name: String public let kind: ChildKind public let nameForDiagnostics: String? - public let description: String? + public let documentation: String? public let forceClassification: Bool public let isIndented: Bool public let requiresLeadingNewline: Bool @@ -156,7 +156,7 @@ public class Child { name: String, kind: ChildKind, nameForDiagnostics: String? = nil, - description: String? = nil, + documentation: String? = nil, isOptional: Bool = false, classification: String? = nil, forceClassification: Bool = false, @@ -169,7 +169,7 @@ public class Child { self.name = name self.kind = kind self.nameForDiagnostics = nameForDiagnostics - self.description = description + self.documentation = documentation self.classification = classificationByName(classification) self.forceClassification = forceClassification self.isIndented = isIndented diff --git a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift index 4e28d3418cd..2372c321860 100644 --- a/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift @@ -43,12 +43,12 @@ public let COMMON_NODES: [Node] = [ kind: .node(kind: .expr) ), ]), - description: "The underlying node inside the code block." + documentation: "The underlying node inside the code block." ), Child( name: "Semicolon", kind: .token(choices: [.token(tokenKind: "SemicolonToken")]), - description: "If present, the trailing semicolon at the end of the item.", + documentation: "If present, the trailing semicolon at the end of the item.", isOptional: true ), ] @@ -153,19 +153,19 @@ public let COMMON_NODES: [Node] = [ Child( name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), - description: "If there were standalone attributes without a declaration to attach them to, the `MissingDeclSyntax` will contain these.", + documentation: "If there were standalone attributes without a declaration to attach them to, the `MissingDeclSyntax` will contain these.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), - description: "If there were standalone modifiers without a declaration to attach them to, the `MissingDeclSyntax` will contain these.", + documentation: "If there were standalone modifiers without a declaration to attach them to, the `MissingDeclSyntax` will contain these.", isOptional: true ), Child( name: "Placeholder", kind: .token(choices: [.token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false), - description: """ + documentation: """ A placeholder, i.e. `<#decl#>` that can be inserted into the source code to represent the missing declaration. This token should always have `presence = .missing`. """ @@ -182,7 +182,7 @@ public let COMMON_NODES: [Node] = [ Child( name: "Placeholder", kind: .token(choices: [.token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false), - description: """ + documentation: """ A placeholder, i.e. `<#expression#>` that can be inserted into the source code to represent the missing expression. This token should always have `presence = .missing`. """ @@ -199,7 +199,7 @@ public let COMMON_NODES: [Node] = [ Child( name: "Placeholder", kind: .token(choices: [.token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false), - description: """ + documentation: """ A placeholder, i.e. `<#pattern#>` that can be inserted into the source code to represent the missing pattern. This token should always have `presence = .missing`. """ @@ -216,7 +216,7 @@ public let COMMON_NODES: [Node] = [ Child( name: "Placeholder", kind: .token(choices: [.token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false), - description: """ + documentation: """ A placeholder, i.e. `<#statement#>` that can be inserted into the source code to represent the missing pattern. This token should always have `presence = .missing`. """ @@ -233,7 +233,7 @@ public let COMMON_NODES: [Node] = [ Child( name: "Placeholder", kind: .token(choices: [.token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false), - description: """ + documentation: """ A placeholder, i.e. `<#syntax#>` that can be inserted into the source code to represent the missing pattern. This token should always have `presence = .missing` """ @@ -250,7 +250,7 @@ public let COMMON_NODES: [Node] = [ Child( name: "Placeholder", kind: .token(choices: [.token(tokenKind: "IdentifierToken")], requiresLeadingSpace: false, requiresTrailingSpace: false), - description: """ + documentation: """ A placeholder, i.e. `<#type#>` that can be inserted into the source code to represent the missing type. This token should always have `presence = .missing`. """ ) diff --git a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift index eb18f9e954f..518bcd2767f 100644 --- a/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift @@ -242,44 +242,44 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes attached to the associated type declaration.", + documentation: "Attributes attached to the associated type declaration.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers attached to the associated type declaration.", + documentation: "Modifiers attached to the associated type declaration.", isOptional: true ), Child( name: "AssociatedtypeKeyword", kind: .token(choices: [.keyword(text: "associatedtype")]), - description: "The `associatedtype` keyword for this declaration." + documentation: "The `associatedtype` keyword for this declaration." ), Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "The name of this associated type." + documentation: "The name of this associated type." ), Child( name: "InheritanceClause", kind: .node(kind: .typeInheritanceClause), nameForDiagnostics: "inheritance clause", - description: "The inheritance clause describing conformances for this associated type declaration.", + documentation: "The inheritance clause describing conformances for this associated type declaration.", isOptional: true ), Child( name: "Initializer", kind: .node(kind: .typeInitializerClause), - description: "The type initializer clause for this associated type declaration which represents a default type assignment for the associated type.", + documentation: "The type initializer clause for this associated type declaration which represents a default type assignment for the associated type.", isOptional: true ), Child( name: "GenericWhereClause", kind: .node(kind: .genericWhereClause), nameForDiagnostics: "generic where clause", - description: "The `where` clause that applies to the generic parameters of this associated type declaration.", + documentation: "The `where` clause that applies to the generic parameters of this associated type declaration.", isOptional: true ), ] @@ -330,51 +330,51 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes attached to the class declaration, such as an `@available` attribute.", + documentation: "Attributes attached to the class declaration, such as an `@available` attribute.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers attached to the class declaration, such as `public`.", + documentation: "Modifiers attached to the class declaration, such as `public`.", isOptional: true ), Child( name: "ClassKeyword", kind: .token(choices: [.keyword(text: "class")]), - description: "The `class` keyword for this declaration." + documentation: "The `class` keyword for this declaration." ), Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "The name of the class." + documentation: "The name of the class." ), Child( name: "GenericParameterClause", kind: .node(kind: .genericParameterClause), nameForDiagnostics: "generic parameter clause", - description: "The generic parameters, if any, of the class declaration.", + documentation: "The generic parameters, if any, of the class declaration.", isOptional: true ), Child( name: "InheritanceClause", kind: .node(kind: .typeInheritanceClause), nameForDiagnostics: "inheritance clause", - description: "The inheritance clause describing one or more conformances for this class declaration.", + documentation: "The inheritance clause describing one or more conformances for this class declaration.", isOptional: true ), Child( name: "GenericWhereClause", kind: .node(kind: .genericWhereClause), nameForDiagnostics: "generic where clause", - description: "The `where` clause that applies to the generic parameters of this class declaration.", + documentation: "The `where` clause that applies to the generic parameters of this class declaration.", isOptional: true ), Child( name: "MemberBlock", kind: .node(kind: .memberDeclBlock), - description: "The members of the class declaration. As class extension declarations may declare additional members, the contents of this member block isn't guaranteed to be a complete list of members for this type." + documentation: "The members of the class declaration. As class extension declarations may declare additional members, the contents of this member block isn't guaranteed to be a complete list of members for this type." ), ] ), @@ -478,25 +478,25 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes that are attached to the deinitializer.", + documentation: "Attributes that are attached to the deinitializer.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers that are attached to the deinitializer.", + documentation: "Modifiers that are attached to the deinitializer.", isOptional: true ), Child( name: "DeinitKeyword", kind: .token(choices: [.keyword(text: "deinit")]), - description: "The deinit keyword." + documentation: "The deinit keyword." ), Child( name: "Body", kind: .node(kind: .codeBlock), - description: "The deinitializer's body.", + documentation: "The deinitializer's body.", isOptional: true ), ] @@ -550,19 +550,19 @@ public let DECL_NODES: [Node] = [ Child( name: "LeftParen", kind: .token(choices: [.token(tokenKind: "LeftParenToken")]), - description: "The '(' to open the parameter clause." + documentation: "The '(' to open the parameter clause." ), Child( name: "ParameterList", kind: .collection(kind: .enumCaseParameterList, collectionElementName: "Parameter"), nameForDiagnostics: "parameters", - description: "The actual parameters.", + documentation: "The actual parameters.", isIndented: true ), Child( name: "RightParen", kind: .token(choices: [.token(tokenKind: "RightParenToken")]), - description: "The ')' to close the parameter clause." + documentation: "The ')' to close the parameter clause." ), ] ), @@ -600,26 +600,26 @@ public let DECL_NODES: [Node] = [ Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "If the parameter has a label, the colon separating the label from the type.", + documentation: "If the parameter has a label, the colon separating the label from the type.", isOptional: true ), Child( name: "Type", kind: .node(kind: .type), nameForDiagnostics: "type", - description: "The parameter's type." + documentation: "The parameter's type." ), Child( name: "DefaultArgument", kind: .node(kind: .initializerClause), nameForDiagnostics: "default argument", - description: "If the parameter has a default value, the initializer clause describing the default value.", + documentation: "If the parameter has a default value, the initializer clause describing the default value.", isOptional: true ), Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "If the parameter is followed by another parameter, the comma separating them.", + documentation: "If the parameter is followed by another parameter, the comma separating them.", isOptional: true ), ] @@ -639,26 +639,26 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "The attributes applied to the case declaration.", + documentation: "The attributes applied to the case declaration.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "The declaration modifiers applied to the case declaration.", + documentation: "The declaration modifiers applied to the case declaration.", isOptional: true ), Child( name: "CaseKeyword", kind: .token(choices: [.keyword(text: "case")]), - description: "The `case` keyword for this case." + documentation: "The `case` keyword for this case." ), Child( name: "Elements", kind: .collection(kind: .enumCaseElementList, collectionElementName: "Element"), nameForDiagnostics: "elements", - description: "The elements this case declares." + documentation: "The elements this case declares." ), ] ), @@ -683,25 +683,25 @@ public let DECL_NODES: [Node] = [ Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "The name of this case." + documentation: "The name of this case." ), Child( name: "AssociatedValue", kind: .node(kind: .enumCaseParameterClause), nameForDiagnostics: "associated values", - description: "The set of associated values of the case.", + documentation: "The set of associated values of the case.", isOptional: true ), Child( name: "RawValue", kind: .node(kind: .initializerClause), - description: "The raw value of this enum element, if present.", + documentation: "The raw value of this enum element, if present.", isOptional: true ), Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "The trailing comma of this element, if the case has multiple elements.", + documentation: "The trailing comma of this element, if the case has multiple elements.", isOptional: true ), ] @@ -723,51 +723,51 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "The attributes applied to the enum declaration.", + documentation: "The attributes applied to the enum declaration.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "The declaration modifiers applied to the enum declaration.", + documentation: "The declaration modifiers applied to the enum declaration.", isOptional: true ), Child( name: "EnumKeyword", kind: .token(choices: [.keyword(text: "enum")]), - description: "The `enum` keyword for this declaration." + documentation: "The `enum` keyword for this declaration." ), Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "Declares the name of this enum. If the name matches a reserved keyword use backticks to escape it." + documentation: "Declares the name of this enum. If the name matches a reserved keyword use backticks to escape it." ), Child( name: "GenericParameterClause", kind: .node(kind: .genericParameterClause), nameForDiagnostics: "generic parameter clause", - description: "The generic parameters, if any, for this enum declaration.", + documentation: "The generic parameters, if any, for this enum declaration.", isOptional: true ), Child( name: "InheritanceClause", kind: .node(kind: .typeInheritanceClause), nameForDiagnostics: "inheritance clause", - description: "The inheritance clause describing conformances or raw values for this enum declaration.", + documentation: "The inheritance clause describing conformances or raw values for this enum declaration.", isOptional: true ), Child( name: "GenericWhereClause", kind: .node(kind: .genericWhereClause), nameForDiagnostics: "generic where clause", - description: "The `where` clause that applies to the generic parameters of this enum declaration.", + documentation: "The `where` clause that applies to the generic parameters of this enum declaration.", isOptional: true ), Child( name: "MemberBlock", kind: .node(kind: .memberDeclBlock), - description: "The cases and other members associated with this enum declaration. Because enum extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type." + documentation: "The cases and other members associated with this enum declaration. Because enum extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type." ), ] ), @@ -1071,31 +1071,31 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes attached to the import declaration, for example `@testable`.", + documentation: "Attributes attached to the import declaration, for example `@testable`.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers attached to the import declaration. Currently, no modifiers are supported by Swift.", + documentation: "Modifiers attached to the import declaration. Currently, no modifiers are supported by Swift.", isOptional: true ), Child( name: "ImportTok", kind: .token(choices: [.keyword(text: "import")]), - description: "The `import` keyword for this declaration." + documentation: "The `import` keyword for this declaration." ), Child( name: "ImportKind", kind: .token(choices: [.keyword(text: "typealias"), .keyword(text: "struct"), .keyword(text: "class"), .keyword(text: "enum"), .keyword(text: "protocol"), .keyword(text: "var"), .keyword(text: "let"), .keyword(text: "func"), .keyword(text: "inout")]), - description: "The kind of declaration being imported. For example, a struct can be imported from a specific module.", + documentation: "The kind of declaration being imported. For example, a struct can be imported from a specific module.", isOptional: true ), Child( name: "Path", kind: .collection(kind: .importPath, collectionElementName: "PathComponent"), - description: "The path to the module, submodule or symbol being imported." + documentation: "The path to the module, submodule or symbol being imported." ), ] ), @@ -1167,51 +1167,51 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes that are attached to the initializer.", + documentation: "Attributes that are attached to the initializer.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers attached to the initializer", + documentation: "Modifiers attached to the initializer", isOptional: true ), Child( name: "InitKeyword", kind: .token(choices: [.keyword(text: "init")]), - description: "The init keyword" + documentation: "The init keyword" ), Child( name: "OptionalMark", kind: .token(choices: [.token(tokenKind: "PostfixQuestionMarkToken"), .token(tokenKind: "InfixQuestionMarkToken"), .token(tokenKind: "ExclamationMarkToken")]), - description: "If the initializer is failable, a question mark to indicate that.", + documentation: "If the initializer is failable, a question mark to indicate that.", isOptional: true ), Child( name: "GenericParameterClause", kind: .node(kind: .genericParameterClause), nameForDiagnostics: "generic parameter clause", - description: "Generic parameters of the initializer.", + documentation: "Generic parameters of the initializer.", isOptional: true ), Child( name: "Signature", kind: .node(kind: .functionSignature), nameForDiagnostics: "function signature", - description: "The arguments of the initializer. While the function signature allows specifying an return clause, doing so is not semantically valid." + documentation: "The arguments of the initializer. While the function signature allows specifying an return clause, doing so is not semantically valid." ), Child( name: "GenericWhereClause", kind: .node(kind: .genericWhereClause), nameForDiagnostics: "generic where clause", - description: "If the initializer had generic parameters, a where clause that can restrict those", + documentation: "If the initializer had generic parameters, a where clause that can restrict those", isOptional: true ), Child( name: "Body", kind: .node(kind: .codeBlock), - description: "The initializer’s body. Missing if the initialier is a requirement of a protocol declaration.", + documentation: "The initializer’s body. Missing if the initialier is a requirement of a protocol declaration.", isOptional: true ), ] @@ -1299,7 +1299,7 @@ public let DECL_NODES: [Node] = [ Child( name: "PoundToken", kind: .token(choices: [.token(tokenKind: "PoundToken")]), - description: "The `#` sign." + documentation: "The `#` sign." ), Child( name: "Macro", @@ -1371,12 +1371,12 @@ public let DECL_NODES: [Node] = [ Child( name: "Decl", kind: .node(kind: .decl), - description: "The declaration of the type member." + documentation: "The declaration of the type member." ), Child( name: "Semicolon", kind: .token(choices: [.token(tokenKind: "SemicolonToken")]), - description: "An optional trailing semicolon.", + documentation: "An optional trailing semicolon.", isOptional: true ), ] @@ -1435,14 +1435,14 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "The attributes applied to the 'operator' declaration.", + documentation: "The attributes applied to the 'operator' declaration.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "The declaration modifiers applied to the 'operator' declaration.", + documentation: "The declaration modifiers applied to the 'operator' declaration.", isOptional: true, classification: "Attribute" ), @@ -1458,7 +1458,7 @@ public let DECL_NODES: [Node] = [ Child( name: "OperatorPrecedenceAndTypes", kind: .node(kind: .operatorPrecedenceAndTypes), - description: "Optionally specify a precedence group and designated types.", + documentation: "Optionally specify a precedence group and designated types.", isOptional: true ), ] @@ -1479,12 +1479,12 @@ public let DECL_NODES: [Node] = [ name: "PrecedenceGroup", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), nameForDiagnostics: "precedence group", - description: "The precedence group for this operator" + documentation: "The precedence group for this operator" ), Child( name: "DesignatedTypes", kind: .collection(kind: .designatedTypeList, collectionElementName: "DesignatedTypeElement"), - description: "The designated types associated with this operator." + documentation: "The designated types associated with this operator." ), ] ), @@ -1653,7 +1653,7 @@ public let DECL_NODES: [Node] = [ Child( name: "Flag", kind: .token(choices: [.keyword(text: "true"), .keyword(text: "false")]), - description: "When true, an operator in the corresponding precedence group uses the same grouping rules during optional chaining as the assignment operators from the standard library. Otherwise, operators in the precedence group follows the same optional chaining rules as operators that don't perform assignment." + documentation: "When true, an operator in the corresponding precedence group uses the same grouping rules during optional chaining as the assignment operators from the standard library. Otherwise, operators in the precedence group follows the same optional chaining rules as operators that don't perform assignment." ), ] ), @@ -1678,7 +1678,7 @@ public let DECL_NODES: [Node] = [ Child( name: "Value", kind: .token(choices: [.keyword(text: "left"), .keyword(text: "right"), .keyword(text: "none")]), - description: "Operators that are `left`-associative group left-to-right. Operators that are `right`-associative group right-to-left. Operators that are specified with an associativity of `none` don't associate at all" + documentation: "Operators that are `left`-associative group left-to-right. Operators that are `right`-associative group right-to-left. Operators that are specified with an associativity of `none` don't associate at all" ), ] ), @@ -1710,14 +1710,14 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "The attributes applied to the 'precedencegroup' declaration.", + documentation: "The attributes applied to the 'precedencegroup' declaration.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "The declaration modifiers applied to the 'precedencegroup' declaration.", + documentation: "The declaration modifiers applied to the 'precedencegroup' declaration.", isOptional: true ), Child( @@ -1727,7 +1727,7 @@ public let DECL_NODES: [Node] = [ Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "The name of this precedence group." + documentation: "The name of this precedence group." ), Child( name: "LeftBrace", @@ -1736,7 +1736,7 @@ public let DECL_NODES: [Node] = [ Child( name: "GroupAttributes", kind: .collection(kind: .precedenceGroupAttributeList, collectionElementName: "GroupAttribute"), - description: "The characteristics of this precedence group." + documentation: "The characteristics of this precedence group." ), Child( name: "RightBrace", @@ -1783,7 +1783,7 @@ public let DECL_NODES: [Node] = [ Child( name: "HigherThanOrLowerThan", kind: .token(choices: [.keyword(text: "higherThan"), .keyword(text: "lowerThan")]), - description: "The relation to specified other precedence groups.", + documentation: "The relation to specified other precedence groups.", classification: "Keyword" ), Child( @@ -1793,7 +1793,7 @@ public let DECL_NODES: [Node] = [ Child( name: "OtherNames", kind: .collection(kind: .precedenceGroupNameList, collectionElementName: "OtherName"), - description: "The name of other precedence group to which this precedence group relates." + documentation: "The name of other precedence group to which this precedence group relates." ), ] ), @@ -1822,51 +1822,51 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes attached to the protocol declaration, such as an `@available` attribute.", + documentation: "Attributes attached to the protocol declaration, such as an `@available` attribute.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers attached to the protocol declaration, such as `public`.", + documentation: "Modifiers attached to the protocol declaration, such as `public`.", isOptional: true ), Child( name: "ProtocolKeyword", kind: .token(choices: [.keyword(text: "protocol")]), - description: "The `protocol` keyword for this declaration." + documentation: "The `protocol` keyword for this declaration." ), Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "The name of the protocol." + documentation: "The name of the protocol." ), Child( name: "PrimaryAssociatedTypeClause", kind: .node(kind: .primaryAssociatedTypeClause), nameForDiagnostics: "primary associated type clause", - description: "The primary associated type for the protocol.", + documentation: "The primary associated type for the protocol.", isOptional: true ), Child( name: "InheritanceClause", kind: .node(kind: .typeInheritanceClause), nameForDiagnostics: "inheritance clause", - description: "The inheritance clause describing one or more conformances for this protocol declaration.", + documentation: "The inheritance clause describing one or more conformances for this protocol declaration.", isOptional: true ), Child( name: "GenericWhereClause", kind: .node(kind: .genericWhereClause), nameForDiagnostics: "generic where clause", - description: "The `where` clause that applies to the generic parameters of this protocol declaration.", + documentation: "The `where` clause that applies to the generic parameters of this protocol declaration.", isOptional: true ), Child( name: "MemberBlock", kind: .node(kind: .memberDeclBlock), - description: "The members of the protocol declaration." + documentation: "The members of the protocol declaration." ), ] ), @@ -1988,51 +1988,51 @@ public let DECL_NODES: [Node] = [ name: "Attributes", kind: .collection(kind: .attributeList, collectionElementName: "Attribute"), nameForDiagnostics: "attributes", - description: "Attributes that are attached to the struct declaration.", + documentation: "Attributes that are attached to the struct declaration.", isOptional: true ), Child( name: "Modifiers", kind: .collection(kind: .modifierList, collectionElementName: "Modifier"), nameForDiagnostics: "modifiers", - description: "Modifiers that are attached to the struct declaration.", + documentation: "Modifiers that are attached to the struct declaration.", isOptional: true ), Child( name: "StructKeyword", kind: .token(choices: [.keyword(text: "struct")]), - description: "The `struct` keyword for this declaration." + documentation: "The `struct` keyword for this declaration." ), Child( name: "Identifier", kind: .token(choices: [.token(tokenKind: "IdentifierToken")]), - description: "Declares the name of this struct. If the name matches a reserved keyword use backticks to escape it." + documentation: "Declares the name of this struct. If the name matches a reserved keyword use backticks to escape it." ), Child( name: "GenericParameterClause", kind: .node(kind: .genericParameterClause), nameForDiagnostics: "generic parameter clause", - description: "The generic parameters, if any, of the struct declaration.", + documentation: "The generic parameters, if any, of the struct declaration.", isOptional: true ), Child( name: "InheritanceClause", kind: .node(kind: .typeInheritanceClause), nameForDiagnostics: "type inheritance clause", - description: "The struct declaration inheritance clause describing one or more conformances for this struct declaration.", + documentation: "The struct declaration inheritance clause describing one or more conformances for this struct declaration.", isOptional: true ), Child( name: "GenericWhereClause", kind: .node(kind: .genericWhereClause), nameForDiagnostics: "generic where clause", - description: "The `where` clause that applies to the generic parameters of this struct declaration.", + documentation: "The `where` clause that applies to the generic parameters of this struct declaration.", isOptional: true ), Child( name: "MemberBlock", kind: .node(kind: .memberDeclBlock), - description: "The members of the struct declaration. Because struct extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type." + documentation: "The members of the struct declaration. Because struct extension declarations may declare additional members the contents of this member block isn't guaranteed to be a complete list of members for this type." ), ] ), diff --git a/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift b/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift index 2b713d3bc6a..2d25782cd26 100644 --- a/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift +++ b/CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift @@ -377,37 +377,37 @@ public let EXPR_NODES: [Node] = [ Child( name: "FirstName", kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "WildcardToken")]), - description: "The label of this parameter that will be used when the closure is called." + documentation: "The label of this parameter that will be used when the closure is called." ), Child( name: "SecondName", kind: .token(choices: [.token(tokenKind: "IdentifierToken"), .token(tokenKind: "WildcardToken")]), - description: "If this is specified, it is the name by which the parameter can be referenced inside the closure body. If it is `nil`, the closure parameter is referenced by the first name.", + documentation: "If this is specified, it is the name by which the parameter can be referenced inside the closure body. If it is `nil`, the closure parameter is referenced by the first name.", isOptional: true ), Child( name: "Colon", kind: .token(choices: [.token(tokenKind: "ColonToken")]), - description: "The colon separating the parameter's name and type.", + documentation: "The colon separating the parameter's name and type.", isOptional: true ), Child( name: "Type", kind: .node(kind: .type), nameForDiagnostics: "type", - description: "The type of the parameter.", + documentation: "The type of the parameter.", isOptional: true ), Child( name: "Ellipsis", kind: .token(choices: [.token(tokenKind: "EllipsisToken")]), - description: "If the parameter is variadic, `...` to indicate that.", + documentation: "If the parameter is variadic, `...` to indicate that.", isOptional: true ), Child( name: "TrailingComma", kind: .token(choices: [.token(tokenKind: "CommaToken")]), - description: "If the parameter is followed by another parameter, the comma separating them.", + documentation: "If the parameter is followed by another parameter, the comma separating them.", isOptional: true ), ] @@ -431,19 +431,19 @@ public let EXPR_NODES: [Node] = [ Child( name: "LeftParen", kind: .token(choices: [.token(tokenKind: "LeftParenToken")]), - description: "The '(' to open the parameter clause." + documentation: "The '(' to open the parameter clause." ), Child( name: "ParameterList", kind: .collection(kind: .closureParameterList, collectionElementName: "Parameter"), nameForDiagnostics: "parameters", - description: "The actual parameters.", + documentation: "The actual parameters.", isIndented: true ), Child( name: "RightParen", kind: .token(choices: [.token(tokenKind: "RightParenToken")]), - description: "The ')' to close the parameter clause." + documentation: "The ')' to close the parameter clause." ), ] ), @@ -970,17 +970,17 @@ public let EXPR_NODES: [Node] = [ Child( name: "Expression", kind: .node(kind: .expr), - description: "The expression which will be checked to determine whether it can be cast to a specific type." + documentation: "The expression which will be checked to determine whether it can be cast to a specific type." ), Child( name: "IsTok", kind: .token(choices: [.keyword(text: "is")]), - description: "The `is` keyword for this expression." + documentation: "The `is` keyword for this expression." ), Child( name: "TypeName", kind: .node(kind: .type), - description: "The type against which the expression will be checked to see if the expression can be cast to it." + documentation: "The type against which the expression will be checked to see if the expression can be cast to it." ), ] ), @@ -1117,7 +1117,7 @@ public let EXPR_NODES: [Node] = [ Child( name: "PoundToken", kind: .token(choices: [.token(tokenKind: "PoundToken")]), - description: "The `#` sign." + documentation: "The `#` sign." ), Child( name: "Macro", diff --git a/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift b/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift index 40d209787cd..e56eb7a45f9 100644 --- a/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift +++ b/CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift @@ -57,12 +57,6 @@ public extension Child { return self.type.optionalWrapped(type: SimpleTypeIdentifierSyntax(name: .identifier(parameterBaseType))) } - /// If the child node has documentation associated with it, return it as single - /// line string. Otherwise return an empty string. - var documentation: String { - flattened(indentedDocumentation: description ?? "") - } - /// If the child node has a default value, return an expression of the form /// ` = default_value` that can be used as the default value to for a /// function parameter. Otherwise, return `nil`. diff --git a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift index a91e434720c..439353c6509 100644 --- a/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift +++ b/CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift @@ -17,7 +17,7 @@ import Utils extension Child { public var docComment: SwiftSyntax.Trivia { - guard let description = description else { + guard let description = documentation else { return [] } let dedented = dedented(string: description)