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