Better styling

This commit is contained in:
elvis
2025-01-26 23:03:20 +01:00
parent f175a6089d
commit b16aef4ecb
2 changed files with 8 additions and 6 deletions

View File

@ -132,8 +132,8 @@ module Make (M: PrintableType) = struct
} }
let addToLastNode (newcontent: elt) (cfg: t) : t = let addToLastNode (newcontent: elt) (cfg: t) : t =
match cfg.empty with if cfg.empty then
| true -> let newnode = Node.create () in let newnode = Node.create () in
{ empty = false; { empty = false;
nodes = NodeSet.singleton newnode; nodes = NodeSet.singleton newnode;
edges = NodeMap.empty; edges = NodeMap.empty;
@ -144,7 +144,7 @@ module Make (M: PrintableType) = struct
terminal = Some newnode; terminal = Some newnode;
content = NodeMap.singleton newnode [newcontent] content = NodeMap.singleton newnode [newcontent]
} }
| false -> else
let prevcfgterminal = Option.get cfg.terminal in let prevcfgterminal = Option.get cfg.terminal in
{ cfg with { cfg with
content = (NodeMap.add_to_list_last content = (NodeMap.add_to_list_last

View File

@ -75,13 +75,15 @@ module Make (M: Cfg.PrintableType) (I: Cfg.PrintableType) = struct
let pp (ppf: out_channel) (c: t) : unit = ( let pp (ppf: out_channel) (c: t) : unit = (
Printf.fprintf ppf "Cfg:\n"; Printf.fprintf ppf "Cfg:\n";
Printf.fprintf ppf "Nodes' ids: "; Printf.fprintf ppf "Nodes' ids: ";
List.iter (fun (x : Node.t) -> Printf.fprintf ppf "%d " x.id) (NodeSet.to_list c.t.nodes); List.iter (fun (x : Node.t) ->
Printf.fprintf ppf "%d " x.id) (NodeSet.to_list c.t.nodes);
Printf.fprintf ppf "\n"; Printf.fprintf ppf "\n";
Printf.fprintf ppf "Nodes' edges:\n"; Printf.fprintf ppf "Nodes' edges:\n";
List.iter (fun ((n, (a, b)) : (Node.t * (Node.t * Node.t option))) : unit -> List.iter (fun ((n, (a, b)) : (Node.t * (Node.t * Node.t option))) : unit ->
match b with None -> Printf.fprintf ppf "\t%d -> %d\n" n.id a.id match b with
| Some b -> Printf.fprintf ppf "\t%d -> %d, %d\n" n.id a.id b.id None -> Printf.fprintf ppf "\t%d -> %d\n" n.id a.id
| Some b -> Printf.fprintf ppf "\t%d -> %d, %d\n" n.id a.id b.id
) (NodeMap.to_list c.t.edges); ) (NodeMap.to_list c.t.edges);
Printf.fprintf ppf "\n"; Printf.fprintf ppf "\n";