module GHC.Driver.Config.Parser
( initParserOpts
)
where
import GHC.Prelude
import GHC.Platform
import GHC.Driver.Session
import GHC.Driver.Config.Diagnostic
import GHC.Parser.Lexer
initParserOpts :: DynFlags -> ParserOpts
initParserOpts :: DynFlags -> ParserOpts
initParserOpts =
EnumSet Extension
-> DiagOpts
-> [String]
-> Bool
-> Bool
-> Bool
-> Bool
-> ParserOpts
mkParserOpts
(EnumSet Extension
-> DiagOpts
-> [String]
-> Bool
-> Bool
-> Bool
-> Bool
-> ParserOpts)
-> (DynFlags -> EnumSet Extension)
-> DynFlags
-> DiagOpts
-> [String]
-> Bool
-> Bool
-> Bool
-> Bool
-> ParserOpts
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> DynFlags -> EnumSet Extension
extensionFlags
(DynFlags
-> DiagOpts
-> [String]
-> Bool
-> Bool
-> Bool
-> Bool
-> ParserOpts)
-> (DynFlags -> DiagOpts)
-> DynFlags
-> [String]
-> Bool
-> Bool
-> Bool
-> Bool
-> ParserOpts
forall a b.
(DynFlags -> a -> b) -> (DynFlags -> a) -> DynFlags -> b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> DynFlags -> DiagOpts
initDiagOpts
(DynFlags
-> [String] -> Bool -> Bool -> Bool -> Bool -> ParserOpts)
-> (DynFlags -> [String])
-> DynFlags
-> Bool
-> Bool
-> Bool
-> Bool
-> ParserOpts
forall a b.
(DynFlags -> a -> b) -> (DynFlags -> a) -> DynFlags -> b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ArchOS -> [String]
supportedLanguagesAndExtensions (ArchOS -> [String])
-> (DynFlags -> ArchOS) -> DynFlags -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Platform -> ArchOS
platformArchOS (Platform -> ArchOS)
-> (DynFlags -> Platform) -> DynFlags -> ArchOS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DynFlags -> Platform
targetPlatform)
(DynFlags -> Bool -> Bool -> Bool -> Bool -> ParserOpts)
-> (DynFlags -> Bool)
-> DynFlags
-> Bool
-> Bool
-> Bool
-> ParserOpts
forall a b.
(DynFlags -> a -> b) -> (DynFlags -> a) -> DynFlags -> b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> DynFlags -> Bool
safeImportsOn
(DynFlags -> Bool -> Bool -> Bool -> ParserOpts)
-> (DynFlags -> Bool) -> DynFlags -> Bool -> Bool -> ParserOpts
forall a b.
(DynFlags -> a -> b) -> (DynFlags -> a) -> DynFlags -> b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_Haddock
(DynFlags -> Bool -> Bool -> ParserOpts)
-> (DynFlags -> Bool) -> DynFlags -> Bool -> ParserOpts
forall a b.
(DynFlags -> a -> b) -> (DynFlags -> a) -> DynFlags -> b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_KeepRawTokenStream
(DynFlags -> Bool -> ParserOpts)
-> (DynFlags -> Bool) -> DynFlags -> ParserOpts
forall a b.
(DynFlags -> a -> b) -> (DynFlags -> a) -> DynFlags -> b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Bool -> DynFlags -> Bool
forall a b. a -> b -> a
const Bool
True