diff --git a/src/extPervasives.ml b/src/extPervasives.ml index 0ea8bd5d..23ed113b 100644 --- a/src/extPervasives.ml +++ b/src/extPervasives.ml @@ -255,17 +255,3 @@ let lines s = let string_last_line s = lines s |> list_last - -let escape ?(chars="\\\"") ?(esc='\\') s = - let buf = Bytes.create (2 * String.length s) in - let j = ref 0 in - for i = 0 to String.length s - 1 do - if String.contains chars s.[i] then - ( - Bytes.set buf !j esc; - incr j - ); - Bytes.set buf !j s.[i]; - incr j - done; - Bytes.sub_string buf 0 !j diff --git a/src/jsonHelpers.ml b/src/jsonHelpers.ml index 64cfb9d1..5b3c7c46 100644 --- a/src/jsonHelpers.ml +++ b/src/jsonHelpers.ml @@ -65,7 +65,7 @@ let json_to_dot cout json = nodeid | `String name -> let nodeid = fresh () in - fprintf cout "%s [label=\"%s\"];\n" nodeid (ExtPervasives.escape name); + fprintf cout "%s [label=\"%s\"];\n" nodeid (String.escaped name); nodeid | `List [x] -> traverse x @@ -76,7 +76,7 @@ let json_to_dot cout json = List.iter (fun c -> fprintf cout "%s -> %s;\n" nodeid c) childrenids; nodeid | _ -> - failwith "unsupported feature in json_to_dot" + assert false in fprintf cout "digraph {\n"; ignore (traverse json);