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

22 lines
632 B
Haskell

import Grammar
import System.Environment (getArgs)
import Registry.Registry
infile = "./language-subtag-registry"
analyze reg input
= case (getTag input) of
Left err -> err
Right tag -> let result = isValid reg tag in
if fst result then
(input ++ " is valid\n") -- TODO: indicate the date of the registry
else
(input ++ " is NOT valid: " ++ snd result ++ "\n")
main = do
myargs <- getArgs
theregistry <- readRegistry infile
putStr (concat (map (analyze theregistry) myargs))