ghc-modi browse.

This commit is contained in:
Kazu Yamamoto 2014-04-21 17:33:53 +09:00
parent 4764ff1acb
commit 334283a4cf
1 changed files with 19 additions and 12 deletions

View File

@ -8,8 +8,9 @@
-- type <file> <line> <column>
-- lint [hlint options] <file>
-- 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
-- browse <module>
--
-- Session separators:
-- OK -- success
@ -156,17 +157,15 @@ loop opt set mvar readLog = do
let (cmd,arg') = break (== ' ') cmdArg
arg = dropWhile (== ' ') arg'
(ret,ok,set') <- case cmd of
"check" -> checkStx opt set arg readLog
"find" -> findSym opt set arg mvar
"lint" -> lintStx opt set arg
"info" -> showInfo opt set arg readLog
"type" -> showType opt set arg readLog
"boot" -> bootIt opt set
_ -> return ([], False, set)
let put = case outputStyle opt of
LispStyle -> putStr
PlainStyle -> putStrLn
liftIO $ put ret
"check" -> checkStx opt set arg readLog
"find" -> findSym opt set arg mvar
"lint" -> lintStx opt set arg
"info" -> showInfo opt set arg readLog
"type" -> showType opt set arg readLog
"boot" -> bootIt opt set
"browse" -> browseIt opt set arg
_ -> return ([], False, set)
liftIO $ putStr ret
liftIO $ putStrLn $ if ok then "OK" else "NG"
liftIO $ hFlush stdout
when ok $ loop opt set' mvar readLog
@ -282,3 +281,11 @@ bootIt :: Options
bootIt opt set = do
ret <- boot' opt
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)