B00_serialk_text.TlocSourceText locations.
The type for file paths.
The type for zero-based, absolute, byte positions in text.
The type for one-based, line numbers in the text. Lines increment after a line feed '\n' (U+000A), a carriage return '\r' (U+000D) or a carriage return and a line feed "\r\n" (<U+000D,U+000A>).
The type for line positions. The line number and the byte position of the first element on the line. The later is the byte position after the newline which may not exist (at the end of file).
The type for text locations. A text location is a range of byte positions and the lines on which they occur in the UTF-8 encoded text of a particular file.
v ~file ~sbyte ~ebyte ~sline ~eline is a contructor for text locations. See corresponding accessors for the semantics. If you don't have a file use no_file.
merge l0 l1 merges the location l0 and l1 to the smallest location that spans both location. The file path taken from l0.
pp_ocaml formats location like the OCaml compiler.
pp_gnu formats location according to the GNU convention.
Strictly speaking this doesn't belong here but here you go.
string_subrange ~first ~last s are the consecutive bytes of s whose indices exist in the range [first;last].
first defaults to 0 and last to String.length s - 1.
Note that both first and last can be any integer. If first > last the interval is empty and the empty string is returned.
string_replace ~start ~stop ~rep s replaces the index range [start;stop-1] of s with rep as follows. If start = stop the rep is inserted before start. start and stop must be in range [0;String.length s] and start <= stop or Invalid_argument is raised.