summaryrefslogtreecommitdiff
path: root/Language/Eiffel/Summary.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Language/Eiffel/Summary.hs')
-rw-r--r--Language/Eiffel/Summary.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Language/Eiffel/Summary.hs b/Language/Eiffel/Summary.hs
new file mode 100644
index 0000000..cf3e274
--- /dev/null
+++ b/Language/Eiffel/Summary.hs
@@ -0,0 +1,32 @@
+module Language.Eiffel.Summary where
+
+import qualified Data.ByteString.Char8 as B
+
+import Data.Binary
+
+import Language.Eiffel.Syntax
+import Language.Eiffel.Parser.Class
+import qualified Language.Eiffel.Parser.Lex as L
+import Language.Eiffel.Parser
+import Language.Eiffel.PrettyPrint
+
+import Text.Parsec
+
+import System.IO
+
+summaryP :: L.Parser [ClasInterface]
+summaryP = many clasInterfaceP
+
+parseSummary :: String -> IO (Either ParseError [ClasInterface])
+parseSummary fileName = lexThenParseFromFile summaryP fileName
+
+writeSummary :: FilePath -> [ClasInterface] -> IO ()
+writeSummary filePath ifaces =
+ withFile filePath WriteMode $ \ hdl ->
+ mapM_ (B.hPutStrLn hdl . B.pack . show . toInterfaceDoc) ifaces
+
+readBinarySummary :: String -> IO [ClasInterface]
+readBinarySummary = decodeFile
+
+writeBinarySummary :: String -> [ClasInterface] -> IO ()
+writeBinarySummary = encodeFile