1
0
forked from GitHub/gf-rgl
Files
gf-rgl/doc/synopsis/MkExx.hs
John J. Camilleri 74384044c9 Move everything related to synopsis into subfolder
Clean up some unused and generated files
2018-11-12 10:05:42 +01:00

33 lines
738 B
Haskell

-- make a script for computing examples
-- usage: runghc MkExx.hs <koe.txt >koe.gfs
-- then: gf -retain -s ../alltenses/TryRon.gfo <koe.gfs
-- called automatically by 'make exx'
main = interact (unlines . concatMap mkScript . takeWhile (/="--.") . lines)
mkScript l = case l of
' ':_ ->
let ident = mkIdent $ unwords $ takeWhile (/="--") $ words l
in [add $ psq ident]
'-':_ -> []
_ -> [
add $ psq l,
add $ "cc -one " ++ l,
add $ psq "*"
]
add = ('\n':)
psq s = "ps \"" ++ s ++ "\""
-- makes mkUtt : QS -> Utt to mkUtt-QS-Utt
mkIdent :: String -> String
mkIdent = concatMap unspec where
unspec c = case c of
' ' -> ""
'>' -> ""
'(' -> ""
')' -> ""
':' -> "-"
_ -> [c]