summaryrefslogtreecommitdiffstats
path: root/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Parser.hs')
-rw-r--r--Parser.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Parser.hs b/Parser.hs
new file mode 100644
index 0000000..be42375
--- /dev/null
+++ b/Parser.hs
@@ -0,0 +1,26 @@
+module Parser
+ ( module Export
+ , decimal
+ , ueventFile
+ ) where
+
+import qualified Text.Megaparsec.Lexer as Lexer
+import Text.Megaparsec as Export (parse, parseMaybe)
+import Text.Megaparsec.String as Export (Parser)
+
+import Data.Map (Map); import qualified Data.Map as Map
+import Text.Megaparsec
+
+
+decimal :: Parser Integer
+decimal = Lexer.decimal
+
+ueventFile :: Parser (Map String String)
+ueventFile =
+ Map.fromList <$> some param
+
+param :: Parser (String,String)
+param = do
+ k <- someTill anyChar (char '=')
+ v <- someTill anyChar newline
+ return (k,v)