mirror of
https://github.com/github/semantic.git
synced 2024-12-01 17:59:10 +03:00
Patches of terms annotated with ranges can produce JSON over source strings.
This commit is contained in:
parent
8c341fc129
commit
01d65a4245
@ -140,3 +140,13 @@ extension Patch: PatchType {
|
||||
self = .Insert(after)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension PatchType where Element: CofreeType, Element.Annotation == Range<String.Index> {
|
||||
public func JSON(a a: String, b: String) -> Doubt.JSON {
|
||||
return [
|
||||
"before": state.before.map { $0.JSON(a) } ?? nil,
|
||||
"after": state.after.map { $0.JSON(b) } ?? nil,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user