[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:47:20 UTC 2010
The following commit has been merged in the master branch:
commit 482f17f57560286d5ffabd423ec79a1e3e7ec370
Author: John Goerzen <jgoerzen at complete.org>
Date: Thu Nov 18 23:53:48 2004 +0100
Added parser running tool
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-72)
diff --git a/ChangeLog b/ChangeLog
index e983045..6b10def 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
#
+2004-11-18 16:53:48 GMT John Goerzen <jgoerzen at complete.org> patch-72
+
+ Summary:
+ Added parser running tool
+ Revision:
+ missingh--head--0.5--patch-72
+
+
+ new files:
+ libsrc/MissingH/ConfigParser/RunParser.hs
+
+ modified files:
+ ChangeLog
+
+
2004-11-18 16:40:26 GMT John Goerzen <jgoerzen at complete.org> patch-71
Summary:
diff --git a/libsrc/MissingH/Parsec.hs b/libsrc/MissingH/ConfigParser/RunParser.hs
similarity index 53%
copy from libsrc/MissingH/Parsec.hs
copy to libsrc/MissingH/ConfigParser/RunParser.hs
index 8d64b55..e612304 100644
--- a/libsrc/MissingH/Parsec.hs
+++ b/libsrc/MissingH/ConfigParser/RunParser.hs
@@ -1,4 +1,4 @@
-{- arch-tag: Parsec utilities
+{- arch-tag: ConfigParser parser running utilities
Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-}
{- |
- Module : MissingH.Parsec
+ Module : MissingH.ConfigParser.RunParser
Copyright : Copyright (C) 2004 John Goerzen
License : GNU GPL, version 2 or above
@@ -26,30 +26,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Stability : provisional
Portability: portable
-Written by John Goerzen, jgoerzen\@complete.org
+Parser support for "MissingH.ConfigParser". This module is not intended to be
+used directly by your programs.
+Copyright (c) 2004 John Goerzen, jgoerzen\@complete.org
-}
-module MissingH.Parsec(notMatching)
+module MissingH.ConfigParser.RunParser(
+ parse_string
+ )
where
import Text.ParserCombinators.Parsec
+import MissingH.ConfigParser.Parser
+import MissingH.ConfigParser.Lexer
-{- | Running @notMatching p msg@ will try to apply parser p.
-If it fails, returns (). If it succeds, cause a failure and raise
-the given error message. It will not consume input in either case. -}
-notMatching :: GenParser a b c -> String -> GenParser a b ()
-notMatching p errormsg =
- let maybeRead = try (do
- x <- p
- return (Just x)
- )
- <|> return Nothing
- workerFunc = do
- x <- maybeRead
- case x of
- Nothing -> return ()
- Just x -> unexpected errormsg
+detokenize fp l =
+ let r = case l of
+ Left err -> error (show err)
+ Right reply -> reply
in
- try workerFunc
+ case runParser main () fp r of
+ Left err -> error (show err)
+ Right reply -> reply
+parse_string :: String -> [(String, [(String, String)])]
+parse_string s =
+ detokenize "(string)" $ parse (many1 loken) "(string)" s
\ No newline at end of file
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list