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       This  function  is  broken   on   identifiers   that   are   not   just
57       "Word.Word.word";  for  example,  it returns incorrect results on infix
58       operators and extended module paths.
59
60       If you want to generate long identifiers that are a list  of  dot-sepa‐
61       rated  identifiers,  the  function  Longident.unflatten  is  safer  and
62       faster.  Longident.unflatten is available since OCaml 4.06.0.
63
64       If you want to parse any identifier correctly, use the long-identifiers
65       functions  from the Parse module, in particular Parse.longident .  They
66       are available since OCaml 4.11, and also provide proper  input-location
67       support.
68
69
70
71
72
73OCamldoc                          2022-02-04                      Longident(3)
Impressum