ghc-8.10.0.20191210: The GHC API
Safe HaskellNone
LanguageHaskell2010

HeaderInfo

Description

Parsing the top of a Haskell source file to get its module name, imports and options.

(c) Simon Marlow 2005 (c) Lemmih 2006

Synopsis

Documentation

getImports Source #

Arguments

:: 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)

-> IO (Either ErrorMessages ([(Maybe FastString, Located ModuleName)], [(Maybe FastString, Located ModuleName)], Located ModuleName))

The source imports, normal imports, and the module name.

Parse the imports of a source file.

Throws a SourceError if parsing fails.

getOptionsFromFile Source #

Arguments

:: DynFlags 
-> FilePath

Input file

-> IO [Located String]

Parsed options, if any.

Parse OPTIONS and LANGUAGE pragmas of the source file.

Throws a SourceError if flag parsing fails (including unsupported flags.)

getOptions Source #

Arguments

:: 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 => DynFlags -> [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.