1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 04:51:57 +03:00

Bracket as an instance method.

This commit is contained in:
Rob Rix 2015-09-28 22:56:18 -04:00
parent c4f710efd1
commit 42cee56ef8

View File

@ -68,6 +68,13 @@ public enum Doc: CustomDocConvertible, Equatable {
return group(Concat(Text(l), Concat(Nest(2, Concat(Line, x)), Concat(Line, Text(r)))))
}
public func bracket(left: String, _ right: String) -> Doc {
return .group(Text(left)
<> Nest(2, Line <> self)
<> Line
<> Text(right))
}
public var flattened: Doc {
switch self {
case .Empty, .Text: