blob: 06cdcd62e452207f95ce0fc0808b7ea2fe71b78d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
module Main where
import GHC.Driver.Session
import GHC.Driver.Config.Parser
import GHC
import Control.Monad.IO.Class (liftIO)
import System.Environment
import GHC.Parser.Header
import GHC.Utils.Outputable
import GHC.Data.StringBuffer
main :: IO ()
main = do
[libdir] <- getArgs
runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
let dflags' = dflags `gopt_set` Opt_KeepRawTokenStream
`gopt_set` Opt_Haddock
filename = "T10942_A.hs"
parser_opts = initParserOpts dflags'
setSessionDynFlags dflags'
stringBuffer <- liftIO $ hGetStringBuffer filename
liftIO $ print (map unLoc (getOptions parser_opts stringBuffer filename))
|