Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Combinaml
Sourceerr
an input position and message.
errors_to_string errs
a helper for converting errs
to a string.
ab <*> a
run ab
and a
in sequence, passing the result of a
to ab
.
lift f p1 p2
run p1
and p2
in sequence, applying f
to the results.
char_range min max
a parser accepting any char in the range min max) (inclusive).
forward n
move the input position forward by n
. fail if resulting input position would be out of bounds.
backward n
move the input position backward by n
. fail if resulting input position would be less than 0.
peek_char_fail
return next char without advancing input. fail on end of input.
peek_string
return next n characters without advancing input.
take_while ?min ?max p
a parser that takes input while p
succeeds up to max
times. fail if less than min
times.
take_until ?min ?max p
a parser that takes input while p
fails up to max
times. fail if less than min
times.
take_while_fn ?min ?max f
take up to max
chars of input while f
is true. fail if less than min
.
scan state f
given initial state
, take input while f
returns Some. returns string * final state.
p1 <|> p2
alternative operator. if p1
fails, run p2
. both p1
and p2
receive the same input.
many ?min ?max p
return a list from evaluating p
up to max
times. fail if less than min
.
fix p
create a lazy version of p
. this allows for creating recursive parsers.
until sep p
take input until the start of sep
(without consuming sep
) and feed the result to p
.
many_until sep p
accumulate result of p
in a list until sep
succeeds. consumes and ignores sep
.
sep_by sep p
accumulate result of (p (sep p)?)+
in a list.
sep_by sep p
accumulate result of (p (sep p)?)*
in a list.
parse_string ?consume p s
return result of running p
on s
. consume:All
requires that all input is consumes by running p <* end_of_input
.
pair a b
a helper useful with lift2.