package odoc
OCaml Documentation Generator
Install
Dune Dependency
Authors
Maintainers
Sources
odoc-3.1.0.tbz
sha256=355b3cfff4934903cbaed8b51ce35e333e8609932d230294200a9f2d42ffa914
sha512=f78318d0a16164a9cd16ee02f611c2e00d32b772fe38e992d6db6ec94b1c00cd9c377fbfe64031b8f245e57b2f3aac9364108327e7f1693533ddcff94c476e05
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)"
>