1.1 --- a/tools/Parsing/Parsing.hs Wed Dec 10 10:16:47 2008 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,39 +0,0 @@
1.4 -module Parsing
1.5 -where
1.6 -
1.7 -import Control.Monad
1.8 -import Data.List
1.9 -import System.Directory (getDirectoryContents)
1.10 -import Language.Haskell.Exts (ParseResult(..), parseFile, HsModule(..))
1.11 -import Text.PrettyPrint
1.12 -import Importer.Utilities.Misc
1.13 -
1.14 -traverseDir :: FilePath -> (FilePath -> IO ()) -> IO ()
1.15 -traverseDir dirpath op = do
1.16 - fps <- getDirectoryContents dirpath `catch` const (return [])
1.17 - let fps' = (map (\ d -> dirpath ++ "/" ++ d)) . (filter (`notElem` [".", ".."])) $ fps
1.18 - mapM_ work fps'
1.19 - where work f = do
1.20 - op f
1.21 - traverseDir f op
1.22 -
1.23 -parseTest =let d = "/home/paba/studies/NICTA/hsimp/workspace/nicta/ex/src_hs/AsPatterns.hs" in do
1.24 - res <- parseFile d
1.25 - case res of
1.26 - ParseOk res -> putStrLn ("OK:\n" ++ (prettyShow res))
1.27 - ParseFailed loc msg -> do
1.28 - putStrLn ("Failed: " ++ d)
1.29 - putStrLn (" Message: " ++ msg)
1.30 - putStrLn (" Location: " ++ (show loc))
1.31 -
1.32 -
1.33 -parse = traverseDir "/home/paba/studies/NICTA/hsimp/ref/refine/haskell/src"
1.34 - (\ d -> when (".hspp" `isSuffixOf` d) $ do
1.35 - res <- parseFile d
1.36 - case res of
1.37 - ParseOk _ -> putStrLn ("OK: " ++ d)
1.38 - ParseFailed loc msg -> do
1.39 - putStrLn ("Failed: " ++ d)
1.40 - putStrLn (" Message: " ++ msg)
1.41 - putStrLn (" Location: " ++ (show loc))
1.42 - )
1.43 \ No newline at end of file
2.1 --- a/tools/unlit/unlit.py Wed Dec 10 10:16:47 2008 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,24 +0,0 @@
2.4 -
2.5 -# This script invokes "ghc -cpp -E" on all literate Haskell files causing
2.6 -# the translation into ordinary Haskell source files, where all pragmas
2.7 -# are resolved. The resulting ".hspp" files are renamed to ".hs" files.
2.8 -#
2.9 -# "ghc -cpp -E" basically runs the literate pre-processor and afterwards
2.10 -# the C pre-processo
2.11 -
2.12 -import os
2.13 -
2.14 -srcdir = "/home/paba/studies/NICTA/hsimp/ref/refine/haskell/src/"
2.15 -
2.16 -for (dir, dirs, files) in os.walk(srcdir) :
2.17 - for file in files :
2.18 - if file.endswith(".lhs") or file.endswith(".lhs-boot"):
2.19 - fp = os.path.join(dir,file)
2.20 - print os.system("ghc -cpp -E " + fp)
2.21 -
2.22 -for (dir, dirs, files) in os.walk(srcdir) :
2.23 - for file in files :
2.24 - if file.endswith(".hspp"):
2.25 - fp = os.path.join(dir,file)
2.26 - fp2 = os.path.join(dir,file[0:-2])
2.27 - os.rename(fp, fp2)