Commit 8f674fe8 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

remove functions "at_least_one" / "at_most_one"

parent 1e0c6eb2
......@@ -159,52 +159,6 @@ module Grs = struct
| Pack (_,mother) -> search_from mother path
)
(* return true if strat always return at least one graph *)
let at_least_one grs strat_string =
let rec loop pointed strat =
match strat with
| Ast.Ref strat_name ->
begin
let path = Str.split (Str.regexp "\\.") strat_name in
match search_from pointed path with
| None -> Error.build "cannot find strat %s" strat_name
| Some (Rule _,_)
| Some (Package _, _) -> false
| Some (Strategy (_,ast_strat), new_pointed) -> loop new_pointed ast_strat
end
| Ast.Pick s -> loop pointed s
| Ast.Onf s -> true
| Ast.Alt l -> List.exists (fun s -> loop pointed s) l
| Ast.Seq l -> List.for_all (fun s -> loop pointed s) l
| Ast.Iter _ -> true
| Ast.If (_,s1, s2) -> (loop pointed s1) && (loop pointed s2)
| Ast.Try (s) -> loop pointed s in
loop (top grs) (Parser.strategy strat_string)
(* return true if strat always return at most one graph *)
let at_most_one grs strat_string =
let rec loop pointed strat =
match strat with
| Ast.Ref strat_name ->
begin
let path = Str.split (Str.regexp "\\.") strat_name in
match search_from pointed path with
| None -> Error.build "cannot find strat %s" strat_name
| Some (Rule _,_)
| Some (Package _, _) -> false
| Some (Strategy (_,ast_strat), new_pointed) -> loop new_pointed ast_strat
end
| Ast.Pick s -> true
| Ast.Onf s -> true
| Ast.Alt [one] -> loop pointed one
| Ast.Alt _ -> false
| Ast.Seq l -> List.for_all (fun s -> loop pointed s) l
| Ast.Iter s -> loop pointed s
| Ast.If (_,s1, s2) -> (loop pointed s1) || (loop pointed s2)
| Ast.Try (s) -> loop pointed s in
loop (top grs) (Parser.strategy strat_string)
let is_without_history grs strat_string =
let rec loop pointed strat =
match strat with
......
......@@ -35,9 +35,6 @@ module Grs : sig
val get_package_list: t -> string list
val get_rule_list: t -> string list
val at_least_one: t -> string -> bool
val at_most_one: t -> string -> bool
val simple_rewrite: config:Conllx_config.t -> t -> string -> G_graph.t -> G_graph.t list
val onf_rewrite_opt: config:Conllx_config.t -> t -> string -> G_graph.t -> G_graph.t option
......
......@@ -359,11 +359,6 @@ module Rewrite = struct
let onf_rewrite_opt ~config gr grs strat =
Libgrew.handle ~name:"Rewrite.onf_rewrite_opt" (fun () -> Grew_grs.Grs.onf_rewrite_opt ~config grs strat gr) ()
let at_least_one grs strat =
Libgrew.handle ~name:"Rewrite.at_least_one" (fun () -> Grew_grs.Grs.at_least_one grs strat) ()
let at_most_one grs strat =
Libgrew.handle ~name:"Rewrite.at_most_one" (fun () -> Grew_grs.Grs.at_most_one grs strat) ()
end
(* ==================================================================================================== *)
......
......@@ -210,22 +210,21 @@ end
module Rewrite: sig
val set_max_rules: int -> unit
(** [display gr grs seq] builds the [display] (datatype used by the GUI) given by
val set_timeout: float option -> unit
(** [simple_rewrite config gr grs strat] builds the set of graphs given by
the rewriting of graph [gr] with the strategy [strat] of [grs].
@param gr the graph to rewrite
@param grs the graph rewriting system
@param strat the name of the strategy to apply *)
val at_least_one: Grs.t -> string -> bool
val at_most_one: Grs.t -> string -> bool
val set_timeout: float option -> unit
@param strat the name of the strategy to apply
*)
val simple_rewrite: config:Conllx_config.t -> Graph.t -> Grs.t -> string -> Graph.t list
val log_rewrite: unit -> Yojson.Basic.t
val onf_rewrite_opt: config:Conllx_config.t -> Graph.t -> Grs.t -> string -> Graph.t option
(** [log_rewrite ())] outputs a JSON describing the number of rules applies and the time for the last rewrite call *)
val log_rewrite: unit -> Yojson.Basic.t
end
......
Supports Markdown
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