Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | ekmett@gmail.com |
Safe Haskell | Safe-Infered |
- class (Alternative m, MonadPlus m) => MonadParser m where
- try :: m a -> m a
- labels :: m a -> [String] -> m a
- skipMany :: m a -> m ()
- satisfy :: (Char -> Bool) -> m Char
- satisfy8 :: (Word8 -> Bool) -> m Word8
- someSpace :: m ()
- nesting :: m a -> m a
- semi :: m Char
- unexpected :: String -> m a
- line :: m ByteString
- skipping :: Delta -> m ()
- highlightInterval :: Highlight -> Delta -> Delta -> m ()
- position :: m Delta
- slicedWith :: (a -> ByteString -> r) -> m a -> m r
- lookAhead :: m a -> m a
- satisfyAscii :: MonadParser m => (Char -> Bool) -> m Char
- restOfLine :: MonadParser m => m ByteString
- (<?>) :: MonadParser m => m a -> String -> m a
- sliced :: MonadParser m => m a -> m ByteString
- rend :: MonadParser m => m Rendering
- whiteSpace :: MonadParser m => m ()
- highlight :: MonadParser m => Highlight -> m a -> m a
Documentation
class (Alternative m, MonadPlus m) => MonadParser m whereSource
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 -> [String] -> m aSource
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
Usually, someSpace consists of one or more occurrences of a space
.
Some parsers may choose to recognize line comments or block (multi line)
comments as white space as well.
Called when we enter a nested pair of symbols. Overloadable to disable layout or highlight nested contexts.
Lexeme parser |semi| parses the character ';' and skips any trailing white space. Returns the character ';'.
unexpected :: 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)
skipping :: Delta -> m ()Source
highlightInterval :: Highlight -> Delta -> Delta -> m ()Source
highlightInterval
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.
slicedWith :: (a -> ByteString -> r) -> m a -> m rSource
run a parser, grabbing all of the text between its start and end points
lookAhead p
parses p
without consuming any input.
MonadParser m => MonadParser (IdentityT m) | |
MonadParser m => MonadParser (Yoneda m) | |
MonadParser m => MonadParser (Language m) | |
MonadParser m => MonadParser (Literate m) | |
MonadParser m => MonadParser (Layout m) | |
MonadParser m => MonadParser (ReaderT e m) | |
MonadParser m => MonadParser (StateT s m) | |
MonadParser m => MonadParser (StateT s m) | |
(MonadParser m, Monoid w) => MonadParser (WriterT w m) | |
(MonadParser m, Monoid w) => MonadParser (WriterT w m) | |
MonadParser (Parser r e) | |
(MonadParser m, Monoid w) => MonadParser (RWST r w s m) | |
(MonadParser m, Monoid w) => MonadParser (RWST r w s m) |
satisfyAscii :: MonadParser m => (Char -> Bool) -> m CharSource
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
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
rend :: MonadParser m => m RenderingSource
whiteSpace :: MonadParser m => m ()Source
Skip zero or more bytes worth of white space. More complex parsers are free to consider comments as white space.
highlight :: MonadParser m => Highlight -> m a -> m aSource
run a parser, highlighting all of the text between its start and end points.