[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:15 UTC 2010
The following commit has been merged in the master branch:
commit 08da29f886ecdc1c8b123a32c71ae1be8e99c76a
Author: John Goerzen <jgoerzen at complete.org>
Date: Thu Nov 18 23:35:38 2004 +0100
Checkpointing
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-70)
diff --git a/ChangeLog b/ChangeLog
index 1282c98..8a6b094 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,27 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
#
+2004-11-18 16:35:38 GMT John Goerzen <jgoerzen at complete.org> patch-70
+
+ Summary:
+ Checkpointing
+ Revision:
+ missingh--head--0.5--patch-70
+
+
+ new files:
+ libsrc/MissingH/ConfigParser/.arch-ids/=id
+ libsrc/MissingH/ConfigParser/Lexer.hs
+ libsrc/MissingH/ConfigParser/Parser.hs
+
+ modified files:
+ ChangeLog debian/changelog
+
+ new directories:
+ libsrc/MissingH/ConfigParser
+ libsrc/MissingH/ConfigParser/.arch-ids
+
+
2004-11-18 14:55:24 GMT John Goerzen <jgoerzen at complete.org> patch-69
Summary:
diff --git a/debian/changelog b/debian/changelog
index bb85632..140b25e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+missingh (0.6.2) unstable; urgency=low
+
+ * New "generic" sprintf functions.
+
+ -- John Goerzen <jgoerzen at complete.org> Thu, 18 Nov 2004 09:00:03 -0600
+
missingh (0.6.0) unstable; urgency=low
* Major new feature: Printf module.
diff --git a/libsrc/MissingH/ConfigParser/Lexer.hs b/libsrc/MissingH/ConfigParser/Lexer.hs
new file mode 100644
index 0000000..f94a21c
--- /dev/null
+++ b/libsrc/MissingH/ConfigParser/Lexer.hs
@@ -0,0 +1,89 @@
+{- arch-tag: ConfigParser lexer support
+Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-}
+
+{- |
+ Module : MissingH.ConfigParser.Lexer
+ Copyright : Copyright (C) 2004 John Goerzen
+ License : GNU GPL, version 2 or above
+
+ Maintainer : John Goerzen,
+ Maintainer : jgoerzen at complete.org
+ Stability : provisional
+ Portability: portable
+
+Lexer 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.ConfigParser.Lexer
+(
+ -- -- * Temporary for testing
+ --comment_chars, eol, optionsep, whitespace_chars, comment_line,
+ --empty_line, sectheader_chars, sectheader, oname_chars, value_chars,
+ --extension_line, optionkey, optionvalue, optionpair
+ loken
+) where
+
+import Text.ParserCombinators.Parsec
+import MissingH.Parsec
+import MissingH.ConfigParser.Parser
+
+comment_chars = oneOf "#;"
+eol = string "\n" <|> string "\r\n" <|> string "\r" <?> "End of line"
+optionsep = oneOf ":=" <?> "Option separator"
+whitespace_chars = oneOf " \t" <?> "Whitespace"
+comment_line = do skipMany whitespace_chars
+ comment_chars
+ many1 $ noneOf "\r\n"
+empty_line = many1 whitespace_chars
+sectheader_chars = noneOf "]\r\n"
+sectheader = do char '['
+ sname <- many1 $ sectheader_chars
+ char ']'
+ return sname
+oname_chars = noneOf ":=\r\n"
+value_chars = noneOf "\r\n"
+extension_line = do
+ many1 whitespace_chars
+ c1 <- noneOf "\r\n#;"
+ remainder <- many value_chars
+ return (c1 : remainder)
+
+optionkey = many1 oname_chars
+optionvalue = many1 value_chars
+optionpair = do
+ key <- optionkey
+ optionsep
+ value <- optionvalue
+ return (key, value)
+
+loken :: Parser CPTok
+loken =
+ -- Ignore these things
+ do {eol; loken}
+ <|> do {comment_line; loken}
+ <|> do {empty_line; loken}
+
+ -- Real stuff
+ <|> do {sname <- sectheader; return $ NEWSECTION sname}
+ <|> do {pair <- optionpair; return $ NEWOPTION pair}
+ <|> do {extension <- extension_line; return $ EXTENSIONLINE extension}
+ <|> do {eof; return EOFTOK}
+ <?> "Invalid syntax in configuration file"
+
diff --git a/libsrc/MissingH/ConfigParser/Parser.hs b/libsrc/MissingH/ConfigParser/Parser.hs
new file mode 100644
index 0000000..bbf2ba2
--- /dev/null
+++ b/libsrc/MissingH/ConfigParser/Parser.hs
@@ -0,0 +1,117 @@
+{- arch-tag: ConfigParser parser support
+Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-}
+
+{- |
+ Module : MissingH.ConfigParser.Parser
+ Copyright : Copyright (C) 2004 John Goerzen
+ License : GNU GPL, version 2 or above
+
+ Maintainer : John Goerzen,
+ Maintainer : jgoerzen at complete.org
+ Stability : provisional
+ Portability: portable
+
+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.ConfigParser.Parser
+(
+ CPTok(..),
+ main
+) where
+import Text.ParserCombinators.Parsec
+import MissingH.Str
+
+data CPTok = EOFTOK
+ | NEWSECTION String
+ | NEWSECTION_EOF String
+ | EXTENSIONLINE String
+ | NEWOPTION (String, String)
+ deriving (Eq, Show, Ord)
+
+main :: GenParser CPTok () [(String, [(String, String)])]
+main =
+ do {s <- sectionlist; return s}
+ <|> try (do
+ o <- optionlist
+ s <- sectionlist
+ return $ ("DEFAULT", o) : s
+ )
+ <|> do {o <- optionlist; return $ [("DEFAULT", o)] }
+ <?> "Error parsing config file tokens"
+
+satisfyG :: (CPTok -> Bool) -> GenParser CPTok () CPTok
+satisfyG f = tokenPrim (\c -> show [c])
+ (\pos _ _ -> pos)
+ (\c -> if f c then Just c else Nothing)
+
+want :: (CPTok -> Maybe a) -> GenParser CPTok () a
+want f = tokenPrim (\c -> show [c])
+ (\pos _ _ -> pos)
+ (\c -> f c)
+
+sectionlist :: GenParser CPTok () [(String, [(String, String)])]
+sectionlist = do {satisfyG (==EOFTOK); return []}
+ <|> try (do
+ s <- sectionhead
+ satisfyG (==EOFTOK)
+ return [s, []]
+ )
+ <|> do
+ s <- section
+ sl <- sectionlist
+ return (s : sl)
+
+section :: GenParser CPTok () (String, [(String, String)])
+section = do {sh <- sectionhead; ol <- optionlist; return (sh, ol)}
+
+sectionhead =
+ let wf (NEWSECTION x) = Just x
+ wf _ = Nothing
+ in
+ do {s <- want wf; return $ strip s}
+
+optionlist :: GenParser CPTok () [(String, String)]
+optionlist =
+ try (do {c <- coption; ol <- optionlist; return $ c : ol})
+ <|> do {c <- coption; return $ [c]}
+
+extensionlist =
+ let wf (EXTENSIONLINE x) = Just x
+ wf _ = Nothing
+ in
+ try (do {x <- want wf; l <- extensionlist; return $ x : l})
+ <|> do {x <- want wf; return [x]}
+
+coption :: GenParser CPTok () (String, String)
+coption =
+ let wf (NEWOPTION x) = Just x
+ wf _ = Nothing
+ in
+ try (do
+ o <- want wf
+ l <- extensionlist
+ return (strip (fst o), valmerge ((snd o) : l ))
+ )
+ <|> do {o <- want wf; return $ (strip (fst o), strip (snd o))}
+
+valmerge vallist =
+ let vl2 = map strip vallist
+ in join "\n" vl2
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list