@@ -388,6 +388,26 @@ let rec pp_list sep pp fmt xs =
388388 | [x] -> Format. fprintf fmt " %a" pp x
389389 | x :: xs -> Format. fprintf fmt " %a%(%)%a" pp x sep pp_list xs
390390
391+ (* -------------------------------------------------------------------- *)
392+ type pphlist =
393+ PpHList : (Format .formatter -> 'a -> unit ) * 'a list -> pphlist
394+
395+ (* -------------------------------------------------------------------- *)
396+ type pphlist1 =
397+ PpHList1 : (Format .formatter -> 'a -> unit ) * 'a -> pphlist1
398+
399+ (* -------------------------------------------------------------------- *)
400+ let pp_hlist (sep : _ format6 ) (fmt : Format.formatter ) (xs : pphlist list ) =
401+ let xs =
402+ xs
403+ |> List. map (fun (PpHList (f , xs )) -> List. map (fun x -> PpHList1 (f, x)) xs)
404+ |> List. flatten
405+ in
406+
407+ let pp fmt (PpHList1 (f , x )) = f fmt x in
408+
409+ Format. fprintf fmt " %a" (pp_list sep pp) xs
410+
391411(* -------------------------------------------------------------------- *)
392412let pp_option pp fmt x =
393413 match x with None -> () | Some x -> pp fmt x
@@ -519,8 +539,6 @@ let get_f_projarg ppe e i ty =
519539 | _ -> raise NoProjArg
520540
521541(* -------------------------------------------------------------------- *)
522- let all_mem_sym = " +all mem"
523-
524542let pp_restr_s fmt = function
525543 | true -> Format. fprintf fmt " +"
526544 | false -> Format. fprintf fmt " -"
@@ -1895,42 +1913,31 @@ and pp_orclinfos ppe fmt ois =
18951913(* -------------------------------------------------------------------- *)
18961914and pp_mem_restr ppe fmt mr =
18971915 let pp_rx sign fmt rx =
1898- let pp_x fmt x =
1899- Format. fprintf fmt " %a%a" pp_restr_s sign (pp_pv ppe) (pv_glob x) in
1900- pp_list " ,@ " pp_x fmt (EcPath.Sx. elements rx) in
1916+ Format. fprintf fmt " %a%a" pp_restr_s sign (pp_pv ppe) (pv_glob rx) in
1917+
19011918 let pp_r sign fmt r =
1902- let pp_m fmt m =
1903- Format. fprintf fmt " %a%a" pp_restr_s sign (pp_topmod ppe) m in
1904- pp_list " ,@ " pp_m fmt (EcPath.Sm. elements r) in
1905- let pp_top fmt b =
1906- if b then Format. fprintf fmt " %s" all_mem_sym else () in
1907-
1908- let xpos_emp =
1909- EcPath.Sx. is_empty (odfl EcPath.Sx. empty (mr_xpaths mr).ur_pos) in
1910- let mpos_emp =
1911- EcPath.Sm. is_empty (odfl EcPath.Sm. empty (mr_mpaths mr).ur_pos) in
1912- let all_mem = mr.ur_pos = None in
1913-
1914- let printed = ref (all_mem) in
1915- let pp_sep fmt b =
1916- let b' = (not b) && ! printed in
1917- printed := ! printed || not b;
1918- if b' then Format. fprintf fmt " ,@ " else () in
1919-
1920- if all_mem &&
1919+ Format. fprintf fmt " %a%a" pp_restr_s sign (pp_topmod ppe) r in
1920+
1921+ let all_mem = Option. is_none mr.ur_pos in
1922+
1923+ if not (all_mem &&
19211924 EcPath.Sm. is_empty (mr_mpaths mr).ur_neg &&
1922- EcPath.Sx. is_empty (mr_xpaths mr).ur_neg
1923- then ()
1924- else Format. fprintf fmt " @[<h>{%a%a%a%a%a%a%a%a%a}@]@ "
1925- pp_top (all_mem)
1926- pp_sep xpos_emp
1927- (pp_rx true ) (odfl EcPath.Sx. empty (mr_xpaths mr).ur_pos)
1928- pp_sep mpos_emp
1929- (pp_r true ) (odfl EcPath.Sm. empty (mr_mpaths mr).ur_pos)
1930- pp_sep (EcPath.Sx. is_empty (mr_xpaths mr).ur_neg)
1931- (pp_rx false ) (mr_xpaths mr).ur_neg
1932- pp_sep (EcPath.Sm. is_empty (mr_mpaths mr).ur_neg)
1933- (pp_r false ) (mr_mpaths mr).ur_neg
1925+ EcPath.Sx. is_empty (mr_xpaths mr).ur_neg)
1926+ then begin
1927+ let urx_pos = (mr_xpaths mr).ur_pos |> omap P.Sx. elements |> odfl [] in
1928+ let urm_pos = (mr_mpaths mr).ur_pos |> omap P.Sm. elements |> odfl [] in
1929+ let urx_neg = (mr_xpaths mr).ur_neg |> P.Sx. elements in
1930+ let urm_neg = (mr_mpaths mr).ur_neg |> P.Sm. elements in
1931+
1932+ let toprint = [
1933+ PpHList (pp_rx true , urx_pos);
1934+ PpHList (pp_r true , urm_pos);
1935+ PpHList (pp_rx false , urx_neg);
1936+ PpHList (pp_r false , urm_neg);
1937+ ] in
1938+
1939+ Format. fprintf fmt " @[<h>{%a}@]" (pp_hlist " ,@ " ) toprint
1940+ end
19341941
19351942(* -------------------------------------------------------------------- *)
19361943(* Use in an hv box. *)
0 commit comments