haskell-src-1.0.1.3: Manipulating Haskell source codeSource 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 Source
Monad for parsing
show/hide Instances
data ParseResult a Source
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 aSource
data LexContext Source
Constructors
NoLayout
Layout Int
show/hide Instances
data ParseMode Source
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 :: ParseModeSource
Default parameters for a parse, currently just a marker for an unknown filename.
runParserWithMode :: ParseMode -> P a -> String -> ParseResult aSource
runParser :: P a -> String -> ParseResult aSource
getSrcLoc :: P SrcLocSource
pushCurrentContext :: P ()Source
popContext :: P ()Source
Lexing
data Lex r a Source
show/hide Instances
getInput :: Lex r StringSource
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.
lexTab :: Lex a ()Source
Discard the next character, which must be a tab.
lexWhile :: (Char -> Bool) -> Lex a StringSource
alternative :: Lex a v -> Lex a (Lex a v)Source
checkBOL :: Lex a BoolSource
setBOL :: Lex a ()Source
startToken :: Lex a ()Source
getOffside :: Lex a OrderingSource
pushContextL :: LexContext -> Lex a ()Source
popContextL :: String -> Lex a ()Source
Produced by Haddock version 2.4.2