Fmlib_parse.IndentThe allowed indentations: Helper module for indentation sensitive parsing.
type violation = expectationval group :
('a * expectation option) list ->
(expectation option * 'a list) listgroup lst Group the list of expectations.
Failed expectations with the same indentation expectation (or not indentation expectation) are grouped into one list. The sequence is not changed.
val expectation : t -> expectation optionexpectation ind The expected indentation or alignment. Returns None if all positions are allowed.
val initial : tInitially all indentations 0,1,... are allowed and no alignment is required.
val check_position : int -> t -> expectation optioncheck_position col ind Return a violated expectation, if pos is not an allowed indentation position. Otherwise return None.
token pos ind Accept a token at column pos.
Preconditions: is_position_allowed pos ind.
align ind Set the alignment flag.
The next token sets the indentation set to {pos} where pos is the column of the token and clears the aligment flag.
left_align ind Set the alignment flag and the indentation set to {pos} where pos is the lower bound of the current set of indentation positions.
end_align ind0 ind End the aligned sequence i.e. handle the corner case that the aligned sequence is empty.
start_indent i ind Start an indented grammar construct indented by at least i relative to its parent.
If the aligmnent flag is set, indentation is ignored.
Precondition: 0 <= incr