trifecta-0.37: A modern parser combinator library with convenient diagnostics







class (Alternative m, MonadPlus m) => MonadParser m whereSource


try :: m a -> m aSource

Take a parser that may consume input, and on failure, go back to where we started and fail as if we didn't consume input.

labels :: m a -> Set String -> m aSource

skipMany :: m a -> m ()Source

A version of many that discards its input. Specialized because it can often be implemented more cheaply.

satisfy :: (Char -> Bool) -> m CharSource

Parse a single character of the input, with UTF-8 decoding

satisfy8 :: (Word8 -> Bool) -> m Word8Source

Parse a single byte of the input, without UTF-8 decoding

highlight :: Highlight -> m a -> m aSource

highlight is called internally in the token parsers. It delimits ranges of the input recognized by certain parsers that are useful for syntax highlighting. An interested monad could choose to listen to these events and construct an interval tree for later pretty printing purposes.

liftIt :: It Rope a -> m aSource

Lift an operation from the primitive It monad

mark :: m DeltaSource

mark the current location so it can be used in constructing a span, or for later seeking

unexpected :: MonadParser m => String -> m aSource

Used to emit an error on an unexpected token

line :: m ByteStringSource

Retrieve the contents of the current line (from the beginning of the line)

release :: Delta -> m ()Source

Seek back to previously marked location

restOfLine :: MonadParser m => m ByteStringSource

grab the remainder of the current line

(<?>) :: MonadParser m => m a -> String -> m aSource

label a parser with a name

slicedWith :: MonadParser m => (a -> ByteString -> r) -> m a -> m rSource

run a parser, grabbing all of the text between its start and end points

sliced :: MonadParser m => m a -> m ByteStringSource

run a parser, grabbing all of the text between its start and end points and discarding the original result