package merlin-lib
Merlin's libraries
Install
Dune Dependency
Authors
Maintainers
Sources
merlin-5.5-503.tbz
sha256=67da3b34f2fea07678267309f61da4a2c6f08298de0dc59655b8d30fd8269af1
sha512=1fb3b5180d36aa82b82a319e15b743b802b6888f0dc67645baafdb4e18dfc23a7b90064ec9bc42f7424061cf8cde7f8839178d8a8537bf4596759f3ff4891873
doc/src/merlin-lib.ocaml_parsing/longident.ml.html
Source file longident.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
(**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) type t = Lident of string | Ldot of t * string | Lapply of t * t let rec flat accu = function Lident s -> s :: accu | Ldot(lid, s) -> flat (s :: accu) lid | Lapply(_, _) -> Misc.fatal_error "Longident.flat" let flatten lid = flat [] lid let rec head = function Lident s -> s | Ldot(lid, _) -> head lid | Lapply(_, _) -> assert false let last = function Lident s -> s | Ldot(_, s) -> s | Lapply(_, _) -> Misc.fatal_error "Longident.last" let rec split_at_dots s pos = try let dot = String.index_from s pos '.' in String.sub s pos (dot - pos) :: split_at_dots s (dot + 1) with Not_found -> [String.sub s pos (String.length s - pos)] let unflatten l = match l with | [] -> None | hd :: tl -> Some (List.fold_left (fun p s -> Ldot(p, s)) (Lident hd) tl) let parse s = match unflatten (split_at_dots s 0) with | None -> Lident "" (* should not happen, but don't put assert false so as not to crash the toplevel (see Genprintval) *) | Some v -> v let keep_suffix = let rec aux = function | Lident str -> if String.uncapitalize_ascii str <> str then Some (Lident str, false) else None | Ldot (t, str) -> if String.uncapitalize_ascii str <> str then match aux t with | None -> Some (Lident str, true) | Some (t, is_label) -> Some (Ldot (t, str), is_label) else None | t -> Some (t, false) (* Can be improved... *) in function | Lident s -> Lident s, false | Ldot (t, s) -> begin match aux t with | None -> Lident s, true | Some (t, is_label) -> Ldot (t, s), is_label end | otherwise -> otherwise, false
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>