packages feed

ehaskell 0.1 → 0.2

raw patch · 2 files changed

+32/−8 lines, 2 filesdep ~yjtools

Dependency ranges changed: yjtools

Files

Main.hs view
@@ -1,10 +1,10 @@ module Main where  import System.Environment     (getArgs)-import System.Directory       (doesDirectoryExist, createDirectory)+import System.Directory       (doesDirectoryExist, createDirectory, copyFile, doesFileExist) import System.Directory.Tools (doesNotExistOrOldThan) import System.Process         (runProcess, waitForProcess)-import Control.Monad.Tools    (whenM, unlessM)+import Control.Monad.Tools    (whenM, unlessM, skipRet) import Control.Applicative    ((<$>)) import Text.RegexPR           (gsubRegexPR) import Text.ParserCombinators.MTLParse@@ -28,6 +28,7 @@       srcFile = ehaskellDir ++ exeName ++ haskellSffx   cont       <- readFile infile   unlessM (doesDirectoryExist ehaskellDir) $ createDirectory ehaskellDir+  copyRequiredFile cont   whenM   (doesNotExistOrOldThan srcFile infile)  $     writeFile srcFile $ fst $ head $ runParse parseAll ("", cont)   whenM (doesNotExistOrOldThan exeFile srcFile) $@@ -36,6 +37,28 @@     >>= waitForProcess   return () +copyRequiredFile :: String -> IO ()+copyRequiredFile src = evalParseT copyRequiredFileParse ("",src) >> return ()++copyRequiredFileParse :: ParseT Char IO ()+copyRequiredFileParse = list crfp >> return ()+  where+  crfp = do+    list $ do+      still $ parseNot () $ tokens "<%%"+      spot $ const True+    tokens "<%%"+    list $ spot isSpace+    tokens "import"+    list $ spot isSpace+    mn <- neList (spot $ not . isSpace) >>= skipRet (still $ spot $ isSpace)+    let sfn = mn ++ ".hs"+        dfn = ehaskellDir ++ sfn+    lift $ whenM (doesFileExist sfn) $ whenM (doesNotExistOrOldThan dfn sfn) $+      copyFile sfn dfn+    list $ spot isSpace+    tokens "%%>"+ takeOptionO :: [String] -> Maybe String takeOptionO []         = Nothing takeOptionO ("-o":f:_) = Just f@@ -97,7 +120,7 @@   return $ (False, mkOutputText cont)  parseN = do-  tokens "<%" >> still (parseNot () $ spot $ flip elem "-=")+  tokens "<%" >> still (parseNot () $ spot $ flip elem "-=%")   code <- parseInner   still (parseNot () $ tokenBack '-')   tokens "%>"@@ -169,9 +192,9 @@     still (parseNot () $ tokens "%>")     spot (const True) -mkOutputText txt            = "  " ++ putStrStr ++ show txt ++ ";\n"+mkOutputText txt            = "  " ++ putStrStr ++ " $ " ++ show txt ++ ";\n" mkOutputHere code           = "  " ++ code ++ ";\n" mkOutputCode code           = "  " ++ code ++ " >>= " ++ putStrStr ++ ";\n" mkOutputShowCode code       = "  " ++ code ++ " >>= " ++ putStrStr ++ ". show ;\n"-mkOutputReturnCode code     = "  " ++ putStrStr ++ code ++ " ;\n"-mkOutputReturnShowCode code = "  " ++ putStrStr ++ "$ show" ++ code ++ " ;\n"+mkOutputReturnCode code     = "  " ++ putStrStr ++ " $ " ++ code ++ " ;\n"+mkOutputReturnShowCode code = "  " ++ putStrStr ++ " $ show" ++ code ++ " ;\n"
ehaskell.cabal view
@@ -1,9 +1,10 @@ Name:		ehaskell-Version:	0.1+Version:	0.2 Cabal-Version:	>= 1.2 Build-Type:	Simple License:	GPL License-File:	LICENSE+Stability:	experimental Author:		Yoshikuni Jujo <PAF01143@nifty.ne.jp> Maintainer:	PAF01143@nifty.ne.jp Category:	Code Generation@@ -43,5 +44,5 @@  Executable ehs   Main-Is:		Main.hs-  Build-Depends:	base, mtlparse >= 0.0.1, yjtools >= 0.6, directory, regexpr >= 0.3.3, process+  Build-Depends:	base, mtlparse >= 0.0.1, yjtools >= 0.7, directory, regexpr >= 0.3.3, process   GHC-Options:		-Wall