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