package dolmen

  1. Overview
  2. Docs

Module Scope.MakeSource

Parameters

module Id : Arg

Signature

Sourcetype t

The type of scope for a given language.

Sourcetype rename

The type of renaming scheme that is used.

Sourcetype on_conflict =
  1. | Error
  2. | Shadow
  3. | Rename

The different behaviours that are available upon encountering a conflict beetween names for identifiers.

Sourceval mk_rename : 'acc -> ('acc -> Name.t -> 'acc * Name.t) -> rename

Create a renaming scheme.

Sourceval empty : rename:rename -> sanitize:(Id.t -> Name.t -> Name.t) -> on_conflict:(prev_id:Id.t -> new_id:Id.t -> name:Name.t -> on_conflict) -> t

Create an escaper from scratch. The name function is called to determine the name of an identifier. The escape function is assumed to be idempotent and have a lot of fixpoints (i.e. all valid identifiers name should map to themselves) whereas the renaming function should have absolutely no fixpoint (i.e. for all strings rename s <> s)

Sourceval bind : t -> Id.t -> t

Bind a new id in the scope.

Sourceval name : t -> Id.t -> Name.t

Return the name bound to an id.