grew_edge.mli 3.24 KB
Newer Older
bguillaum's avatar
bguillaum committed
1 2 3 4 5 6 7 8 9 10
(**********************************************************************************)
(*    Libcaml-grew - a Graph Rewriting library dedicated to NLP applications      *)
(*                                                                                *)
(*    Copyright 2011-2013 Inria, Université de Lorraine                           *)
(*                                                                                *)
(*    Webpage: http://grew.loria.fr                                               *)
(*    License: CeCILL (see LICENSE folder or "http://www.cecill.info")            *)
(*    Authors: see AUTHORS file                                                   *)
(**********************************************************************************)

11
open Grew_base
12 13
open Grew_types
open Grew_ast
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
open Grew_domain

(* ================================================================================ *)
(** The module [Label] defines the type of atomic label edges *)
module Label : sig
  type t

  (** [match_list p_label_list g_label] returns [true] iff [g_label] match at least one of the p_label of [p_label_list] *)
  val match_list: t list -> t -> bool

  val to_string: ?domain:Domain.t -> t -> string

  val is_void: ?domain: Domain.t -> t -> bool

  val to_dep: ?domain: Domain.t -> ?deco:bool -> t -> string

  val to_dot: ?domain: Domain.t -> ?deco:bool -> t -> string

Bruno Guillaume's avatar
Bruno Guillaume committed
32
  val from_string: ?loc:Loc.t -> ?domain: Domain.t -> string -> t
33 34
end (* module Label *)

pj2m's avatar
pj2m committed
35

36 37 38 39 40 41 42 43
(* ================================================================================ *)
(** The module [Label_cst] defines contraints on label edges *)
module Label_cst : sig
  type t =
  | Pos of Label.t list
  | Neg of Label.t list
  | Regexp of (Str.regexp * string)

bguillaum's avatar
bguillaum committed
44
  val to_string: ?domain:Domain.t -> t -> string
45
  val to_json: ?domain:Domain.t -> t -> Yojson.Basic.json
46
  val all: t
bguillaum's avatar
bguillaum committed
47 48
  val match_: ?domain:Domain.t -> t -> Label.t -> bool
  val build: ?loc:Loc.t -> ?domain:Domain.t -> Ast.edge_label_cst -> t
49 50 51
end (* module Label_cst *)


52 53 54 55 56
(* ================================================================================ *)
(** The module [G_edge] defines the type of Graph label edges: atomic edges *)
module G_edge: sig
  type t = Label.t

bguillaum's avatar
bguillaum committed
57
  val to_string: ?domain:Domain.t -> t -> string
58

59 60
  val to_json: ?domain:Domain.t -> t -> Yojson.Basic.json

bguillaum's avatar
bguillaum committed
61
  val make: ?loc:Loc.t -> ?domain:Domain.t -> string -> t
62

63 64
  val sub: t

bguillaum's avatar
bguillaum committed
65
  val build: ?domain:Domain.t -> Ast.edge -> t
66

bguillaum's avatar
bguillaum committed
67 68 69
  val is_void: ?domain:Domain.t -> t -> bool
  val to_dot: ?domain:Domain.t -> ?deco:bool -> t -> string
  val to_dep: ?domain:Domain.t -> ?deco:bool -> t -> string
bguillaum's avatar
bguillaum committed
70
end (* module G_edge *)
71 72 73 74 75

(* ================================================================================ *)
(** The module [G_edge] defines the type of Graph label edges: atomic edges *)
module P_edge: sig
  type t
76

bguillaum's avatar
bguillaum committed
77
  (* [all] is the joker pattern edge *)
bguillaum's avatar
bguillaum committed
78 79
  val all: t

80 81
  val to_json: ?domain:Domain.t -> t -> Yojson.Basic.json

82
  val get_id: t -> string
bguillaum's avatar
bguillaum committed
83

bguillaum's avatar
bguillaum committed
84
  val to_string: ?domain:Domain.t -> t -> string
85

bguillaum's avatar
bguillaum committed
86
  val build: ?domain:Domain.t -> Ast.edge -> t
87

bguillaum's avatar
bguillaum committed
88 89
  type edge_matcher =
    | Fail
pj2m's avatar
pj2m committed
90 91
    | Binds of string * Label.t list

bguillaum's avatar
bguillaum committed
92
  val match_: ?domain:Domain.t -> t -> G_edge.t -> edge_matcher
pj2m's avatar
pj2m committed
93

bguillaum's avatar
bguillaum committed
94
  val match_list: ?domain:Domain.t -> t -> G_edge.t list -> edge_matcher
bguillaum's avatar
bguillaum committed
95
end (* module P_edge *)