package odoc
OCaml Documentation Generator
Install
Dune Dependency
Authors
Maintainers
Sources
odoc-3.0.0.tbz
sha256=ce84fa7e0cc5f3e8a54e6adeb10826152798b602057b9e46c5ae7e5d5206812b
sha512=9febd413450ca2e3824c9ef7e1c9ae8d8094aa72ed71327a69d8d6b42f6f197b3f3f40d674de0d11fa1242ee0df95c693b5d74467d530704e1339f3a523452f6
doc/src/odoc.model/location_.ml.html
Source file location_.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
include Odoc_parser.Loc let set_end_as_offset_from_start offset span = { span with end_ = { span.start with column = span.start.column + offset } } let point_in_string s offset point = let rec scan_string line column index = if index >= offset then (line, column) else if index >= String.length s then (line, column) else match s.[index] with | '\n' -> scan_string (line + 1) 0 (index + 1) | _ -> scan_string line (column + 1) (index + 1) in let line, column = scan_string 0 0 0 in { line = point.line + line; column = point.column + column } (* Calling this repeatedly on the same string can be optimized, but there is no evidence yet that performance of this is a problem. *) let in_string s ~offset ~length s_span = { s_span with start = point_in_string s offset s_span.start; end_ = point_in_string s (offset + length) s_span.start; } let pp fmt l = Format.fprintf fmt "File \"%s\", " l.file; if l.start.line = l.end_.line then Format.fprintf fmt "line %i, characters %i-%i" l.start.line l.start.column l.end_.column else Format.fprintf fmt "line %i, character %i to line %i, character %i" l.start.line l.start.column l.end_.line l.end_.column let pp_span_start fmt s = Format.fprintf fmt "File \"%s\", line %d, character %d" s.file s.start.line s.start.column let span_equal = ( = )
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>