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:
parent
c4f710efd1
commit
42cee56ef8
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user