package merlin-lib
Merlin's libraries
Install
Dune Dependency
Authors
Maintainers
Sources
merlin-4.14-500.tbz
sha256=ec23f324f875520cd8897f303cc6d4e595f3d7000914d410729f16b86ad1d70e
sha512=8db22100cc0af65b08f456a2a7af84e75396f5869ee7552f1f5888a1c0279d1d85e6eecb3a677ae6f0973a99823cddba0563843ce216197255667342ef161885
doc/src/merlin-lib.analysis/ocamldoc.ml.html
Source file ocamldoc.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
(**************************************************************************) (* *) (* Copyright 2013 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the Lesser GNU Public License version 3.0. *) (* *) (* This software is distributed in the hope that it will be useful, *) (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) (* Lesser GNU General Public License for more details. *) (* *) (**************************************************************************) (** Pops comments from a list of comments (string * loc) to find the ones that are associated to a given location. Also returns the remaining comments after the location. *) let associate_comment ~after_only comments loc nextloc = let lstart = loc.Location.loc_start.Lexing.pos_lnum and lend = loc.Location.loc_end.Lexing.pos_lnum in let isnext c = nextloc <> Location.none && nextloc.Location.loc_start.Lexing.pos_cnum < c.Location.loc_end.Lexing.pos_cnum in let rec aux = function | [] -> None, [] | (comment, cloc)::comments -> let cstart = cloc.Location.loc_start.Lexing.pos_lnum and cend = cloc.Location.loc_end.Lexing.pos_lnum in let processed = (* It seems 4.02.3 remove ** from doc comment string, but not from * locations. We can recognize doc comment by checking how the two * differ. *) (cloc.Location.loc_end.Lexing.pos_cnum - cloc.Location.loc_start.Lexing.pos_cnum) = String.length comment + 5 in if cend < lstart - 1 || cstart < lend && after_only then aux comments else if cstart > lend + 1 || isnext cloc || cstart > lstart && cend < lend (* keep inner comments *) then None, (comment, cloc)::comments else if String.length comment < 2 || (not processed && (comment.[0] <> '*' || comment.[1] = '*')) then aux comments else let comment = if processed then comment else String.sub comment 1 (String.length comment - 1) in let comment = String.trim comment in match aux comments with | None, comments -> Some comment, comments | Some c, comments -> Some (String.concat "\n" [comment; c]), comments in aux comments
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>