22 lines
632 B
Haskell
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))
|
|
|
|
|