Skip to content
This repository
tag: v3512
Fetching contributors…

Cannot retrieve contributors at this time

file 65 lines (49 sloc) 2.219 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
(*
Copyright © 2011, 2012 MLstate

This file is part of Opa.

Opa is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

Opa is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with Opa. If not, see <http://www.gnu.org/licenses/>.
*)
(** Used when ident is renamed for bind the newest ident and the
original ident. *)

(** {6 Defined types}*)
(** Type of renaming map *)
type t

(** {6 Construct map}*)
(** Empty renaming map. *)
val empty : t

(** [add t original_id new_id] Add a new binding. Consider
[original_id] has renamed on [new_id].

BEWARE : If a previous binding exists it doesn't erase, implies map is not
bijective.
*)
val add : t -> QmlAst.ident -> QmlAst.ident -> t

(** [remove t original_id] Remove a binding with the [original_id]. *)
val remove_from_original : t -> QmlAst.ident -> t

(** the input map must be injective *)
val from_map : QmlAst.ident IdentMap.t -> t

(** [filter t f] Construct a new map from [t] where [f original_id
new_id] returns [true] *)
val filter : t -> (QmlAst.ident -> QmlAst.ident -> bool) -> t

(** {6 Getter}*)
(** Get the original ident from a given.
@throw [Not_found] if given ident has not added before.*)
val original_from_new : t -> QmlAst.ident -> QmlAst.ident

(** Like [original_from_new] but returns [None] instead of throw
[Not_found]. *)
val original_from_new_opt : t -> QmlAst.ident -> QmlAst.ident option

(** Get the new ident from a original ident.
@throw [Not_found] if given ident has not added before.*)
val new_from_original : t -> QmlAst.ident -> QmlAst.ident

(** Like [new_from_original] but returns [None] instead of throw
[Not_found]. *)
val new_from_original_opt : t -> QmlAst.ident -> QmlAst.ident option

(** pretty printer for renaming maps *)
val pp : Format.formatter -> t -> unit
Something went wrong with that request. Please try again.