hana.hs revision 98890889ffb2e8f6f722b00e265a211f13b5a861
2509N/A{- |
0N/AModule : $Id$
0N/ADescription : a test driver for Haskell analysis
0N/ACopyright : (c) Christian Maeder, Uni Bremen 2002-2004
0N/ALicense : GPLv2 or higher, see LICENSE.txt
0N/A
0N/AMaintainer : Christian.Maeder@dfki.de
0N/AStability : experimental
0N/APortability : non-portable
0N/A
0N/Atest the programatica parser and (HatAna) analysis
0N/A-}
0N/A
0N/Amodule Main where
0N/A
0N/Aimport Haskell.HatParser
0N/Aimport Haskell.HatAna
2362N/Aimport PropParser as HP
2362N/A
2362N/Aimport System.Environment
1178N/A
2509N/Aimport Common.Result
0N/Aimport Common.GlobalAnnotations
0N/Aimport Common.DocUtils
1178N/Aimport Common.AS_Annotation
1178N/A
0N/Amain :: IO ()
1178N/Amain = getArgs >>= mapM_ process
1178N/A
1178N/A-- try with files *.hascasl.hs in ToHaskell/test
1178N/Aprocess :: FilePath -> IO ()
1178N/Aprocess fn = do
1178N/A s <- readFile fn
1178N/A let ts = pLexerPass0 True s
1178N/A Result ds m = do
1178N/A HsModule _ _ _ _ b <- parseTokens HP.parse fn ts
1178N/A hatAna(HsDecls b, emptySign, emptyGlobalAnnos)
1178N/A case m of
1178N/A Just (_, sig, hs) -> do
1178N/A putStrLn $ showDoc sig ""
1178N/A mapM_ (putStrLn . flip showDoc "" . sentence) hs
1178N/A _ -> mapM_ (putStrLn . show) ds
1178N/A