Prim
The primitive parser combinators
This parser only succeeds at the end of the input. This is not a
primitive parser but it is defined using 'notFollowedBy'.
Get the current index into the source
Get the current position of the parser in the source as a line
and column index (starting at 1 for both)
This parser is useful to put at the top of LINQ expressions, it
makes it easier to put breakpoints on the actual first parser
in an expression. It returns unit
Parse a char list and convert into an double precision floating point value
Parse a char list and convert into an double precision floating point value
Parse a char list and convert into an integer
Parse a char list and convert into an integer
Parse a char list and convert into a string
The parser attempt(p) behaves like parser p, except that it
pretends that it hasn't consumed any input when an error occurs.
This combinator is used whenever arbitrary look ahead is needed.
Since it pretends that it hasn't consumed any input when p fails,
the either combinator will try its second alternative even when the
first parser failed while consuming input.
See remarks.
between(open,close,p) parses open, followed by p and close.
Runs a sequence of parsers, if any fail then the failure state is
returned immediately and subsequence parsers are not run.
Runs a sequence of parsers, if any fail then the failure state is
returned immediately and subsequence parsers are not run.
chainl(p,op,x) parses zero or more occurrences of p, separated by op
chainl1(p,op) parses one or more occurrences of p, separated by op.
chainr(p,op,x) parses zero or more occurrences of p, separated by op
chainr1(p,op) parses one or more occurrences of p, separated by op.
choice(ps) tries to apply the parsers in the list ps in order, until one
of them succeeds.
choice(ps) tries to apply the parsers in the list ps in order, until one
of them succeeds.
count(n,p) parses n occurrences of p. If n is smaller or
equal to zero, the parser equals to result([]).
This combinator implements choice. The parser either(p,q) first
applies p. If it succeeds, the value of p is returned. If p
fails /without consuming any input/, parser q is tried.
endBy(p,sep) parses zerp or more occurrences of p, separated
and ended by sep.
endBy1(p,sep) parses one or more occurrences of p, separated
and ended by sep.
The parser failure(msg) always fails with a Message error
without consuming any input.
The parsers 'failure', 'label' and 'unexpected' are the three parsers
used to generate error messages. Of these, only 'label' is commonly
used. For an example of the use of unexpected, see the definition
of 'Text.Parsec.Combinator.notFollowedBy'.
Special parser for getting user-state that was previously
set with setState
Lazy parser - useful in recursive scenarios.
lookAhead(p) parses p without consuming any input.
If p fails and consumes some input, so does lookAhead(p). Combine with
'attempt' if this is undesirable.
many(p) applies the parser p zero or more times.
many1(p) applies the parser p one or more times.
manyn(p, n) applies the parser p n times.
manyn0(p) applies the parser p zero or up to a maximum of n times.
manyn1(p) applies the parser p one or up to a maximum of n times.
notFollowedBy(p) only succeeds when parser p fails. This parser
does not consume any input.This parser can be used to implement the
'longest match' rule.
optional(p) tries to apply parser p. If p fails without
consuming input, it return 'None', otherwise it returns
'Some' the value returned by p.
optionalArray(p) tries to apply parser p. If p fails without
consuming input, it return [], otherwise it returns a one
item array with the result of p.
optionalList(p) tries to apply parser p. If p fails without
consuming input, it return [], otherwise it returns a one
item Lst with the result of p.
optionalSeq(p) tries to apply parser p. If p fails without
consuming input, it return an empty IEnumerable, otherwise it returns
a one item IEnumerable with the result of p.
optionOrElse(x, p) tries to apply parser p. If p fails without
consuming input, it returns the value x, otherwise the value
returned by p.
Run the parser p with the input provided
Run the parser p with the input provided
Always success parser. Returns the value provided.
This is monad return for the Parser monad
sepBy(p,sep) parses zero or more occurrences of p, separated
by sep.
sepBy1(p,sep) parses one or more occurrences of p, separated
by sep.
sepEndBy(p,sep) parses zero or more occurrences of p,
separated and optionally ended by sep.
sepEndBy1(p,sep) parses one or more occurrences of p,
separated and optionally ended by sep.
Special parser for setting user-state that propagates
through the computation.
skipMany(p) applies the parser p zero or more times, skipping
its result.
skipMany(p) applies the parser p one or more times, skipping
its result.
The parser unexpected(msg) always fails with an Unexpect error
message msg without consuming any input.
Always fails (with an Unknown error) without consuming any input