Environment.EnvironmentThis module signature describes the interface for modules implementing environments
type entry = | Signature of Signature.Data_Signature.t| Lexicon of Acg_lexicon.Data_Lexicon.tThe type of what an environment can contain
*)val empty : tempty is the empty environmnent
insert c ~to_be_dumped:d e adds the content c into the environment e and returns the resulting environmnent. If d is set to true, then c will be dumped in e . The default value for the overwrite optional parameter is false.
val list_signatures : t -> string listlist_signatures e returns a list containing the names of all signatures in the environment e.
val list_lexicons : t -> string listlist_lexicons e returns a list containing the names of all lexicons in the environment e.
prepare_dump ~filename e returns the environment a ready to be dumped (in file filename environment of type dumped_t similar to e, but without the data which has false in to_be_dumped. The data of the returned environment has false in to_be_dumped. If force is set to true (default is false), all the data available in the environement are dumped anyway, whether they have their to_be_dumped flag set to true or not. It is useful in case we want to generate a full environment out of only object files.
val get : string -> t -> UtilsLib.Error.pos -> entryget name e loc returns the entry of name name in the environment e. Raise a corresponding error is there is no such entry.
get_opt name e returns the entry of name name in the environment e. Returns none if there is no such entry.
val get_signature :
string ->
t ->
UtilsLib.Error.pos ->
Signature.Data_Signature.tget name e loc returns the signature of name name in the environment e. Raise a corresponding error is there is no such signature.
val get_lexicon :
string ->
t ->
UtilsLib.Error.pos ->
Acg_lexicon.Data_Lexicon.tget name e loc returns the lexicon of name name in the environment e. Raise a corresponding error is there is no such lexicon.
append e1 e2 merges the two environment e1 and e2. If an entry appears in both environment then the one of e2 is kept if the overwrite parameter is set to true (default is false). If set to false, if an entry appears in both environment, an error is emitted.
iter f e applies f to every data contained in the environment
fold f a e returns f a_n (f a_n-1 (... (f a1 (f a0 a)) ... )) where the a_0 ... a_n are the n+1 elements of the environmnent
val sig_number : t -> intsig_number e returns the number of signatures an environment contains
val lex_number : t -> intsig_number e returns the number of lexicons an environment contains
val choose_signature : t -> Signature.Data_Signature.t optionchoose_signature e returns a randomly chosen signature in the environment e