summaryrefslogtreecommitdiff
path: root/src/compiler/GF
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-04-28 19:09:59 +0000
committeraarne <aarne@chalmers.se>2010-04-28 19:09:59 +0000
commit3148bc3d90abde36a3a4702829e18f640d521d5d (patch)
tree7e9f439ce61461cd75e5b64ad512b9ddea3228c4 /src/compiler/GF
parent68de1cead3a64d42e21b8668415596925b284b18 (diff)
new option pg -funs
Diffstat (limited to 'src/compiler/GF')
-rw-r--r--src/compiler/GF/Command/Commands.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs
index 5aaa62aca..0273b82eb 100644
--- a/src/compiler/GF/Command/Commands.hs
+++ b/src/compiler/GF/Command/Commands.hs
@@ -510,8 +510,12 @@ allCommands env@(pgf, mos) = Map.fromList [
options = [
("cats", "show just the names of abstract syntax categories"),
("fullform", "print the fullform lexicon"),
+ ("funs", "show just the names and types of abstract syntax functions"),
("missing","show just the names of functions that have no linearization"),
("words", "print the list of words")
+ ],
+ examples = [
+ ("pg -funs | ? grep \" S ;\" -- show functions with value cat S")
]
}),
("ph", emptyCommandInfo {
@@ -998,6 +1002,7 @@ allCommands env@(pgf, mos) = Map.fromList [
prGrammar opts
| isOpt "cats" opts = return $ fromString $ unwords $ map showCId $ categories pgf
+ | isOpt "funs" opts = return $ fromString $ unlines $ map showFun $ funsigs pgf
| isOpt "fullform" opts = return $ fromString $ concatMap (morpho "" prFullFormLexicon) $ optLangs opts
| isOpt "missing" opts = return $ fromString $ unlines $ [unwords (showCId la:":": map showCId cs) |
la <- optLangs opts, let cs = missingLins pgf la]
@@ -1005,6 +1010,9 @@ allCommands env@(pgf, mos) = Map.fromList [
| otherwise = do fmt <- readOutputFormat (valStrOpts "printer" "pgf_pretty" opts)
return $ fromString $ concatMap snd $ exportPGF noOptions fmt pgf
+ funsigs pgf = [(f,ty) | (f,(ty,_,_)) <- Map.assocs (funs (abstract pgf))]
+ showFun (f,ty) = showCId f ++ " : " ++ showType [] ty ++ " ;"
+
morphos opts s =
[(s,morpho [] (\mo -> lookupMorpho mo s) la) | la <- optLangs opts]