let escape_newline fmt =
let (out,flush,newline,spaces as funcs) =
Format.pp_get_all_formatter_output_functions fmt ()
in
(match !normal_funcs with
None -> normal_funcs:= Some funcs
| Some _ -> Aorai_option.fatal "Already in escape newline mode");
let has_printed = ref false in
let newline () =
if !has_printed then out " \\\n" 0 3
else newline ()
in
let out s b l =
if String.contains (String.sub s b l) '"' then
has_printed:=not !has_printed;
out s b l
in
Format.pp_set_all_formatter_output_functions fmt ~out ~flush ~newline ~spaces