summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Command
diff options
context:
space:
mode:
authorKrasimir Angelov <kr.angelov@gmail.com>2017-09-01 09:57:00 +0200
committerKrasimir Angelov <kr.angelov@gmail.com>2017-09-01 09:57:00 +0200
commitd5a7945ba0b082a3be8a7cd4b9142e553dbfec9b (patch)
treebb3387c734a154856888f0a7712e11e2a3662aea /src/compiler/GF/Command
parent1a27ddfabbbf7b8ef7449ad0bdd14baf8d76c341 (diff)
complete details for the "ai" command in the C shell
Diffstat (limited to 'src/compiler/GF/Command')
-rw-r--r--src/compiler/GF/Command/Commands2.hs29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/compiler/GF/Command/Commands2.hs b/src/compiler/GF/Command/Commands2.hs
index 8a722824e..bc016838d 100644
--- a/src/compiler/GF/Command/Commands2.hs
+++ b/src/compiler/GF/Command/Commands2.hs
@@ -634,18 +634,17 @@ pgfCommands = Map.fromList [
exec = needPGF $ \opts args env@(pgf,cncs) ->
case map cExpr (toExprs args) of
[e] -> case unApp e of
- Just (id,[]) | id `elem` funs -> return (fromString (showFun pgf id))
- | id `elem` cats -> return (fromString (showCat id))
- where
- funs = functions pgf
- cats = categories pgf
-
- showCat c = "cat "++c -- TODO: show categoryContext
- ++"\n\n"++
- unlines [showFun' f ty|f<-funs,
- let ty=functionType pgf f,
- target ty == c]
- target t = case unType t of (_,c,_) -> c
+ Just (id,[]) -> return (fromString
+ (case functionType pgf id of
+ Just ty -> showFun id ty
+ Nothing -> let funs = functionsByCat pgf id
+ in showCat id funs))
+ where
+ showCat c funs = "cat "++showCategory pgf c++
+ " ;\n\n"++
+ unlines [showFun f ty| f<-funs,
+ Just ty <- [functionType pgf f]]
+ showFun f ty = "fun "++f++" : "++showType [] ty++" ;"
_ -> case inferExpr pgf e of
Left msg -> error msg
Right (e,ty) -> do putStrLn ("Expression: "++PGF2.showExpr [] e)
@@ -758,8 +757,7 @@ pgfCommands = Map.fromList [
prGrammar env@(pgf,cncs) opts
| isOpt "langs" opts = return . fromString . unwords $ (map fst (optConcs env opts))
| isOpt "cats" opts = return . fromString . unwords $ categories pgf
- | isOpt "funs" opts = return . fromString . unlines . map (showFun pgf) $
- functions pgf
+ | isOpt "funs" opts = return . fromString . unwords $ functions pgf
| isOpt "missing" opts = return . fromString . unwords $
[f | f <- functions pgf, not (and [hasLinearization concr f | (_,concr) <- optConcs env opts])]
| isOpt "fullform" opts = return $ fromString $ concatMap (prFullFormLexicon . snd) $ optConcs env opts
@@ -767,9 +765,6 @@ pgfCommands = Map.fromList [
| isOpt "lexc" opts = return $ fromString $ concatMap (prLexcLexicon . snd) $ optConcs env opts
| otherwise = return void
- showFun pgf f = showFun' f (functionType pgf f)
- showFun' f ty = "fun "++f++" : "++showType [] ty
-
gizaAlignment pgf src_cnc tgt_cnc e =
let src_res = alignWords src_cnc e
tgt_res = alignWords tgt_cnc e