GaBuZoMeu/Registry/registry2sqlite.hs
Stephane Bortzmeyer 2fc541c0a7 Initial import
2023-06-08 21:49:35 +02:00

25 lines
654 B
Haskell

import qualified IO
import qualified System
import Registry.Utils
import Registry.Utils.SQLite
import Registry.Grammar (registry)
import Registry.Registry
infile = "./language-subtag-registry"
displayAll reg thistype =
(foldr (++) "" (map toSQLite
(filter (onlyThisType thistype) reg)))
main = do
f <- IO.openFile (infile) IO.ReadMode
input <- IO.hGetContents f
let theregistry = getRegistry input
putStrLn "BEGIN;"
putStrLn (displayAll theregistry "script")
putStrLn (displayAll theregistry "region")
putStrLn (displayAll theregistry "language")
putStrLn (displayAll theregistry "variant")
putStrLn "COMMIT;"