Skip to content

Commit df6a89a

Browse files
authored
Add parser printer conformance to OptionalOneOf (#204)
1 parent dce4e12 commit df6a89a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/Parsing/Builders/OneOfBuilder.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,12 @@ public enum OneOfBuilder {
144144
}
145145
}
146146
}
147+
148+
extension OneOfBuilder.OptionalOneOf: ParserPrinter where Wrapped: ParserPrinter {
149+
@inlinable
150+
public func print(_ output: Wrapped.Output, into input: inout Wrapped.Input) throws {
151+
guard let wrapped = self.wrapped
152+
else { throw PrintingError.manyFailed([], at: input) }
153+
try wrapped.print(output, into: &input)
154+
}
155+
}

0 commit comments

Comments
 (0)