Structure of the new lexer
The implementation consists of the following key ingredients:
program :: RegExp HaskellChar Token
lexerGen :: RegExp HaskellChar Token -> HaskellSourceCode
haskellLex :: String -> [(Token,String)]
nestedComment :: ...
addPos :: [(Token,String)] -> [(Token,(Pos,String))]
rmSpace :: [(Token,(Pos,String))] -> [(Token,(Pos,String))]
layoutPre :: [(Token,(Pos,String))] -> [(Token,(Pos,String))]
token :: PM (Token,(Pos,String))
popContext:: PM ()
parseFile :: PM a -> FilePath -> String -> Either Error a
See modules
HsLexerPass1,
HsLexer,
HsLexUtils.