mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-28 09:28:54 -06:00
Add verbosity option in doc/MkExxTable.hs
Don't need a lot of output on stdout when it is used from MkSynposis.hs
This commit is contained in:
@@ -2,28 +2,31 @@ module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where
|
|||||||
|
|
||||||
--import System.Cmd
|
--import System.Cmd
|
||||||
import System.Environment(getArgs)
|
import System.Environment(getArgs)
|
||||||
|
import Control.Monad(when)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
xx <- getArgs
|
xx <- getArgs
|
||||||
aexx <- getApiExx xx
|
aexx <- getApiExx' True xx
|
||||||
return () -- putStrLn $ prApiExx aexx
|
return () -- putStrLn $ prApiExx aexx
|
||||||
|
|
||||||
getApiExx :: [FilePath] -> IO ApiExx
|
getApiExx :: [FilePath] -> IO ApiExx
|
||||||
getApiExx xx = do
|
getApiExx = getApiExx' False
|
||||||
|
|
||||||
|
getApiExx' verbose xx = do
|
||||||
s <- readFile (head xx)
|
s <- readFile (head xx)
|
||||||
let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s
|
let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s
|
||||||
aeos <- mapM readApiExxOne xx
|
aeos <- mapM (readApiExxOne verbose) xx
|
||||||
let aexx = mkApiExx $ ("API",aet) : aeos
|
let aexx = mkApiExx $ ("API",aet) : aeos
|
||||||
-- putStrLn $ prApiExx aexx
|
-- putStrLn $ prApiExx aexx
|
||||||
return aexx
|
return aexx
|
||||||
|
|
||||||
readApiExxOne file = do
|
readApiExxOne verbose file = do
|
||||||
s <- readFile file
|
s <- readFile file
|
||||||
let lang = reverse (take 3 (drop 4 (reverse file))) -- api-exx-*Eng*.txt
|
let lang = reverse (take 3 (drop 4 (reverse file))) -- api-exx-*Eng*.txt
|
||||||
let api = getApiExxOne $ filter validOutput $ mergeOutput $ lines s
|
let api = getApiExxOne $ filter validOutput $ mergeOutput $ lines s
|
||||||
putStrLn $ unlines $ prApiEx api ---
|
when verbose $ putStrLn $ unlines $ prApiEx api ---
|
||||||
return (lang,api)
|
return (lang,api)
|
||||||
|
|
||||||
-- map function -> language -> example
|
-- map function -> language -> example
|
||||||
|
|||||||
Reference in New Issue
Block a user