23 lines
702 B
Haskell
23 lines
702 B
Haskell
import Grammar
|
|
import System.Environment (getArgs)
|
|
import Registry.Registry
|
|
|
|
infile = "./language-subtag-registry"
|
|
|
|
analyze reg input = do
|
|
let theDate = dateOf (head reg)
|
|
case (getTag input) of
|
|
Left err -> err
|
|
Right tag -> let result = isValid reg tag in
|
|
if fst result then
|
|
(input ++ " is valid against registry " ++ theDate ++ "\n")
|
|
else
|
|
(input ++ " is NOT valid against registry " ++ theDate ++ ": " ++ snd result ++ "\n")
|
|
|
|
main = do
|
|
myargs <- getArgs
|
|
theregistry <- readRegistry infile
|
|
putStr (concat (map (analyze theregistry) myargs))
|
|
|
|
|