haskell-src-1.0.1.3: Manipulating Haskell source codeContentsIndex
Language.Haskell.ParseMonad
Portabilityportable
Stabilityexperimental
Maintainerlibraries@haskell.org
Contents
Parsing
Lexing
Description
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
= NoLayout
| Layout Int
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
data P a
Monad for parsing
show/hide Instances
data ParseResult a
The result of a parse.
Constructors
ParseOk aThe parse succeeded, yielding a value.
ParseFailed SrcLoc StringThe parse failed at the specified source location, with an error message.
show/hide Instances
atSrcLoc :: P a -> SrcLoc -> P a
data LexContext
Constructors
NoLayout
Layout Int
show/hide Instances
data ParseMode
Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.
Constructors
ParseMode
parseFilename :: Stringoriginal name of the file being parsed
defaultParseMode :: ParseMode
Default parameters for a parse, currently just a marker for an unknown filename.
runParserWithMode :: ParseMode -> P a -> String -> ParseResult a
runParser :: P a -> String -> ParseResult a
getSrcLoc :: P SrcLoc
pushCurrentContext :: P ()
popContext :: P ()
Lexing
data Lex r a
show/hide Instances
getInput :: Lex r String
discard :: Int -> Lex r ()
Discard some input characters (these must not include tabs or newlines).
lexNewline :: Lex a ()
Discard the next character, which must be a newline.
lexTab :: Lex a ()
Discard the next character, which must be a tab.
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 ()
Produced by Haddock version 2.3.0