Portability | portable |
---|---|
Stability | experimental |
Maintainer | libraries@haskell.org |
Safe Haskell | None |
Monads for the Haskell parser and lexer.
- data P a
- data ParseResult a
- = ParseOk a
- | ParseFailed SrcLoc String
- atSrcLoc :: P a -> SrcLoc -> P a
- data LexContext
- data ParseMode = ParseMode {}
- parseModeOptions :: Opt -> ParseMode
- runParserWithMode :: ParseMode -> P a -> String -> ([Warning], ParseResult a)
- runParser :: P a -> String -> ([Warning], ParseResult a)
- getSrcLoc :: MonadSrcLoc m => m SrcLoc
- setSrcLoc :: SrcLoc -> Lex a ()
- pushCurrentContext :: P ()
- popContext :: P ()
- thenP :: P a -> (a -> P b) -> P b
- returnP :: a -> P a
- data Lex r a
- getInput :: Lex r String
- discard :: Int -> Lex r ()
- lexNewline :: Lex a ()
- lexTab :: Lex a ()
- lexWhile :: (Char -> Bool) -> Lex a String
- alternative :: Lex a v -> Lex a (Lex a v)
- checkBOL :: Lex a Bool
- setBOL :: Lex a ()
- startToken :: Lex a ()
- getOffside :: Lex a Ordering
- pushContextL :: LexContext -> Lex a ()
- popContextL :: String -> Lex a ()
- lexParseMode :: Lex a ParseMode
- pullCtxtFlag :: Lex a Bool
- setFlagDo :: Lex a ()
Parsing
data ParseResult a Source
The result of a parse.
ParseOk a | The parse succeeded, yielding a value and a set of warnings. |
ParseFailed SrcLoc String | The parse failed at the specified source location, with an error message. |
Monad ParseResult | |
Functor ParseResult | |
Applicative ParseResult | |
Show a => Show (ParseResult a) | |
Monoid m => Monoid (ParseResult m) |
Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.
ParseMode | |
|
runParserWithMode :: ParseMode -> P a -> String -> ([Warning], ParseResult a)Source
getSrcLoc :: MonadSrcLoc m => m SrcLocSource
pushCurrentContext :: P ()Source
popContext :: P ()Source
Lexing
discard :: Int -> Lex r ()Source
Discard some input characters (these must not include tabs or newlines).
lexNewline :: Lex a ()Source
Discard the next character, which must be a newline.
alternative :: Lex a v -> Lex a (Lex a v)Source
startToken :: Lex a ()Source
getOffside :: Lex a OrderingSource
pushContextL :: LexContext -> Lex a ()Source
popContextL :: String -> Lex a ()Source
pullCtxtFlag :: Lex a BoolSource