1Longident(3)                     OCaml library                    Longident(3)
2
3
4

NAME

6       Longident - Long identifiers, used in parsetree.
7

Module

9       Module   Longident
10

Documentation

12       Module Longident
13        : sig end
14
15
16       Long identifiers, used in parsetree.
17
18       Warning: this module is unstable and part of Compiler_libs .
19
20
21
22
23
24       type t =
25        | Lident of string
26        | Ldot of t * string
27        | Lapply of t * t
28
29
30
31
32
33       val flatten : t -> string list
34
35
36
37
38       val unflatten : string list -> t option
39
40       For  a non-empty list l , unflatten l is Some lid where lid is the long
41       identifier created by concatenating the elements of l with Ldot .   un‐
42       flatten [] is None .
43
44
45
46       val last : t -> string
47
48
49
50
51       val parse : string -> t
52
53       This   function   is   broken   on   identifiers   that  are  not  just
54       "Word.Word.word"; for example, it returns incorrect  results  on  infix
55       operators and extended module paths.
56
57       If  you  want to generate long identifiers that are a list of dot-sepa‐
58       rated  identifiers,  the  function  Longident.unflatten  is  safer  and
59       faster.  Longident.unflatten is available since OCaml 4.06.0.
60
61       If you want to parse any identifier correctly, use the long-identifiers
62       functions from the Parse module, in particular Parse.longident .   They
63       are  available since OCaml 4.11, and also provide proper input-location
64       support.
65
66
67
68
69       To print a longident, see Pprintast.longident ,  using  Format.asprintf
70       to convert to a string.
71
72OCamldoc                          2021-01-26                      Longident(3)
Impressum