Skip to content

Commit

Permalink
refactor: improve marks pp (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg authored Sep 28, 2024
1 parent fe89c59 commit 92a599c
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/automata.ml
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,21 @@ module Marks = struct
let set_pmark t i = { t with pmarks = Pmark.Set.add i t.pmarks }

let pp fmt { marks; pmarks } =
Format.fprintf
fmt
"@[(@[<2>marks@ %a@] @[<2>pmarks %a@])@]"
(Format.pp_print_list (fun fmt (a, i) ->
Format.fprintf fmt "%a-%a" Mark.pp a Idx.pp i))
marks
(Format.pp_print_list Pmark.pp)
(Pmark.Set.to_list pmarks)
Format.pp_open_box fmt 1;
(match marks with
| [] -> ()
| _ :: _ ->
Format.fprintf
fmt
"@[<2>marks@ %a@]"
(Format.pp_print_list (fun fmt (a, i) ->
Format.fprintf fmt "%a-%a" Mark.pp a Idx.pp i))
marks);
(match Pmark.Set.to_list pmarks with
| [] -> ()
| pmarks ->
Format.fprintf fmt "@[<2>pmarks %a@]" (Format.pp_print_list Pmark.pp) pmarks);
Format.pp_close_box fmt ()
;;
end

Expand Down

0 comments on commit 92a599c

Please sign in to comment.