1
0
forked from GitHub/gf-core

Add more helpful printouts if no grammar provided

This commit is contained in:
Inari Listenmaa
2018-04-06 16:55:41 +02:00
parent b9d0012f6b
commit fcdcb23b35

View File

@@ -87,9 +87,11 @@ main = do
args <- cmdArgs gftest
let (absName,grName) = case grammar args of
Just fp -> (takeFileName $ stripPGF fp, stripPGF fp ++ ".pgf") --doesn't matter if the name is given with or without ".pgf"
Nothing -> ("TestLang","TestLang.pgf") -- feel free to add your own default paths here
case grammar args of
Nothing -> putStrLn "Usage: `gftest -g <PGF grammar> [OPTIONS]'\nTo see available commands, run `gftest --help' or visit https://github.com/GrammaticalFramework/GF/blob/master/src/tools/gftest/README.md"
Just fp -> do
let (absName,grName) = (takeFileName $ stripPGF fp, stripPGF fp ++ ".pgf") --doesn't matter if the name is given with or without ".pgf"
(langName:langTrans) = case lang args of
[] -> [ absName ++ "Eng" ] -- if no English grammar found, it will be given a default value later
langs -> [ absName ++ t | t <- words langs ]
@@ -354,7 +356,6 @@ main = do
| (cat,_,_,_) <- difcats
, let funs = functionsByCat grammar cat ]
sortByName = sortBy (\s t -> name s `compare` name t)
writeFunFile groupedFuns file grammar = do
writeFile file ""