@@ -43,6 +43,10 @@ public protocol ${kind}ListBuildable {
43
43
% else :
44
44
public protocol ${ kind} ListBuildable: SyntaxListBuildable {
45
45
% end
46
+ /// Builds list of `${build_kind}`s.
47
+ /// - Parameter format: The `Format` to use.
48
+ /// - Parameter leadingTrivia: Replaces the the last leading trivia if not nil.
49
+ /// - Returns: A list of `${build_kind}`.
46
50
func build${ kind} List ( format: Format, leadingTrivia: Trivia? ) - > [ ${ build_kind} ]
47
51
}
48
52
@@ -51,24 +55,40 @@ public protocol ${kind}Buildable: ${kind}ListBuildable {
51
55
% else :
52
56
public protocol ${ kind} Buildable: SyntaxBuildable, ${ kind} ListBuildable {
53
57
% end
58
+ /// Builds a `${build_kind}`.
59
+ /// - Parameter format: The `Format` to use.
60
+ /// - Parameter leadingTrivia: Replaces the the last leading trivia if not nil.
61
+ /// - Returns: A list of `${build_kind}`.
54
62
func build${ kind} ( format: Format, leadingTrivia: Trivia? ) - > ${ build_kind}
55
63
}
56
64
57
65
extension ${ kind} Buildable {
58
66
% if kind != 'Syntax':
67
+ /// Builds a `${build_kind}`.
68
+ /// - Returns: A `${build_kind}`.
59
69
func build${ kind} ( format: Format) - > ${ build_kind} {
60
70
build ${ kind} ( format: format, leadingTrivia: nil )
61
71
}
62
72
63
73
% end
74
+ /// Builds a `${build_kind}`.
75
+ /// - Returns: A `${build_kind}`.
64
76
public func buildSyntax( format: Format ) -> Syntax {
65
77
buildSyntax ( format: format, leadingTrivia: nil )
66
78
}
67
79
80
+ /// Builds a `${build_kind}`.
81
+ /// - Parameter format: The `Format` to use.
82
+ /// - Parameter leadingTrivia: Replaces the the last leading trivia if not nil.
83
+ /// - Returns: A new `Syntax` with the builded `${build_kind}`.
68
84
public func buildSyntax( format: Format , leadingTrivia: Trivia ? ) -> Syntax {
69
85
Syntax ( build ${ kind} ( format: format, leadingTrivia: leadingTrivia) )
70
86
}
71
87
88
+ /// Builds list of `${build_kind}`s.
89
+ /// - Parameter format: The `Format` to use.
90
+ /// - Parameter leadingTrivia: Replaces the the last leading trivia if not nil.
91
+ /// - Returns: A list of `${build_kind}`.
72
92
public func build${ kind} List ( format: Format, leadingTrivia: Trivia? = nil ) - > [ ${ build_kind} ] {
73
93
[ build ${ kind} ( format: format, leadingTrivia: leadingTrivia) ]
74
94
}
@@ -80,6 +100,11 @@ extension ${kind}Buildable {
80
100
81
101
% for node in SYNTAX_NODES:
82
102
% if node. is_buildable ( ) :
103
+ % if node. description:
104
+ % for line in dedented_lines( node. description) :
105
+ /// ${line}
106
+ % end
107
+ % end
83
108
public struct ${ node. syntax_kind} : ${ node. base_kind} Buildable {
84
109
% for child in node. children:
85
110
% param_type = syntax_buildable_child_type ( child. type_name, child. syntax_kind, child. is_token ( ) , child. is_optional)
@@ -139,8 +164,17 @@ public struct ${node.syntax_kind}: ${node.base_kind}Buildable {
139
164
140
165
% elif node. is_syntax_collection( ) :
141
166
// MARK: - Syntax collection
142
- public struct $ { node . syntax_kind } : SyntaxBuildable {
167
+
143
168
% element_type = syntax_buildable_child_type ( node. collection_element_type, node. collection_element, node. is_token ( ) )
169
+ % if node. description:
170
+ % for line in dedented_lines( node. description) :
171
+ /// ${line}
172
+ % end
173
+ % else:
174
+ /// `${node.syntax_kind}` represents a collection of
175
+ /// `${element_type}`s.
176
+ % end
177
+ public struct ${ node. syntax_kind} : SyntaxBuildable {
144
178
let elements : [ ${ element_type} ]
145
179
146
180
public init( _ elements: [ ${ element_type} ] ) {
0 commit comments