Display the date of the registry
This commit is contained in:
parent
47552053fd
commit
3b40762ed2
@ -31,6 +31,8 @@ getRegistry input =
|
||||
else
|
||||
registryOf reg
|
||||
|
||||
dateOf (Date d) = d
|
||||
|
||||
isValidLanguage l dict =
|
||||
if length (filter (onlyThisValue "language" l) dict) == 1 then
|
||||
(True, "")
|
||||
|
@ -71,15 +71,16 @@ main = do
|
||||
input <- System.IO.readFile registryfilename
|
||||
let syntaxTree = parse input
|
||||
if (checkOK syntaxTree) then do
|
||||
let theDate = dateOf (head (registryOf syntaxTree))
|
||||
let result = semanticCheck (registryOf syntaxTree)
|
||||
if (checkOK result) then do
|
||||
if verbose opts then
|
||||
putStrLn (registryfilename ++ " is OK") -- TODO: display the date
|
||||
putStrLn (registryfilename ++ " of " ++ theDate ++ " is OK")
|
||||
else
|
||||
nothing
|
||||
Exit.exitWith Exit.ExitSuccess
|
||||
else do
|
||||
putStrLn ("Semantic error in " ++ registryfilename ++ ": " ++
|
||||
putStrLn ("Semantic error in " ++ registryfilename ++ " of " ++ theDate ++ ": " ++
|
||||
(messageOf result))
|
||||
Exit.exitWith (Exit.ExitFailure 3)
|
||||
else do
|
||||
|
@ -4,14 +4,15 @@ import Registry.Registry
|
||||
|
||||
infile = "./language-subtag-registry"
|
||||
|
||||
analyze reg input
|
||||
= case (getTag input) of
|
||||
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\n") -- TODO: indicate the date of the registry
|
||||
(input ++ " is valid against registry " ++ theDate ++ "\n")
|
||||
else
|
||||
(input ++ " is NOT valid: " ++ snd result ++ "\n")
|
||||
(input ++ " is NOT valid against registry " ++ theDate ++ ": " ++ snd result ++ "\n")
|
||||
|
||||
main = do
|
||||
myargs <- getArgs
|
||||
|
Loading…
Reference in New Issue
Block a user