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 -> Ppx_sexp_conv_lib.Sexp.t
val create : case_sensitive:Hardcaml__.Import.bool -> t

Create a new mangler.

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

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

val find_index : t -> Hardcaml__.Import.string -> Hardcaml__.Import.int Hardcaml__.Import.option

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

val mangle : t -> Hardcaml__.Import.string -> Hardcaml__.Import.string

mangle t name returns a unique, mangled name.