Module Lid.Li
include module type of struct include Ocaml_parsing.Longident end
type t = Ocaml_parsing.Longident.t = | Lident of string| Ldot of Merlin_index_format.Lid.Li.t * string| Lapply of Merlin_index_format.Lid.Li.t * Merlin_index_format.Lid.Li.t
val flatten : Merlin_index_format.Lid.Li.t -> string listval unflatten : string list -> Merlin_index_format.Lid.Li.t optionFor 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.
val head : Merlin_index_format.Lid.Li.t -> stringhead lid returns the leftmost part of lid, e.g., given String.Map.empty, returns String.
val last : Merlin_index_format.Lid.Li.t -> stringval parse : string -> Merlin_index_format.Lid.Li.tThis 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.
val keep_suffix :
Merlin_index_format.Lid.Li.t ->
Merlin_index_format.Lid.Li.t * boolif li', b = keep_suffix li then:
- the prefix of
li'is a module path b = falseiffli' = li. Corollary:b = trueifliis a label access (i.e.li = X.Y.z.Foo.Bar...)