Commit bb17bff3 authored by Bruno Guillaume's avatar Bruno Guillaume

Add Pattern.pid_list function

parent 27caa03b
......@@ -38,6 +38,8 @@ module P_graph = struct
let find = Pid_map.find
let pid_list t = Pid_map.fold (fun pid _ acc -> pid::acc) t []
(* -------------------------------------------------------------------------------- *)
let map_add_edge map id_src label id_tar =
let node_src =
......
......@@ -49,6 +49,8 @@ module P_graph: sig
val roots: t -> Pid.t list
val pid_list: t -> Pid.t list
type extension = {
ext_map: P_node.t Pid_map.t; (* node description for new nodes and for edge "Old -> New" *)
old_map: P_node.t Pid_map.t; (* a partial map for new constraints on old nodes "Old [...]" *)
......
......@@ -258,6 +258,8 @@ module Rule = struct
(* a [pattern] is described by the positive basic and a list of negative basics. *)
type pattern = basic * basic list
let pid_list (pos,_) = P_graph.pid_list pos.graph
type t = {
name: string;
pattern: pattern;
......
......@@ -104,6 +104,7 @@ module Rule : sig
type matching
type pattern
val pid_list: pattern -> Pid.t list
val to_python: pattern -> G_graph.t -> matching -> string
......
......@@ -74,6 +74,11 @@ module Pattern = struct
let parse ?domain desc =
handle ~name:"Pattern.load" (fun () -> Grew_rule.Rule.build_pattern ?domain (Grew_loader.Parser.pattern desc)) ()
let pid_list pattern =
handle ~name:"Pattern.pid_lits"
(fun () -> List.map (fun x -> Grew_types.Pid.to_string x) (Grew_rule.Rule.pid_list pattern)
) ()
end
(* ==================================================================================================== *)
......
......@@ -39,6 +39,9 @@ module Pattern : sig
(** [load_pattern domain description] returns the pattern described in the [descriprion] string *)
val parse: ?domain:Domain.t -> string -> t
val pid_list: t -> string list
end
(* ==================================================================================================== *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment