ghc-modi browse.

This commit is contained in:
Kazu Yamamoto 2014-04-21 17:33:53 +09:00
parent 4764ff1acb
commit 334283a4cf

View File

@ -8,8 +8,9 @@
-- type <file> <line> <column> -- type <file> <line> <column>
-- lint [hlint options] <file> -- lint [hlint options] <file>
-- the format of hlint options is [String] because they may contain -- the format of hlint options is [String] because they may contain
-- spaces and aslo <file> may contain spaces. -- spaces and also <file> may contain spaces.
-- boot -- boot
-- browse <module>
-- --
-- Session separators: -- Session separators:
-- OK -- success -- OK -- success
@ -156,17 +157,15 @@ loop opt set mvar readLog = do
let (cmd,arg') = break (== ' ') cmdArg let (cmd,arg') = break (== ' ') cmdArg
arg = dropWhile (== ' ') arg' arg = dropWhile (== ' ') arg'
(ret,ok,set') <- case cmd of (ret,ok,set') <- case cmd of
"check" -> checkStx opt set arg readLog "check" -> checkStx opt set arg readLog
"find" -> findSym opt set arg mvar "find" -> findSym opt set arg mvar
"lint" -> lintStx opt set arg "lint" -> lintStx opt set arg
"info" -> showInfo opt set arg readLog "info" -> showInfo opt set arg readLog
"type" -> showType opt set arg readLog "type" -> showType opt set arg readLog
"boot" -> bootIt opt set "boot" -> bootIt opt set
_ -> return ([], False, set) "browse" -> browseIt opt set arg
let put = case outputStyle opt of _ -> return ([], False, set)
LispStyle -> putStr liftIO $ putStr ret
PlainStyle -> putStrLn
liftIO $ put ret
liftIO $ putStrLn $ if ok then "OK" else "NG" liftIO $ putStrLn $ if ok then "OK" else "NG"
liftIO $ hFlush stdout liftIO $ hFlush stdout
when ok $ loop opt set' mvar readLog when ok $ loop opt set' mvar readLog
@ -282,3 +281,11 @@ bootIt :: Options
bootIt opt set = do bootIt opt set = do
ret <- boot' opt ret <- boot' opt
return (ret, True, set) return (ret, True, set)
browseIt :: Options
-> Set FilePath
-> ModuleString
-> Ghc (String, Bool, Set FilePath)
browseIt opt set mdl = do
ret <- browse opt mdl
return (ret, True, set)