mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-10 11:42:51 -06:00
new option pg -funs
This commit is contained in:
@@ -510,8 +510,12 @@ allCommands env@(pgf, mos) = Map.fromList [
|
|||||||
options = [
|
options = [
|
||||||
("cats", "show just the names of abstract syntax categories"),
|
("cats", "show just the names of abstract syntax categories"),
|
||||||
("fullform", "print the fullform lexicon"),
|
("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"),
|
("missing","show just the names of functions that have no linearization"),
|
||||||
("words", "print the list of words")
|
("words", "print the list of words")
|
||||||
|
],
|
||||||
|
examples = [
|
||||||
|
("pg -funs | ? grep \" S ;\" -- show functions with value cat S")
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
("ph", emptyCommandInfo {
|
("ph", emptyCommandInfo {
|
||||||
@@ -998,6 +1002,7 @@ allCommands env@(pgf, mos) = Map.fromList [
|
|||||||
|
|
||||||
prGrammar opts
|
prGrammar opts
|
||||||
| isOpt "cats" opts = return $ fromString $ unwords $ map showCId $ categories pgf
|
| 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 "fullform" opts = return $ fromString $ concatMap (morpho "" prFullFormLexicon) $ optLangs opts
|
||||||
| isOpt "missing" opts = return $ fromString $ unlines $ [unwords (showCId la:":": map showCId cs) |
|
| isOpt "missing" opts = return $ fromString $ unlines $ [unwords (showCId la:":": map showCId cs) |
|
||||||
la <- optLangs opts, let cs = missingLins pgf la]
|
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)
|
| otherwise = do fmt <- readOutputFormat (valStrOpts "printer" "pgf_pretty" opts)
|
||||||
return $ fromString $ concatMap snd $ exportPGF noOptions fmt pgf
|
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 =
|
morphos opts s =
|
||||||
[(s,morpho [] (\mo -> lookupMorpho mo s) la) | la <- optLangs opts]
|
[(s,morpho [] (\mo -> lookupMorpho mo s) la) | la <- optLangs opts]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user