mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
started a script and format for updating a set of gf files
This commit is contained in:
23
examples/phrasebook/Update.hs
Normal file
23
examples/phrasebook/Update.hs
Normal file
@@ -0,0 +1,23 @@
|
||||
import System
|
||||
|
||||
main = do
|
||||
file:_ <- getArgs
|
||||
updates <- readFile file >= return . readUpdates
|
||||
mapM_ (doUpdate file) updates
|
||||
return ()
|
||||
|
||||
type Update = (FilePath, [String])
|
||||
|
||||
readUpdates :: String -> [Update]
|
||||
readUpdates s = []
|
||||
|
||||
doUpdate :: FilePath -> Update -> IO ()
|
||||
doUpdate src (target,ls) = do
|
||||
s <- readFile target
|
||||
let beg = dropLastBracket s
|
||||
let tmp = tmpFile target
|
||||
writeFile tmp beg
|
||||
appendFile tmp $ unlines [(line ++ "-- UPDATE FROM " ++ src) | line <- ls]
|
||||
appendFile tmp "\n}\n"
|
||||
|
||||
dropLastBracket s = s
|
||||
12
examples/phrasebook/add_greetings.gfupdate
Normal file
12
examples/phrasebook/add_greetings.gfupdate
Normal file
@@ -0,0 +1,12 @@
|
||||
abstract Greetings
|
||||
|
||||
fun GCongratulations : Greeting ;
|
||||
|
||||
lin
|
||||
Eng = ss "congratulations" ;
|
||||
Fin = ss "onneksi olkoon" ;
|
||||
Fre = ss "félicitations" ;
|
||||
Ita = ss "auguri" ;
|
||||
Swe = ss "grattis" ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user