Library
Module
Module type
Parameter
Class
Class type
Represent a position in a text file.
val start : t
Position with points to the start of a textfile (line = 0, column = 0).
val line : t -> int
line pos
The line number corresponding to the position p
. Note: The first line is line 0.
val column : t -> int
column pos
The column number corresponding to the position p
. Note: The first column is column 0.
next next_char pos
: Advance the position by using the next character. If the next character is a newline, then the line number is increment and the column number is reset to 0.
is_less_equal p1 p2
Are p1
and p2
in the correct order i.e. p2
is not before p1
.
val is_valid_range : range -> bool
Is the range a valid range in a file i.e. are both positions valid and is the first position before or at the second position?