Commit 18fc3960 authored by bguillaum's avatar bguillaum

cosmetic

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8448 7838e531-6607-4d57-9587-6c381814729c
parent 090d109d
all:
dot -Tpdf arch.dot -o arch.pdf
clean:
rm -f arch.pdf
\ No newline at end of file
digraph grew { digraph grew {
node [shape=Mrecord]; node [shape=Mrecord];
grew_rule [label="{grew_rule|Instance(_set)\nRule}"] rankdir = LR;
grew_command [label="{grew_command|Command}"] grew_base
grew_grs [label="{grew_grs|Rewrite_history\nModul\nSequence\nGrs}"] grew_types [label="grew_types|Pid(_map\|_set)\nGid(_map)\nMassoc[_gid\|_pid]\nLabel\nDomain\nConll\nLex_par\nConcat_item"]
grew_graph [label="{grew_graph|P_deco\nP_graph\nG_deco\nConcat_item\nG_graph}"] grew_ast [label="grew_ast|Ast"]
grew_ast [label="{grew_ast|Ast}"] grew_fs [label="grew_fs|G_fs\nP_fs"]
grew_fs [label="{grew_fs|Domain\nG_fs\nP_fs}"] grew_edge [label="grew_edge|G_edge\nP_edge"]
grew_node [label="{grew_node|G_node\nP_node}"] grew_node [label="grew_node|G_node\nP_node"]
grew_edge [label="{grew_edge|Label\nG_edge\nP_edge}"] grew_command [label="grew_command|Command"]
grew_html [label="{grew_html|Html_doc\nHtml_rh\nHtml_sentences\nGr_stat\nCorpus_stat}"] grew_graph [label="grew_graph|P_deco\nP_graph\nG_deco\nG_graph"]
grew_rule [label="grew_rule|Instance(_set)\nRule"]
grew_grs [label="grew_grs|Rewrite_history\nModul\nSequence\nGrs"]
grew_html [label="grew_html|Html_doc\nHtml_rh\nHtml_sentences\nHtml_annot\nGr_stat\nCorpus_stat"]
grew_ast -> grew_utils grew_ast -> grew_types -> grew_base
grew_command -> grew_edge
grew_command -> grew_fs
grew_edge -> grew_ast grew_edge -> grew_ast
grew_fs -> grew_ast grew_fs -> grew_ast
grew_command -> grew_edge
grew_command -> grew_fs
grew_node -> grew_edge
grew_node -> grew_fs
grew_graph -> grew_node grew_graph -> grew_node
grew_graph -> grew_command grew_graph -> grew_command
libgrew_types -> grew_graph
grew_rule -> libgrew_types
grew_grs -> grew_rule grew_grs -> grew_rule
grew_html -> grew_grs grew_html -> grew_grs
grew_node -> grew_edge
grew_node -> grew_fs
grew_rule -> grew_types
grew_types -> grew_graph
libgrew -> grew_html libgrew -> grew_html
libgrew -> grew_types [style=dotted]
libgrew -> libgrew_types [style=dotted]
} }
\ No newline at end of file
...@@ -210,14 +210,14 @@ module Ast = struct ...@@ -210,14 +210,14 @@ module Ast = struct
| Includ of (string * Loc.t) | Includ of (string * Loc.t)
type grs_with_include = { type grs_with_include = {
domain_wi: Domain.domain; domain_wi: Domain.t;
labels_wi: (string * string list) list; (* the list of global edge labels *) labels_wi: (string * string list) list; (* the list of global edge labels *)
modules_wi: module_or_include list; modules_wi: module_or_include list;
sequences_wi: sequence list; sequences_wi: sequence list;
} }
type grs = { type grs = {
domain: Domain.domain; domain: Domain.t;
labels: (string * string list) list; labels: (string * string list) list;
modules: modul list; modules: modul list;
sequences: sequence list; sequences: sequence list;
......
...@@ -147,7 +147,7 @@ module Ast : sig ...@@ -147,7 +147,7 @@ module Ast : sig
| Includ of (string * Loc.t) | Includ of (string * Loc.t)
type grs_with_include = { type grs_with_include = {
domain_wi: Domain.domain; domain_wi: Domain.t;
labels_wi: (string * string list) list; (* the list of global edge labels *) labels_wi: (string * string list) list; (* the list of global edge labels *)
modules_wi: module_or_include list; modules_wi: module_or_include list;
sequences_wi: sequence list; sequences_wi: sequence list;
...@@ -155,7 +155,7 @@ module Ast : sig ...@@ -155,7 +155,7 @@ module Ast : sig
(* a GRS: graph rewriting system *) (* a GRS: graph rewriting system *)
type grs = { type grs = {
domain: Domain.domain; domain: Domain.t;
labels: (string * string list) list; labels: (string * string list) list;
modules: modul list; modules: modul list;
sequences: sequence list; sequences: sequence list;
......
...@@ -510,33 +510,6 @@ module Id = struct ...@@ -510,33 +510,6 @@ module Id = struct
with Not_found -> None with Not_found -> None
end (* module Id *) end (* module Id *)
(* ================================================================================ *)
module Html = struct
let css = String.concat "\n" [
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />";
"<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">"
]
let enter out_ch ?title ?header base_name =
fprintf out_ch "<html>\n";
(match title with
| Some t -> fprintf out_ch "<head>\n%s\n<title>%s</title>\n</head>\n" css t
| None -> fprintf out_ch "<head>\n%s\n</head>\n" css
);
fprintf out_ch "<body>\n";
(match header with None -> () | Some s -> fprintf out_ch "%s\n" s);
(match title with
| Some t -> fprintf out_ch "<h1>%s</h1>\n" t
| None -> ()
)
let leave out_ch =
fprintf out_ch "</body>\n";
fprintf out_ch "</html>\n";
end (* module Html *)
(* ================================================================================ *) (* ================================================================================ *)
(* copy from leopar *) (* copy from leopar *)
module Timeout = struct module Timeout = struct
......
...@@ -137,6 +137,7 @@ module List_: sig ...@@ -137,6 +137,7 @@ module List_: sig
val prev_next_iter: (?prev:'a -> ?next:'a -> 'a -> unit) -> 'a list -> unit val prev_next_iter: (?prev:'a -> ?next:'a -> 'a -> unit) -> 'a list -> unit
end end
(* ================================================================================ *)
module type OrderedType = module type OrderedType =
sig sig
type t type t
...@@ -152,7 +153,7 @@ module type OrderedType = ...@@ -152,7 +153,7 @@ module type OrderedType =
end end
(** Input signature of the functor {!Map.Make}. *) (** Input signature of the functor {!Map.Make}. *)
(* ================================================================================ *)
module type S = module type S =
sig sig
type key type key
...@@ -197,9 +198,10 @@ module type S = ...@@ -197,9 +198,10 @@ module type S =
val rename: (key * key) list -> 'a t -> 'a t val rename: (key * key) list -> 'a t -> 'a t
end end
(* ================================================================================ *)
module Massoc_make (Ord : OrderedType) : S with type key = Ord.t module Massoc_make (Ord : OrderedType) : S with type key = Ord.t
(* ================================================================================ *)
module Error: sig module Error: sig
exception Build of (string * Loc.t option) exception Build of (string * Loc.t option)
exception Run of (string * Loc.t option) exception Run of (string * Loc.t option)
...@@ -210,6 +212,7 @@ module Error: sig ...@@ -210,6 +212,7 @@ module Error: sig
val bug: ?loc: Loc.t -> ('a, unit, string, 'b) format4 -> 'a val bug: ?loc: Loc.t -> ('a, unit, string, 'b) format4 -> 'a
end end
(* ================================================================================ *)
module Id: sig module Id: sig
type name = string type name = string
type t = int type t = int
...@@ -222,11 +225,7 @@ module Id: sig ...@@ -222,11 +225,7 @@ module Id: sig
val build_opt: name -> table -> t option val build_opt: name -> table -> t option
end end
module Html: sig (* ================================================================================ *)
val enter: out_channel -> ?title: string -> ?header: string -> string -> unit
val leave: out_channel -> unit
end
module Timeout: sig module Timeout: sig
exception Stop exception Stop
......
...@@ -18,7 +18,7 @@ open Grew_ast ...@@ -18,7 +18,7 @@ open Grew_ast
open Grew_edge open Grew_edge
open Grew_fs open Grew_fs
(* ==================================================================================================== *) (* ================================================================================ *)
module Command = struct module Command = struct
type command_node = (* a command node is either: *) type command_node = (* a command node is either: *)
| Pat of Pid.t (* a node identified in the pattern *) | Pat of Pid.t (* a node identified in the pattern *)
......
...@@ -14,7 +14,7 @@ open Grew_types ...@@ -14,7 +14,7 @@ open Grew_types
open Grew_edge open Grew_edge
(* ==================================================================================================== *) (* ================================================================================ *)
module Command : sig module Command : sig
type command_node = (* a command node is either: *) type command_node = (* a command node is either: *)
| Pat of Pid.t (* a node identified in the pattern *) | Pat of Pid.t (* a node identified in the pattern *)
......
...@@ -105,4 +105,3 @@ module P_edge = struct ...@@ -105,4 +105,3 @@ module P_edge = struct
| list -> Binds (i, list)) | list -> Binds (i, list))
| _ -> Fail | _ -> Fail
end (* module P_edge *) end (* module P_edge *)
...@@ -13,8 +13,6 @@ open Grew_types ...@@ -13,8 +13,6 @@ open Grew_types
open Grew_ast open Grew_ast
(* ================================================================================ *) (* ================================================================================ *)
(** The module [G_edge] defines the type of Graph label edges: atomic edges *) (** The module [G_edge] defines the type of Graph label edges: atomic edges *)
module G_edge: sig module G_edge: sig
...@@ -30,7 +28,6 @@ module G_edge: sig ...@@ -30,7 +28,6 @@ module G_edge: sig
val to_dep: ?deco:bool -> t -> string val to_dep: ?deco:bool -> t -> string
end (* module G_edge *) end (* module G_edge *)
(* ================================================================================ *) (* ================================================================================ *)
(** The module [G_edge] defines the type of Graph label edges: atomic edges *) (** The module [G_edge] defines the type of Graph label edges: atomic edges *)
module P_edge: sig module P_edge: sig
......
...@@ -15,7 +15,7 @@ open Grew_base ...@@ -15,7 +15,7 @@ open Grew_base
open Grew_types open Grew_types
open Grew_ast open Grew_ast
(* ==================================================================================================== *) (* ================================================================================ *)
module G_feature = struct module G_feature = struct
type t = string * value type t = string * value
...@@ -44,9 +44,9 @@ module G_feature = struct ...@@ -44,9 +44,9 @@ module G_feature = struct
match Str.split (Str.regexp ":C:") string_val with match Str.split (Str.regexp ":C:") string_val with
| [] -> Error.bug "[G_feature.to_dot] feature value '%s'" string_val | [] -> Error.bug "[G_feature.to_dot] feature value '%s'" string_val
| fv::_ -> bprintf buff "<TR><TD ALIGN=\"right\">%s</TD><TD>=</TD><TD ALIGN=\"left\">%s</TD></TR>\n" feat_name fv | fv::_ -> bprintf buff "<TR><TD ALIGN=\"right\">%s</TD><TD>=</TD><TD ALIGN=\"left\">%s</TD></TR>\n" feat_name fv
end end (* module G_feature *)
(* ==================================================================================================== *) (* ================================================================================ *)
module P_feature = struct module P_feature = struct
(* feature= (feature_name, disjunction of atomic values) *) (* feature= (feature_name, disjunction of atomic values) *)
...@@ -94,9 +94,9 @@ module P_feature = struct ...@@ -94,9 +94,9 @@ module P_feature = struct
match List_.pos var l with match List_.pos var l with
| Some index -> (name, Param index) | Some index -> (name, Param index)
| None -> Error.build ~loc "[P_feature.build] Unknown pattern variable '%s'" var | None -> Error.build ~loc "[P_feature.build] Unknown pattern variable '%s'" var
end end (* module P_feature *)
(* ==================================================================================================== *) (* ================================================================================ *)
module G_fs = struct module G_fs = struct
(* list are supposed to be striclty ordered wrt compare*) (* list are supposed to be striclty ordered wrt compare*)
type t = G_feature.t list type t = G_feature.t list
...@@ -257,7 +257,7 @@ module G_fs = struct ...@@ -257,7 +257,7 @@ module G_fs = struct
) )
end (* module G_fs *) end (* module G_fs *)
(* ==================================================================================================== *) (* ================================================================================ *)
module P_fs = struct module P_fs = struct
(* list are supposed to be striclty ordered wrt compare*) (* list are supposed to be striclty ordered wrt compare*)
type t = P_feature.t list type t = P_feature.t list
......
...@@ -215,13 +215,6 @@ module G_deco = struct ...@@ -215,13 +215,6 @@ module G_deco = struct
) t.edges ) t.edges
end (* module G_deco *) end (* module G_deco *)
(* ================================================================================ *)
module Concat_item = struct
type t =
| Feat of (Gid.t * string)
| String of string
end (* module Concat_item *)
(* ================================================================================ *) (* ================================================================================ *)
module G_graph = struct module G_graph = struct
type t = { type t = {
......
...@@ -17,7 +17,7 @@ open Grew_edge ...@@ -17,7 +17,7 @@ open Grew_edge
open Grew_node open Grew_node
open Grew_command open Grew_command
(* ==================================================================================================== *) (* ================================================================================ *)
module P_deco: sig module P_deco: sig
type t = type t =
{ nodes: Pid.t list; { nodes: Pid.t list;
...@@ -27,7 +27,7 @@ module P_deco: sig ...@@ -27,7 +27,7 @@ module P_deco: sig
val empty:t val empty:t
end (* module P_deco *) end (* module P_deco *)
(* ==================================================================================================== *) (* ================================================================================ *)
module G_deco: sig module G_deco: sig
type t = type t =
{ nodes: (Gid.t * (string * string list)) list; { nodes: (Gid.t * (string * string list)) list;
...@@ -37,10 +37,9 @@ module G_deco: sig ...@@ -37,10 +37,9 @@ module G_deco: sig
val empty:t val empty:t
val dump: t -> unit val dump: t -> unit
end (* module G_deco *) end (* module G_deco *)
(* ==================================================================================================== *) (* ================================================================================ *)
module P_graph: sig module P_graph: sig
type t = P_node.t Pid_map.t type t = P_node.t Pid_map.t
...@@ -74,14 +73,7 @@ module P_graph: sig ...@@ -74,14 +73,7 @@ module P_graph: sig
(extension * Id.table) (extension * Id.table)
end (* module P_graph *) end (* module P_graph *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Concat_item : sig
type t =
| Feat of (Gid.t * string)
| String of string
end (* module Concat_item *)
(* ==================================================================================================== *)
module G_graph: sig module G_graph: sig
type t type t
...@@ -178,6 +170,4 @@ module G_graph: sig ...@@ -178,6 +170,4 @@ module G_graph: sig
(string * string) list * (string * string) list *
(string * string) list list * (string * string) list list *
(int * string * int) list (int * string * int) list
end (* module G_graph *)
end \ No newline at end of file
...@@ -21,7 +21,7 @@ open Grew_graph ...@@ -21,7 +21,7 @@ open Grew_graph
open Grew_rule open Grew_rule
open Grew_parser open Grew_parser
(* ==================================================================================================== *) (* ================================================================================ *)
module Rewrite_history = struct module Rewrite_history = struct
type t = { type t = {
instance: Instance.t; instance: Instance.t;
...@@ -132,7 +132,7 @@ module Rewrite_history = struct ...@@ -132,7 +132,7 @@ module Rewrite_history = struct
in loop t in loop t
end (* module Rewrite_history *) end (* module Rewrite_history *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Modul = struct module Modul = struct
type t = { type t = {
name: string; name: string;
...@@ -172,7 +172,7 @@ module Modul = struct ...@@ -172,7 +172,7 @@ module Modul = struct
check modul; modul check modul; modul
end (* module Modul *) end (* module Modul *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Sequence = struct module Sequence = struct
type t = { type t = {
name: string; name: string;
...@@ -198,7 +198,7 @@ module Sequence = struct ...@@ -198,7 +198,7 @@ module Sequence = struct
check module_list sequence; sequence check module_list sequence; sequence
end (* module Sequence *) end (* module Sequence *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Grs = struct module Grs = struct
type t = { type t = {
......
...@@ -13,7 +13,7 @@ open Grew_graph ...@@ -13,7 +13,7 @@ open Grew_graph
open Grew_rule open Grew_rule
open Grew_ast open Grew_ast
(* ==================================================================================================== *) (* ================================================================================ *)
module Rewrite_history: sig module Rewrite_history: sig
type t = { type t = {
instance: Instance.t; instance: Instance.t;
...@@ -54,9 +54,9 @@ module Rewrite_history: sig ...@@ -54,9 +54,9 @@ module Rewrite_history: sig
val det_dep_string: t -> string option val det_dep_string: t -> string option
val conll_dep_string: ?keep_empty_rh:bool -> t -> string option val conll_dep_string: ?keep_empty_rh:bool -> t -> string option
end end (* module Rewrite_history *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Modul: sig module Modul: sig
type t = { type t = {
name: string; name: string;
...@@ -67,9 +67,9 @@ module Modul: sig ...@@ -67,9 +67,9 @@ module Modul: sig
confluent: bool; confluent: bool;
loc: Loc.t; loc: Loc.t;
} }
end end (* module Modul *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Grs: sig module Grs: sig
type t type t
...@@ -95,4 +95,4 @@ module Grs: sig ...@@ -95,4 +95,4 @@ module Grs: sig
val filter_iter: (string -> Rule.t -> unit) -> t -> unit val filter_iter: (string -> Rule.t -> unit) -> t -> unit
val modules_of_sequence: t -> string -> Modul.t list val modules_of_sequence: t -> string -> Modul.t list
end end (* module Grs *)
...@@ -38,7 +38,7 @@ let html_header ?css_file ?title ?(add_lines=[]) buff = ...@@ -38,7 +38,7 @@ let html_header ?css_file ?title ?(add_lines=[]) buff =
List.iter (fun line -> wnl " %s" line) add_lines; List.iter (fun line -> wnl " %s" line) add_lines;
wnl " </head>"; wnl " </head>";
(* ====================================================================================================*) (* ================================================================================*)
module Html_doc = struct module Html_doc = struct
let string_of_concat_item = function let string_of_concat_item = function
...@@ -377,7 +377,7 @@ module Html_doc = struct ...@@ -377,7 +377,7 @@ module Html_doc = struct
(function (function
| Domain.Closed (feat_name,values) -> wnl "<b>%s</b> : %s<br/>" feat_name (String.concat " | " values) | 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.Open feat_name -> wnl " <b>%s</b> : *<br/>" feat_name
| Domain.Int feat_name -> wnl " <b>%s</b> : #<br/>" feat_name | Domain.Num feat_name -> wnl " <b>%s</b> : #<br/>" feat_name
) ast.Ast.domain; ) ast.Ast.domain;
wnl " </code>"; wnl " </code>";
...@@ -496,7 +496,7 @@ module Html_doc = struct ...@@ -496,7 +496,7 @@ module Html_doc = struct
done done
end (* module Html_doc *) end (* module Html_doc *)
(* ==================================================================================================== *) (* ================================================================================ *)
module Html_rh = struct module Html_rh = struct
let build ?filter ?main_feat ?(dot=false) ?(init_graph=true) ?(out_gr=false) ?header ?graph_file prefix t = let build ?filter ?main_feat ?(dot=false) ?(init_graph=true) ?(out_gr=false) ?header ?graph_file prefix t =
...@@ -637,7 +637,7 @@ module Html_rh = struct ...@@ -637,7 +637,7 @@ module Html_rh = struct
close_out out_ch close_out out_ch
end (* module Html_rh *) end (* module Html_rh *)
(* ====================================================================================================*) (* ================================================================================*)
module Html_sentences = struct module Html_sentences = struct
let build ~title output_dir sentences = let build ~title output_dir sentences =
let buff = Buffer.create 32 in let buff = Buffer.create 32 in
...@@ -674,9 +674,7 @@ module Html_sentences = struct ...@@ -674,9 +674,7 @@ module Html_sentences = struct
close_out out_ch close_out out_ch
end (* module Html_sentences *) end (* module Html_sentences *)
(* ================================================================================*)
(* ====================================================================================================*)
module Gr_stat = struct module Gr_stat = struct
(** the type [gr] stores the stats for the rewriting of one gr file *) (** the type [gr] stores the stats for the rewriting of one gr file *)
...@@ -792,7 +790,7 @@ module Gr_stat = struct ...@@ -792,7 +790,7 @@ module Gr_stat = struct
with Sys_error msg -> Error (sprintf "Sys_error: %s" msg) with Sys_error msg -> Error (sprintf "Sys_error: %s" msg)
end (* module Gr_stat *) end (* module Gr_stat *)
(* ====================================================================================================*) (* ================================================================================*)
module Corpus_stat = struct module Corpus_stat = struct
(** the [t] type stores stats for a corpus of gr_files *) (** the [t] type stores stats for a corpus of gr_files *)
(* (*
...@@ -1006,11 +1004,8 @@ module Corpus_stat = struct ...@@ -1006,11 +1004,8 @@ module Corpus_stat = struct
let out_ch = open_out (Filename.concat output_dir "index.html") in let out_ch = open_out (Filename.concat output_dir "index.html") in
fprintf out_ch "%s" (Buffer.contents buff); fprintf out_ch "%s" (Buffer.contents buff);
close_out out_ch close_out out_ch
end (* module Stat *) end (* module Stat *)