Module Hardcaml.Mangler

Map a set of names to a set of unique names.

type t

A mangler is a mapping from strings to the next available integer which should be added to the name to make it unique.

val sexp_of_t : t -> Sexplib0.Sexp.t
val create : case_sensitive:Base.bool -> t

Create a new mangler.

val add_identifier : t -> Base.string -> [ `Ok | `Duplicate ]
val add_identifiers_exn : t -> Base.string Base.list -> Base.unit

Add a list of identifiers to the mangler table. Raises if an identifier is already in the table.

val find_index : t -> Base.string -> Base.int Base.option

Test if the string is in the mangler, and return its mangler index if it is.

val mangle : t -> Base.string -> Base.string

mangle t name returns a unique, mangled name.