diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index 115447e0b..e9ac2424b 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -7,7 +7,7 @@ func readFile(path: String) -> String? { return data as String? } -typealias Term = Cofree> +typealias Term = Cofree struct Info: Categorizable, CustomJSONConvertible, Equatable { let range: Range @@ -64,7 +64,7 @@ func termWithInput(string: String) -> Term? { } } (root, "program") .map { node, category in - node.range + Info(range: node.range, categories: [ category ]) } } } @@ -82,10 +82,10 @@ if let aString = arguments[1].flatMap(readFile), bString = arguments[2].flatMap( let JSON: Doubt.JSON = [ "before": .String(aString), "after": .String(bString), - "diff": diff.JSON(pure: { $0.JSON { $0.JSON(annotation: range, leaf: Doubt.JSON.String) } }, leaf: Doubt.JSON.String, annotation: { + "diff": diff.JSON(pure: { $0.JSON { $0.JSON(annotation: { $0.range.JSON }, leaf: Doubt.JSON.String) } }, leaf: Doubt.JSON.String, annotation: { [ - "before": range($0), - "after": range($1), + "before": $0.range.JSON, + "after": $1.range.JSON, ] }), ]