Commit c107b8b4 authored by bguillaum's avatar bguillaum

Domain ==> Feature_domain

Label.domain ==> Label_domain.t

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8836 7838e531-6607-4d57-9587-6c381814729c
parent d4f52a98
......@@ -267,14 +267,14 @@ module Ast = struct
| Includ of (string * Loc.t)
type grs_with_include = {
domain_wi: Domain.feature_spec list;
domain_wi: Feature_domain.feature_spec list;
labels_wi: (string * string list) list; (* the list of global edge labels *)
modules_wi: module_or_include list;
sequences_wi: sequence list;
}
type grs = {
domain: Domain.feature_spec list;
domain: Feature_domain.feature_spec list;
labels: (string * string list) list;
modules: modul list;
sequences: sequence list;
......
......@@ -182,7 +182,7 @@ module Ast : sig
| Includ of (string * Loc.t)
type grs_with_include = {
domain_wi: Domain.feature_spec list;
domain_wi: Feature_domain.feature_spec list;
labels_wi: (string * string list) list; (* the list of global edge labels *)
modules_wi: module_or_include list;
sequences_wi: sequence list;
......@@ -190,7 +190,7 @@ module Ast : sig
(* a GRS: graph rewriting system *)
type grs = {
domain: Domain.feature_spec list;
domain: Feature_domain.feature_spec list;
labels: (string * string list) list;
modules: modul list;
sequences: sequence list;
......
......@@ -169,7 +169,7 @@ module Command = struct
if feat_name = "position"
then Error.build ~loc "Illegal del_feat command: the 'position' feature cannot be deleted";
check_act_id loc act_id kai;
Domain.check_feature_name ~loc domain feat_name;
Feature_domain.check_feature_name ~loc domain feat_name;
((DEL_FEAT (pid_of_act_id loc act_id, feat_name), loc), (kai, kei))
| (Ast.Update_feat ((act_id, feat_name), ast_items), loc) ->
......@@ -178,7 +178,7 @@ module Command = struct
(function
| Ast.Qfn_item (node_id,feature_name) ->
check_node_id loc node_id kai;
Domain.check_feature_name ~loc domain feature_name;
Feature_domain.check_feature_name ~loc domain feature_name;
Feat (pid_of_node_id loc node_id, feature_name)
| Ast.String_item s -> String s
| Ast.Param_item var ->
......@@ -192,9 +192,9 @@ module Command = struct
) ast_items in
(* check for consistency *)
(match items with
| _ when Domain.is_open domain feat_name -> ()
| _ when Feature_domain.is_open domain feat_name -> ()
| [Param_out _] -> () (* TODO: check that lexical parameters are compatible with the feature domain *)
| [String s] -> Domain.check_feature ~loc domain feat_name s
| [String s] -> Feature_domain.check_feature ~loc domain feat_name s
| [Feat (_,fn)] -> ()
| _ -> Error.build ~loc "[Update_feat] Only open features can be modified with the concat operator '+' but \"%s\" is not declared as an open feature" feat_name);
((UPDATE_FEAT (pid_of_act_id loc act_id, feat_name, items), loc), (kai, kei))
......
......@@ -58,12 +58,12 @@ module Command : sig
| H_ACT_NODE of (Gid.t * string)
val build:
Domain.t ->
Label.domain ->
Feature_domain.t ->
Label_domain.t ->
?param: (string list * string list) ->
(Ast.command_node_ident list * string list) ->
Id.table ->
Label.decl array ->
Label_domain.decl array ->
suffix list ->
Ast.command ->
t * (Ast.command_node_ident list * string list)
......
......@@ -18,14 +18,14 @@ open Grew_ast
module G_edge: sig
type t = Label.t
val to_string: Label.domain -> ?locals:Label.decl array -> t -> string
val to_string: Label_domain.t -> ?locals:Label_domain.decl array -> t -> string
val make: ?loc:Loc.t -> Label.domain -> ?locals:Label.decl array -> string -> t
val make: ?loc:Loc.t -> Label_domain.t -> ?locals:Label_domain.decl array -> string -> t
val build: Label.domain -> ?locals:Label.decl array -> Ast.edge -> t
val build: Label_domain.t -> ?locals:Label_domain.decl array -> Ast.edge -> t
val to_dot: Label.domain -> ?deco:bool -> t -> string
val to_dep: Label.domain -> ?deco:bool -> t -> string
val to_dot: Label_domain.t -> ?deco:bool -> t -> string
val to_dep: Label_domain.t -> ?deco:bool -> t -> string
end (* module G_edge *)
(* ================================================================================ *)
......@@ -38,16 +38,16 @@ module P_edge: sig
val get_id: t -> string option
val to_string: Label.domain -> t -> string
val to_string: Label_domain.t -> t -> string
val build: Label.domain -> ?locals:Label.decl array -> Ast.edge -> t
val build: Label_domain.t -> ?locals:Label_domain.decl array -> Ast.edge -> t
type edge_matcher =
| Fail
| Ok of Label.t
| Binds of string * Label.t list
val match_: Label.domain -> t -> G_edge.t -> edge_matcher
val match_: Label_domain.t -> t -> G_edge.t -> edge_matcher
val match_list: Label.domain -> t -> G_edge.t list -> edge_matcher
val match_list: Label_domain.t -> t -> G_edge.t list -> edge_matcher
end (* module P_edge *)
......@@ -35,7 +35,7 @@ module G_feature = struct
let build domain = function
| ({Ast.kind=Ast.Equality [atom]; name=name},loc) ->
(name, Domain.build_value ~loc domain name atom)
(name, Feature_domain.build_value ~loc domain name atom)
| _ -> Error.build "Illegal feature declaration in Graph (must be '=' and atomic)"
let to_string (feat_name, feat_val) = sprintf "%s=%s" feat_name (string_of_value feat_val)
......@@ -132,12 +132,12 @@ module P_feature = struct
let build domain ?pat_vars = function
| ({Ast.kind=Ast.Absent; name=name}, loc) ->
Domain.check_feature_name ~loc domain name;
Feature_domain.check_feature_name ~loc domain name;
(name, {cst=Absent;in_param=[];})
| ({Ast.kind=Ast.Equality unsorted_values; name=name}, loc) ->
let values = Domain.build_disj ~loc domain name unsorted_values in (name, {cst=Equal values;in_param=[];})
let values = Feature_domain.build_disj ~loc domain name unsorted_values in (name, {cst=Equal values;in_param=[];})
| ({Ast.kind=Ast.Disequality unsorted_values; name=name}, loc) ->
let values = Domain.build_disj ~loc domain name unsorted_values in (name, {cst=Different values;in_param=[];})
let values = Feature_domain.build_disj ~loc domain name unsorted_values in (name, {cst=Different values;in_param=[];})
| ({Ast.kind=Ast.Equal_param var; name=name}, loc) ->
begin
match pat_vars with
......@@ -162,7 +162,7 @@ module G_fs = struct
(* ---------------------------------------------------------------------- *)
let set_feat ?loc domain feature_name atom t =
let new_value = Domain.build_value ?loc domain feature_name atom in
let new_value = Feature_domain.build_value ?loc domain feature_name atom in
let rec loop = function
| [] -> [(feature_name, new_value)]
| ((fn,_)::_) as t when feature_name < fn -> (feature_name, new_value)::t
......@@ -210,15 +210,15 @@ module G_fs = struct
(* ---------------------------------------------------------------------- *)
let of_conll ?loc domain line =
let raw_list0 =
("phon", Domain.build_value ?loc domain "phon" line.Conll.phon)
:: ("cat", Domain.build_value ?loc domain "cat" line.Conll.pos1)
:: (List.map (fun (f,v) -> (f, Domain.build_value ?loc domain f v)) line.Conll.morph) in
("phon", Feature_domain.build_value ?loc domain "phon" line.Conll.phon)
:: ("cat", Feature_domain.build_value ?loc domain "cat" line.Conll.pos1)
:: (List.map (fun (f,v) -> (f, Feature_domain.build_value ?loc domain f v)) line.Conll.morph) in
let raw_list1 = match line.Conll.pos2 with
| "" | "_" -> raw_list0
| s -> ("pos", Domain.build_value ?loc domain "pos" s) :: raw_list0 in
| s -> ("pos", Feature_domain.build_value ?loc domain "pos" s) :: raw_list0 in
let raw_list2 = match line.Conll.lemma with
| "" | "_" -> raw_list1
| s -> ("lemma", Domain.build_value ?loc domain "lemma" s) :: raw_list1 in
| s -> ("lemma", Feature_domain.build_value ?loc domain "lemma" s) :: raw_list1 in
List.sort G_feature.compare raw_list2
(* ---------------------------------------------------------------------- *)
......
......@@ -21,7 +21,7 @@ module G_fs: sig
(** [set_feat domain feature_name atom t] adds the feature ([feature_name],[atom]) in [t].
If [t] already contains a feature named [feature_name], the old value is erased by the new one. *)
val set_feat: ?loc:Loc.t -> Domain.t -> feature_name -> string -> t -> t
val set_feat: ?loc:Loc.t -> Feature_domain.t -> feature_name -> string -> t -> t
(** [del_feat feature_name t] remove the feature with name [feature_name] in [t].
If [t] does not contain such a feature, [t] is returned unchanged. *)
......@@ -46,9 +46,9 @@ module G_fs: sig
val to_string: t -> string
val build: Domain.t -> Ast.feature list -> t
val build: Feature_domain.t -> Ast.feature list -> t
val of_conll: ?loc:Loc.t -> Domain.t -> Conll.line -> t
val of_conll: ?loc:Loc.t -> Feature_domain.t -> Conll.line -> t
(** [unif t1 t2] returns [Some t] if [t] is the unification of two graph feature structures
[None] is returned if the two feature structures cannot be unified. *)
......@@ -62,7 +62,7 @@ module P_fs: sig
val empty: t
val build: Domain.t -> ?pat_vars: string list -> Ast.feature list -> t
val build: Feature_domain.t -> ?pat_vars: string list -> Ast.feature list -> t
val to_string: t -> string
......
......@@ -53,19 +53,19 @@ module P_graph: sig
}
val build:
Domain.t ->
Label.domain ->
Feature_domain.t ->
Label_domain.t ->
?pat_vars: string list ->
?locals: Label.decl array ->
?locals: Label_domain.decl array ->
Ast.node list ->
Ast.edge list ->
(t * Id.table)
val build_extension:
Domain.t ->
Label.domain ->
Feature_domain.t ->
Label_domain.t ->
?pat_vars: string list ->
?locals: Label.decl array ->
?locals: Label_domain.decl array ->
Id.table ->
Ast.node list ->
Ast.edge list ->
......@@ -94,7 +94,7 @@ module G_graph: sig
val max_binding: t -> int
(** [edge_out label_domain t id label_cst] returns true iff there is an out-edge from the node [id] with a label compatible with [label_cst] *)
val edge_out: Label.domain -> t -> Gid.t -> Label_cst.t -> bool
val edge_out: Label_domain.t -> t -> Gid.t -> Label_cst.t -> bool
(** [get_annot_info graph] searches for exactly one node with an annot-feature (with name starting with "__").
It returns the annot-feature name without the prefix "__" together with the position.
......@@ -105,15 +105,15 @@ module G_graph: sig
(* Build functions *)
(* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
val build: Domain.t -> Label.domain -> ?locals: Label.decl array -> Ast.gr -> t
val build: Feature_domain.t -> Label_domain.t -> ?locals: Label_domain.decl array -> Ast.gr -> t
val of_conll: ?loc:Loc.t -> Domain.t -> Label.domain -> Conll.t -> t
val of_conll: ?loc:Loc.t -> Feature_domain.t -> Label_domain.t -> Conll.t -> t
(** input : "Le/DET/le petit/ADJ/petit chat/NC/chat dort/V/dormir ./PONCT/."
It supposes that "SUC" is defined in current relations *)
val of_brown: Domain.t -> Label.domain -> ?sentid: string -> string -> t
val of_brown: Feature_domain.t -> Label_domain.t -> ?sentid: string -> string -> t
val of_xml: Domain.t -> Label.domain -> Xml.xml -> t
val of_xml: Feature_domain.t -> Label_domain.t -> Xml.xml -> t
(* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
(* Update functions *)
(* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
......@@ -129,32 +129,32 @@ module G_graph: sig
(** [del_edge ?edge_ident loc graph id_src label id_tar] removes the edge (id_src -[label]-> id_tar) from graph.
Log.critical if the edge is not in graph *)
val del_edge: Label.domain -> ?edge_ident: string -> Loc.t -> t -> Gid.t -> G_edge.t -> Gid.t -> t
val del_edge: Label_domain.t -> ?edge_ident: string -> Loc.t -> t -> Gid.t -> G_edge.t -> Gid.t -> t
(** [del_node graph id] remove node [id] from [graph], with all its incoming and outcoming edges.
[graph] is unchanged if the node is not in it. *)
val del_node: t -> Gid.t -> t
val add_neighbour: Loc.t -> Label.domain -> t -> Gid.t -> G_edge.t -> (Gid.t * t)
val add_neighbour: Loc.t -> Label_domain.t -> t -> Gid.t -> G_edge.t -> (Gid.t * t)
val activate: Loc.t -> Gid.t -> string -> t -> (Gid.t * t)
val merge_node: Loc.t -> Label.domain -> t -> Gid.t -> Gid.t -> t option
val merge_node: Loc.t -> Label_domain.t -> t -> Gid.t -> Gid.t -> t option
(** move all in arcs to id_src are moved to in arcs on node id_tar from graph, with all its incoming edges *)
val shift_in: Loc.t -> Label.domain -> Gid.t -> Gid.t -> Label_cst.t -> t -> t
val shift_in: Loc.t -> Label_domain.t -> Gid.t -> Gid.t -> Label_cst.t -> t -> t
(** move all out-edges from id_src are moved to out-edges out off node id_tar *)
val shift_out: Loc.t -> Label.domain -> Gid.t -> Gid.t -> Label_cst.t -> t -> t
val shift_out: Loc.t -> Label_domain.t -> Gid.t -> Gid.t -> Label_cst.t -> t -> t
(** move all incident arcs from/to id_src are moved to incident arcs on node id_tar from graph, with all its incoming and outcoming edges *)
val shift_edges: Loc.t -> Label.domain -> Gid.t -> Gid.t -> Label_cst.t -> t -> t
val shift_edges: Loc.t -> Label_domain.t -> Gid.t -> Gid.t -> Label_cst.t -> t -> t
(** [update_feat domain tar_id tar_feat_name concat_items] sets the feature of the node [tar_id]
with feature name [tar_feat_name] to be the contatenation of values described by the [concat_items].
It returns both the new graph and the new feature value produced as the second element *)
val update_feat: ?loc:Loc.t -> Domain.t -> t -> Gid.t -> string -> Concat_item.t list -> (t * string)
val update_feat: ?loc:Loc.t -> Feature_domain.t -> t -> Gid.t -> string -> Concat_item.t list -> (t * string)
val set_feat: ?loc:Loc.t -> Domain.t -> t -> Gid.t -> string -> string -> t
val set_feat: ?loc:Loc.t -> Feature_domain.t -> t -> Gid.t -> string -> string -> t
(** [del_feat graph node_id feat_name] returns [graph] where the feat [feat_name] of [node_id] is deleted
If the feature is not present, [graph] is returned. *)
......@@ -163,13 +163,13 @@ module G_graph: sig
(* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
(* Output functions *)
(* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *)
val to_gr: Label.domain -> t -> string
val to_dot: Label.domain -> ?main_feat:string -> ?deco:G_deco.t -> t -> string
val to_gr: Label_domain.t -> t -> string
val to_dot: Label_domain.t -> ?main_feat:string -> ?deco:G_deco.t -> t -> string
val to_sentence: ?main_feat:string -> t -> string
val to_dep: Label.domain -> ?filter : string list -> ?main_feat:string -> ?deco:G_deco.t -> t -> string
val to_conll: Label.domain -> t -> string
val to_dep: Label_domain.t -> ?filter : string list -> ?main_feat:string -> ?deco:G_deco.t -> t -> string
val to_conll: Label_domain.t -> t -> string
val to_raw: Label.domain -> t ->
val to_raw: Label_domain.t -> t ->
(string * string) list *
(string * string) list list *
(int * string * int) list
......
......@@ -218,8 +218,8 @@ end (* module Sequence *)
module Grs = struct
type t = {
domain: Domain.t;
label_domain: Label.domain;
domain: Feature_domain.t;
label_domain: Label_domain.t;
modules: Modul.t list; (* the ordered list of modules used from rewriting *)
sequences: Sequence.t list;
filename: string;
......@@ -233,7 +233,7 @@ module Grs = struct
let get_label_domain t = t.label_domain
let sequence_names t = List.map (fun s -> s.Sequence.name) t.sequences
let empty = {domain=Domain.empty; label_domain = Label.empty_domain; modules=[]; sequences=[]; ast=Ast.empty_grs; filename=""; }
let empty = {domain=Feature_domain.empty; label_domain = Label_domain.empty; modules=[]; sequences=[]; ast=Ast.empty_grs; filename=""; }
let check t =
(* check for duplicate modules *)
......@@ -254,8 +254,8 @@ module Grs = struct
let build filename =
let ast = Loader.grs filename in
let domain = Domain.build ast.Ast.domain in
let label_domain = Label.build ast.Ast.labels in
let domain = Feature_domain.build ast.Ast.domain in
let label_domain = Label_domain.build ast.Ast.labels in
let modules = List.map (Modul.build domain label_domain) ast.Ast.modules in
let grs = {domain; label_domain; sequences = List.map (Sequence.build modules) ast.Ast.sequences; modules; ast; filename} in
check grs;
......
......@@ -32,7 +32,7 @@ module Rewrite_history: sig
- returns a list of couples (rules, file)
*)
val save_nfs:
Label.domain ->
Label_domain.t ->
?filter: string list ->
?main_feat: string ->
dot: bool ->
......@@ -41,26 +41,26 @@ module Rewrite_history: sig
((string * string list) list * string) list
(** [save_annot out_dir base_name t] writes a set of svg_file for an annotation folder. *)
val save_annot: Label.domain -> string -> string -> t -> (string * int * (string*float) * (string*float) * (float option * float option)) list
val save_annot: Label_domain.t -> string -> string -> t -> (string * int * (string*float) * (string*float) * (float option * float option)) list
(** [save_gr base_name t] saves one gr_file for each normal form defined in [t].
Output files are named according to [base_name] and the Gorn adress in the rewriting tree. *)
val save_gr: Label.domain -> string -> t -> unit
val save_conll: Label.domain -> string -> t -> unit
val save_gr: Label_domain.t -> string -> t -> unit
val save_conll: Label_domain.t -> string -> t -> unit
(** [save_full_conll base_name t] saves one conll_file for each normal form defined in [t].
Output files are named according to [base_name] and a secondary index after "__".
The number of conll file produced is returned. *)
val save_full_conll: Label.domain -> string -> t -> int
val save_full_conll: Label_domain.t -> string -> t -> int
(** [save_det_gr base_name t] supposes that the current GRS is deterministic.
It writes exactly one output file named [base_name].gr with the unique normal form. *)
val save_det_gr: Label.domain ->string -> t -> unit
val save_det_conll: Label.domain -> ?header:string -> string -> t -> unit
val save_det_gr: Label_domain.t ->string -> t -> unit
val save_det_conll: Label_domain.t -> ?header:string -> string -> t -> unit
val det_dep_string: Label.domain -> t -> string option
val det_dep_string: Label_domain.t -> t -> string option
val conll_dep_string: Label.domain -> ?keep_empty_rh:bool -> t -> string option
val conll_dep_string: Label_domain.t -> ?keep_empty_rh:bool -> t -> string option
end (* module Rewrite_history *)
(* ================================================================================ *)
......@@ -86,8 +86,8 @@ module Grs: sig
val get_ast: t -> Ast.grs
val get_domain: t -> Domain.t
val get_label_domain: t -> Label.domain
val get_domain: t -> Feature_domain.t
val get_label_domain: t -> Label_domain.t
val get_filename: t -> string
......
......@@ -402,9 +402,9 @@ module Html_doc = struct
wnl " <code class=\"code\">";
List.iter
(function
| Domain.Closed (feat_name,values) -> wnl "<b>%s</b> : %s<br/>" feat_name (String.concat " | " values)
| Domain.Open feat_name -> wnl " <b>%s</b> : *<br/>" feat_name
| Domain.Num feat_name -> wnl " <b>%s</b> : #<br/>" feat_name
| Feature_domain.Closed (feat_name,values) -> wnl "<b>%s</b> : %s<br/>" feat_name (String.concat " | " values)
| Feature_domain.Open feat_name -> wnl " <b>%s</b> : *<br/>" feat_name
| Feature_domain.Num feat_name -> wnl " <b>%s</b> : #<br/>" feat_name
) ast.Ast.domain;
wnl " </code>";
......
......@@ -28,7 +28,7 @@ end (* module Html_sentences *)
module Html_rh: sig
val build:
Label.domain ->
Label_domain.t ->
?filter: string list ->
?main_feat: string ->
?dot: bool ->
......@@ -41,7 +41,7 @@ module Html_rh: sig
unit
val error:
Label.domain ->
Label_domain.t ->
?main_feat: string ->
?dot: bool ->
?init_graph:bool ->
......@@ -81,5 +81,5 @@ end (* module Corpus_stat *)
(* ================================================================================ *)
module Html_annot: sig
val build: Label.domain -> title:string -> string -> string -> (string * Rewrite_history.t) list -> unit
val build: Label_domain.t -> title:string -> string -> string -> (string * Rewrite_history.t) list -> unit
end (* module Html_annot *)
......@@ -20,7 +20,7 @@ module G_node: sig
val empty: t
val to_string: Label.domain -> t -> string
val to_string: Label_domain.t -> t -> string
val to_gr: t -> string
val get_fs: t -> G_fs.t
......@@ -42,8 +42,8 @@ module G_node: sig
val rm_out_edges: t -> t
val add_edge: G_edge.t -> Gid.t -> t -> t option
val build: Domain.t -> ?def_position: float -> Ast.node -> (Id.name * t)
val of_conll: ?loc:Loc.t -> Domain.t -> Conll.line -> t
val build: Feature_domain.t -> ?def_position: float -> Ast.node -> (Id.name * t)
val of_conll: ?loc:Loc.t -> Feature_domain.t -> Conll.line -> t
val get_position: t -> float
......@@ -77,7 +77,7 @@ module P_node: sig
*)
val unif_fs: P_fs.t -> t -> t
val build: Domain.t -> ?pat_vars: string list -> Ast.node -> (Id.name * t)
val build: Feature_domain.t -> ?pat_vars: string list -> Ast.node -> (Id.name * t)
val add_edge: P_edge.t -> Pid.t -> t -> t option
......
......@@ -240,13 +240,13 @@ feature:
| feature_name=feature_name DDOT feature_values=features_values
{
match feature_values with
| ["#"] -> Domain.Num feature_name
| _ -> Domain.build_closed feature_name feature_values
| ["#"] -> Feature_domain.Num feature_name
| _ -> Feature_domain.build_closed feature_name feature_values
}
(* phon:* *)
| feature_name=feature_name DDOT STAR
{ Domain.Open feature_name }
{ Feature_domain.Open feature_name }
feature_name:
| ci=ID { ci }
......
......@@ -119,22 +119,22 @@ module Rule = struct
Cst_in (pid_of_name loc id, Label_cst.build ~loc label_domain ?locals label_cst)
| (Ast.Feature_eq ((node_name1, feat_name1), (node_name2, feat_name2)), loc) ->
Domain.check_feature_name domain ~loc feat_name1;
Domain.check_feature_name domain ~loc feat_name2;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name2;
Feature_eq (pid_of_name loc node_name1, feat_name1, pid_of_name loc node_name2, feat_name2)
| (Ast.Feature_diseq ((node_name1, feat_name1), (node_name2, feat_name2)), loc) ->
Domain.check_feature_name domain ~loc feat_name1;
Domain.check_feature_name domain ~loc feat_name2;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name2;
Feature_diseq (pid_of_name loc node_name1, feat_name1, pid_of_name loc node_name2, feat_name2)
| (Ast.Feature_ineq (ineq, (node_name1, feat_name1), (node_name2, feat_name2)), loc) ->
Domain.check_feature_name domain ~loc feat_name1;
Domain.check_feature_name domain ~loc feat_name2;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name2;
Feature_ineq (ineq, pid_of_name loc node_name1, feat_name1, pid_of_name loc node_name2, feat_name2)
| (Ast.Feature_ineq_cst (ineq, (node_name1, feat_name1), constant), loc) ->
Domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_ineq_cst (ineq, pid_of_name loc node_name1, feat_name1, constant)
......@@ -169,27 +169,27 @@ module Rule = struct
| (Ast.Feature_eq (feat_id1, feat_id2), loc) ->
let (node_name1, feat_name1) = feat_id1
and (node_name2, feat_name2) = feat_id2 in
Domain.check_feature_name domain ~loc feat_name1;
Domain.check_feature_name domain ~loc feat_name2;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name2;
Feature_eq (pid_of_name loc node_name1, feat_name1, pid_of_name loc node_name2, feat_name2)
| (Ast.Feature_diseq (feat_id1, feat_id2), loc) ->
let (node_name1, feat_name1) = feat_id1
and (node_name2, feat_name2) = feat_id2 in
Domain.check_feature_name domain ~loc feat_name1;
Domain.check_feature_name domain ~loc feat_name2;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name2;
Feature_diseq (pid_of_name loc node_name1, feat_name1, pid_of_name loc node_name2, feat_name2)
| (Ast.Feature_ineq (ineq, feat_id1, feat_id2), loc) ->
let (node_name1, feat_name1) = feat_id1
and (node_name2, feat_name2) = feat_id2 in
Domain.check_feature_name domain ~loc feat_name1;
Domain.check_feature_name domain ~loc feat_name2;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name2;
Feature_ineq (ineq, pid_of_name loc node_name1, feat_name1, pid_of_name loc node_name2, feat_name2)
| (Ast.Feature_ineq_cst (ineq, feat_id1, constant), loc) ->
let (node_name1, feat_name1) = feat_id1 in
Domain.check_feature_name domain ~loc feat_name1;
Feature_domain.check_feature_name domain ~loc feat_name1;
Feature_ineq_cst (ineq, pid_of_name loc node_name1, feat_name1, constant)
(* It may raise [P_fs.Fail_unif] in case of contradiction on constraints *)
......
......@@ -40,18 +40,18 @@ module Instance : sig
val flatten: t -> t
(** [to_gr t] returns a string which contains the "gr" code of the current graph *)
val to_gr: Label.domain -> t -> string
val to_gr: Label_domain.t -> t -> string
(** [to_conll t] returns a string which contains the "conll" code of the current graph *)
val to_conll: Label.domain -> t -> string
val to_conll: Label_domain.t -> t -> string
(** [save_dep_png base t] writes a file "base.png" with the dep representation of [t].
NB: if the Dep2pict is not available, nothing is done *)
val save_dep_png: Label.domain -> ?filter: string list -> ?main_feat: string -> string -> t -> float option
val save_dep_svg: Label.domain -> ?filter: string list -> ?main_feat: string -> string -> t -> float option
val save_dep_png: Label_domain.t -> ?filter: string list -> ?main_feat: string -> string -> t -> float option
val save_dep_svg: Label_domain.t -> ?filter: string list -> ?main_feat: string -> string -> t -> float option
(** [save_dot_png base t] writes a file "base.png" with the dot representation of [t] *)
val save_dot_png: Label.domain -> ?filter: string list -> ?main_feat: string -> string -> t -> unit
val save_dot_png: Label_domain.t -> ?filter: string list -> ?main_feat: string -> string -> t -> unit
end (* module Instance *)
(* ================================================================================ *)
......@@ -71,17 +71,17 @@ module Rule : sig
val is_filter: t -> bool
(** [to_dep t] returns a string in the [dep] language describing the match basic of the rule *)
val to_dep: Label.domain -> t -> string
val to_dep: Label_domain.t -> t -> string
(** [build domain ?local dir ast_rule] returns the Rule.t value corresponding to [ast_rule].
[dir] is used for localisation of lp files *)
val build: Domain.t -> Label.domain -> ?locals:Label.decl array -> string list -> string -> Ast.rule -> t
val build: Feature_domain.t -> Label_domain.t -> ?locals:Label_domain.decl array -> string list -> string -> Ast.rule -> t
(** [normalize domain module_name ?confluent rule_list filter_list instance] returns two sets of good normal forms and bad normal forms *)
(* raise Stop if some command fails to apply *)
val normalize:
Domain.t ->
Label.domain ->
Feature_domain.t ->
Label_domain.t ->
string -> (* module name *)
?confluent:bool ->
t list -> (* rule list *)
......@@ -94,10 +94,10 @@ module Rule : sig
type matching
type pattern
val build_pattern: Domain.t -> Label.domain -> Ast.pattern -> pattern
val build_pattern: Feature_domain.t -> Label_domain.t -> Ast.pattern -> pattern
(** [match_in_graph rule graph] returns the list of matching of the pattern of the rule into the graph *)
val match_in_graph: Label.domain -> ?param:Lex_par.t -> pattern -> G_graph.t -> matching list
val match_in_graph: Label_domain.t -> ?param:Lex_par.t -> pattern -> G_graph.t -> matching list
(** [match_deco rule matching] builds the decoration of the [graph] illustrating the given [matching] of the [rule] *)
(* NB: it can be computed independly from the graph itself! *)
......
......@@ -115,7 +115,7 @@ module Massoc_gid = Massoc_make (Gid)
module Massoc_pid = Massoc_make (Pid)
(* ================================================================================ *)
module Label = struct
module Label_domain = struct
(** describe the display style of a label *)
type line = Solid | Dot | Dash
type style = {
......@@ -126,46 +126,14 @@ module Label = struct
line: line;
}
type domain = string array * style array
let empty_domain = ([||],[||])
(* ============= REMOVE ============
(** Global names and display styles are recorded in two aligned arrays *)
let full = ref None
let styles = ref ([||] : style array)
============= /REMOVE ============ *)
(** Internal representation of labels *)
type t =
| Global of int (* globally defined labels: their names are in the domain *)
| Local of int (* locally defined labels: names array should be provided! UNTESTED *)
| Pattern of string
let match_ (table,_) p_label g_label = match (p_label, g_label) with
| (Global p, Global g) when p=g -> true