Better styling
This commit is contained in:
@ -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
|
||||||
|
|||||||
@ -75,12 +75,14 @@ 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
|
||||||
|
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
|
| 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";
|
||||||
|
|||||||
Reference in New Issue
Block a user