package ocp-indent
A simple tool to indent OCaml programs
Install
Dune Dependency
Authors
Maintainers
Sources
1.7.0.tar.gz
md5=3bc327e38f453f38494098725c97d2cb
sha512=5b28ae8695612c95cb0f5748de9b9f01d8ef4ad18b31340dc526ccae5fb1b6ee7e12024ff1beb817a43796183a83bca144222ca2d77d7750f2ff56108b5fa350
doc/src/ocp-indent.utils/pos.ml.html
Source file pos.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
(**************************************************************************) (* *) (* Copyright 2011 Jun Furuse *) (* Copyright 2012 OCamlPro *) (* *) (* All rights reserved.This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1 with linking *) (* exception. *) (* *) (* TypeRex 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. *) (* *) (**************************************************************************) module Position = struct type t = Lexing.position = { pos_fname : string; pos_lnum : int; pos_bol : int; pos_cnum : int; } let to_string t = Printf.sprintf "%s%d:%d" (if t.pos_fname = "" then "" else t.pos_fname ^ ":") t.pos_lnum (t.pos_cnum - t.pos_bol) let zero = { pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum = 0 } let column p = p.pos_cnum - p.pos_bol end module Region = struct open Position type t = Position.t * Position.t let fst = fst let snd = snd let create p1 p2 = (p1,p2) let start_column (p,_) = column p let end_column (_,p) = column p let start_line (p,_) = p.pos_lnum let end_line (_,p) = p.pos_lnum let char_offset (p, _) = p.pos_cnum let length (p1, p2) = p2.Position.pos_cnum - p1.Position.pos_cnum let zero = (Position.zero, Position.zero) let translate (p,p') diff = { p with pos_cnum = p .pos_cnum + diff }, { p' with pos_cnum = p'.pos_cnum + diff } end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>