Parsing the top of a Haskell source file to get its module name, imports and options.
(c) Simon Marlow 2005 (c) Lemmih 2006
- getImports :: GhcMonad m => DynFlags -> StringBuffer -> FilePath -> FilePath -> m ([Located (ImportDecl RdrName)], [Located (ImportDecl RdrName)], Located ModuleName)
- mkPrelImports :: ModuleName -> Bool -> [LImportDecl RdrName] -> [LImportDecl RdrName]
- getOptionsFromFile :: DynFlags -> FilePath -> IO [Located String]
- getOptions :: DynFlags -> StringBuffer -> FilePath -> [Located String]
- optionsErrorMsgs :: [String] -> [Located String] -> FilePath -> Messages
- checkProcessArgsResult :: MonadIO m => [Located String] -> m ()
Documentation
:: GhcMonad m | |
=> DynFlags | |
-> StringBuffer | Parse this. |
-> FilePath | Filename the buffer came from. Used for reporting parse error locations. |
-> FilePath | The original source filename (used for locations in the function result) |
-> m ([Located (ImportDecl RdrName)], [Located (ImportDecl RdrName)], Located ModuleName) | The source imports, normal imports, and the module name. |
Parse the imports of a source file.
Throws a SourceError
if parsing fails.
mkPrelImports :: ModuleName -> Bool -> [LImportDecl RdrName] -> [LImportDecl RdrName]Source
Parse OPTIONS and LANGUAGE pragmas of the source file.
Throws a SourceError
if flag parsing fails (including unsupported flags.)
:: DynFlags | |
-> StringBuffer | Input Buffer |
-> FilePath | Source filename. Used for location info. |
-> [Located String] | Parsed options. |
Parse OPTIONS and LANGUAGE pragmas of the source file.
Throws a SourceError
if flag parsing fails (including unsupported flags.)
checkProcessArgsResult :: MonadIO m => [Located String] -> m ()Source
Complain about non-dynamic flags in OPTIONS pragmas.
Throws a SourceError
if the input list is non-empty claiming that the
input flags are unknown.