@@ -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
% child_params = [ ]
85
110
% for child in node. children:
@@ -137,8 +162,17 @@ public struct ${node.syntax_kind}: ${node.base_kind}Buildable {
137
162
138
163
% elif node. is_syntax_collection( ) :
139
164
// MARK: - Syntax collection
140
- public struct $ { node . syntax_kind } : SyntaxBuildable {
165
+
141
166
% element_type = syntax_buildable_child_type ( node. collection_element_type, node. collection_element, node. is_token ( ) )
167
+ % if node. description:
168
+ % for line in dedented_lines( node. description) :
169
+ /// ${line}
170
+ % end
171
+ % else:
172
+ /// `${node.syntax_kind}` represents a collection of
173
+ /// `${element_type}`s.
174
+ % end
175
+ public struct ${ node. syntax_kind} : SyntaxBuildable {
142
176
let elements : [ ${ element_type} ]
143
177
144
178
public init( _ elements: [ ${ element_type} ] ) {
0 commit comments