package rocq-runtime
- Register visibility of things
- Nametab generic APIs
- Core nametabs
- Specializations for extended references
- These functions declare (resp. return) the source location of the object if known
- Nametab generators
- legacy APIs
- The following functions perform globalization of qualified names
- These functions tell if the given absolute name is already taken
- These functions locate qualids into full user names
- Reverse lookup
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b236dc44f92e1eeca6877c7ee188a90c2303497fe7beb99df711ed5a7ce0d824
doc/rocq-runtime.library/Nametab/index.html
Module Nametab
Source
This module contains the tables for globalization.
These globalization tables associate internal object references to qualified names (qualid). There are three classes of names:
- 1a) internal kernel names:
kernel_name
,constant
,inductive
,module_path
,DirPath.t
- 1b) other internal names:
global_reference
,abbreviation
,extended_global_reference
,global_dir_reference
, ...
- 2) full, non ambiguous user names:
full_path
- 3) non necessarily full, possibly ambiguous user names:
reference
andqualid
Most functions in this module fall into one of the following categories:
push : visibility -> full_user_name -> object_reference -> unit
Registers the
object_reference
to be referred to by thefull_user_name
(and its suffixes according tovisibility
).full_user_name
can either be afull_path
or aDirPath.t
.exists : full_user_name -> bool
Is the
full_user_name
already attributed as an absolute user name of some object?locate : qualid -> object_reference
Finds the object referred to by
qualid
or raisesNot_found
full_name : qualid -> full_user_name
Finds the full user name referred to by
qualid
or raisesNot_found
shortest_qualid_of : object_reference -> user_name
The
user_name
can be for example the shortest non ambiguousqualid
or thefull_user_name
orId.t
. Such a function can also have a local context argument.
to this type are mapped DirPath.t
's in the nametab
Raises a globalization error
Register visibility of things
The visibility can be registered either
- for all suffixes not shorter then a given int -- when the object is loaded inside a module -- or
- for a precise suffix, when the module containing (the module containing ...) the object is opened (imported)
Nametab generic APIs
NAMETAB extended with warnings associated to some of the elements.
Core nametabs
module XRefs :
WarnedTab
with type elt = Globnames.extended_global_reference
and type warning_data :=
Globnames.extended_global_reference UserWarn.with_qf
NAMETAB extended with warnings associated to some of the elements.
Common APIs on name tables.
Common APIs on name tables.
Module types, modules and open modules/modtypes/sections form three separate name spaces (maybe this will change someday)
Common APIs on name tables.
Common APIs on name tables.
Specializations for extended references
These functions operate on XRefs
but are about a subset of extended_global_reference
for convenience.
val push :
?user_warns:Globnames.extended_global_reference UserWarn.with_qf ->
visibility ->
Libnames.full_path ->
Names.GlobRef.t ->
unit
val push_abbreviation :
?user_warns:Globnames.extended_global_reference UserWarn.with_qf ->
visibility ->
Libnames.full_path ->
Globnames.abbreviation ->
unit
val shortest_qualid_of_global :
?loc:Loc.t ->
Names.Id.Set.t ->
Names.GlobRef.t ->
Libnames.qualid
val shortest_qualid_of_abbreviation :
?loc:Loc.t ->
Names.Id.Set.t ->
Globnames.abbreviation ->
Libnames.qualid
Printing of global references using names as short as possible.
Returns in particular the dirpath or the basename of the full path associated to global reference
These functions globalize user-level references into global references, like locate
and co, but raise GlobalizationError
for unbound qualid and UserError
for type mismatches (eg global_inductive
when the qualid is bound to a constructor)
These functions declare (resp. return) the source location of the object if known
Nametab generators
Necessary data to declare the imperative state for a nametab.
Generate a nametab, without warning support.
module MakeWarned
(M : NAMETAB)
(W : WarnInfo with type elt = M.elt)
() :
WarnedTab with type elt = M.elt and type warning_data := W.data
Add warning support to an existing nametab.
module Easy
(M : sig ... end)
() :
WarnedTab with type elt = M.t and type warning_data := M.t UserWarn.with_qf
Generate a nametab with simple warning support (UserWarn.create_depr_and_user_warnings_qf
).
legacy APIs
Deprecation and user warn info
val is_warned_xref :
Globnames.extended_global_reference ->
Globnames.extended_global_reference UserWarn.with_qf option
val warn_user_warn_xref :
?loc:Loc.t ->
Globnames.extended_global_reference UserWarn.with_qf ->
Globnames.extended_global_reference ->
unit
The following functions perform globalization of qualified names
These functions globalize a (partially) qualified name or fail with Not_found
These functions locate all global references with a given suffix; if qualid
is valid as such, it comes first in the list
Experimental completion support, API is _unstable_
completion_canditates qualid
will return the list of global references that have qualid
as a prefix. UI usually will want to compose this with shortest_qualid_of_global
Mapping a full path to a global reference
These functions tell if the given absolute name is already taken
These functions locate qualids into full user names
Reverse lookup
Finding user names corresponding to the given internal name
Returns the full path bound to a global reference or syntactic definition, and the (full) dirpath associated to a module path
A universe_id might not be registered with a corresponding user name.
The shortest_qualid
functions given an object with user_name
Mylib.A.B.x, try to find the shortest among x, B.x, A.B.x and Mylib.A.B.x that denotes the same object.
val shortest_qualid_of_universe :
?loc:Loc.t ->
'u Names.Id.Map.t ->
Univ.UGlobal.t ->
Libnames.qualid
In general we have a UnivNames.universe_binders
around rather than a Id.Set.t
- Register visibility of things
- Nametab generic APIs
- Core nametabs
- Specializations for extended references
- These functions declare (resp. return) the source location of the object if known
- Nametab generators
- legacy APIs
- The following functions perform globalization of qualified names
- These functions tell if the given absolute name is already taken
- These functions locate qualids into full user names
- Reverse lookup