Copyright | (c) The GHC Team 1997-2000 |
---|---|
License | BSD-3-Clause |
Maintainer | Andreas Abel |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
Monads for the Haskell parser and lexer.
Synopsis
- data P a
- data ParseResult a
- = ParseOk a
- | ParseFailed SrcLoc String
- atSrcLoc :: P a -> SrcLoc -> P a
- data LexContext
- data ParseMode = ParseMode {
- parseFilename :: String
- defaultParseMode :: ParseMode
- runParserWithMode :: ParseMode -> P a -> String -> ParseResult a
- runParser :: P a -> String -> ParseResult a
- getSrcLoc :: P SrcLoc
- pushCurrentContext :: P ()
- popContext :: P ()
- 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 ()
Parsing
Monad for parsing
data ParseResult a Source #
The result of a parse.
ParseOk a | The parse succeeded, yielding a value. |
ParseFailed SrcLoc String | The parse failed at the specified source location, with an error message. |
Instances
data LexContext Source #
Instances
Show LexContext Source # | |
Defined in Language.Haskell.ParseMonad showsPrec :: Int -> LexContext -> ShowS show :: LexContext -> String showList :: [LexContext] -> ShowS | |
Eq LexContext Source # | |
Defined in Language.Haskell.ParseMonad (==) :: LexContext -> LexContext -> Bool (/=) :: LexContext -> LexContext -> Bool | |
Ord LexContext Source # | |
Defined in Language.Haskell.ParseMonad compare :: LexContext -> LexContext -> Ordering (<) :: LexContext -> LexContext -> Bool (<=) :: LexContext -> LexContext -> Bool (>) :: LexContext -> LexContext -> Bool (>=) :: LexContext -> LexContext -> Bool max :: LexContext -> LexContext -> LexContext min :: LexContext -> LexContext -> LexContext |
Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.
ParseMode | |
|
defaultParseMode :: ParseMode Source #
Default parameters for a parse, currently just a marker for an unknown filename.
runParserWithMode :: ParseMode -> P a -> String -> ParseResult a Source #
runParser :: P a -> String -> ParseResult a Source #
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.
startToken :: Lex a () Source #
getOffside :: Lex a Ordering Source #
pushContextL :: LexContext -> Lex a () Source #
popContextL :: String -> Lex a () Source #