1
0
forked from GitHub/gf-core

added API for print names

This commit is contained in:
krangelov
2021-12-03 16:49:36 +01:00
parent 655576c291
commit bbff79aaa3
10 changed files with 86 additions and 8 deletions

View File

@@ -90,10 +90,18 @@ grammar2PGF opts gr am probs = do
createLincat (i2i c) (type2fields gr ty)
createCncCats _ = return ()
createCncFuns ((m,f),CncFun _ _ _ (Just prods)) = do
createCncFuns ((m,f),CncFun _ _ mprn (Just prods)) = do
createLin (i2i f) prods
case mprn of
Nothing -> return ()
Just (L _ prn) -> setPrintName (i2i f) (unwords (term2tokens prn))
createCncFuns _ = return ()
term2tokens (K tok) = [tok]
term2tokens (C t1 t2) = term2tokens t1 ++ term2tokens t2
term2tokens (Typed t _) = term2tokens t
term2tokens _ = []
i2i :: Ident -> String
i2i = showIdent