package merlin-lib
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ec23f324f875520cd8897f303cc6d4e595f3d7000914d410729f16b86ad1d70e
sha512=8db22100cc0af65b08f456a2a7af84e75396f5869ee7552f1f5888a1c0279d1d85e6eecb3a677ae6f0973a99823cddba0563843ce216197255667342ef161885
doc/merlin-lib.ocaml_parsing/Ocaml_parsing/Longident/index.html
Module Ocaml_parsing.Longident
Source
Long identifiers, used in parsetree.
Warning: this module is unstable and part of compiler-libs.
To print a longident, see Pprintast.longident
, using Format.asprintf
to convert to a string.
For a non-empty list l
, unflatten l
is Some lid
where lid
is the long identifier created by concatenating the elements of l
with Ldot
. unflatten []
is None
.
head lid
returns the leftmost part of lid
, e.g., given String.Map.empty
, returns String
.
This function is broken on identifiers that are not just "Word.Word.word"; for example, it returns incorrect results on infix operators and extended module paths.
If you want to generate long identifiers that are a list of dot-separated identifiers, the function unflatten
is safer and faster. unflatten
is available since OCaml 4.06.0.
If you want to parse any identifier correctly, use the long-identifiers functions from the Parse
module, in particular Parse.longident
. They are available since OCaml 4.11, and also provide proper input-location support.