Data.Eulalie.Parser
- Package
- purescript-eulalie
- Repository
- bodil/purescript-eulalie
#parse Source
parse :: forall o i. Parser i o -> Stream i -> ParseResult i o
Run a parse operation on a stream.
#seq Source
seq :: forall b a i. Parser i a -> (a -> Parser i b) -> Parser i b
The seq
combinator takes a parser, and a function which will receive
the result of that parser if it succeeds, and which should return another
parser, which will be run immediately after the initial parser. In this
way, you can join parsers together in a sequence, producing more complex
parsers.
This is equivalent to the monadic bind
operation.
#either Source
either :: forall o i. Parser i o -> Parser i o -> Parser i o
The either
combinator takes two parsers, runs the first on the input
stream, and if that fails, it will backtrack and attempt the second
parser on the same input. Basically, try parser 1, then try parser 2.
If the first parser fails with an error flagged as fatal (see cut
),
the second parser will not be attempted.
This is equivalent to the alt
operation of MonadPlus
/Alt
.
#many Source
many :: forall o i. Parser i o -> Parser i (List o)
The many
combinator takes a parser, and returns a new parser which will
run the parser repeatedly on the input stream until it fails, returning
a list of the result values of each parse operation as its result, or the
empty list if the parser never succeeded.
Read that as "match this parser zero or more times and give me a list of the results."