Portability | ghc |
---|---|
Stability | experimental |
Maintainer | bjpop@csse.unimelb.edu.au |
Safe Haskell | Safe-Inferred |
Monad support for Python parser and lexer.
Documentation
type P a = StateT ParseState (Either ParseError) aSource
execParser :: P a -> ParseState -> Either ParseError aSource
execParserKeepComments :: P a -> ParseState -> Either ParseError (a, [Token])Source
runParser :: P a -> ParseState -> Either ParseError (a, ParseState)Source
setLocation :: SrcLocation -> P ()Source
setLastToken :: Token -> P ()Source
setLastEOL :: SrcSpan -> P ()Source
data ParseError Source
UnexpectedToken Token | An error from the parser. Token found where it should not be. Note: tokens contain their own source span. |
UnexpectedChar Char SrcLocation | An error from the lexer. Character found where it should not be. |
StrError String | A generic error containing a string message. No source location. |
data ParseState Source
ParseState | |
|
initialState :: SrcLocation -> String -> [Int] -> ParseStateSource
pushStartCode :: Int -> P ()Source
popStartCode :: P ()Source
pushIndent :: Int -> P ()Source
addComment :: Token -> P ()Source
getComments :: P [Token]Source