[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:36 UTC 2010


The following commit has been merged in the master branch:
commit d112a2def6e798abc017b910ff5f1a9da0179124
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri Nov 19 01:44:55 2004 +0100

    Fixed comment line / empty line conflict
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.5--patch-78)

diff --git a/ChangeLog b/ChangeLog
index 97f31d6..26b50ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
 #
 
+2004-11-18 18:44:55 GMT	John Goerzen <jgoerzen at complete.org>	patch-78
+
+    Summary:
+      Fixed comment line / empty line conflict
+    Revision:
+      missingh--head--0.5--patch-78
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/ConfigParser/Lexer.hs
+     testsrc/ConfigParser/Parsertest.hs
+
+
 2004-11-18 18:36:43 GMT	John Goerzen <jgoerzen at complete.org>	patch-77
 
     Summary:
diff --git a/libsrc/MissingH/ConfigParser/Lexer.hs b/libsrc/MissingH/ConfigParser/Lexer.hs
index 26eeefa..05d00ef 100644
--- a/libsrc/MissingH/ConfigParser/Lexer.hs
+++ b/libsrc/MissingH/ConfigParser/Lexer.hs
@@ -55,10 +55,10 @@ 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
+comment_line = do skipMany whitespace_chars <?> "whitespace in comment"
+                  comment_chars             <?> "start of comment"
+                  (many1 $ noneOf "\r\n")   <?> "content of comment"
+empty_line = many1 whitespace_chars         <?> "empty line"
 sectheader_chars = noneOf "]\r\n"
 sectheader = do char '['
                 sname <- many1 $ sectheader_chars
@@ -83,9 +83,9 @@ optionpair = do
 loken :: Parser [CPTok]
 loken =
     -- Ignore these things
-    do {eol; loken}
-    <|> do {comment_line; loken}
-    <|> do {empty_line; loken}
+    do {eol; loken}                     
+    <|> try (do {comment_line; loken})
+    <|> try (do {empty_line; loken})
     
     -- Real stuff
     <|> do {sname <- sectheader; next <- loken; return $ NEWSECTION sname : next}
diff --git a/testsrc/ConfigParser/Parsertest.hs b/testsrc/ConfigParser/Parsertest.hs
index d2f7219..c1e2c1d 100644
--- a/testsrc/ConfigParser/Parsertest.hs
+++ b/testsrc/ConfigParser/Parsertest.hs
@@ -31,10 +31,10 @@ test_basic =
         f "[emptysect]" [("emptysect", [])]
         f "#foo bar\n[emptysect]\n" [("emptysect", [])]
         f "# [nonexistant]\n[emptysect]\n" [("emptysect", [])]
-        f "#fo\n[Cemptysect\n#asdfboo\n  \n  # #fnonexistantg"
+        f "#fo\n[Cemptysect]\n#asdf boo\n  \n  # fnonexistantg"
           [("Cemptysect", [])]
         f "[emptysect]\n# [nonexistant]\n" [("emptysect", [])]
-        
+        f "[sect1]\nfoo: bar\n" [("sect1", [("foo", "bar")])]
         f "foo: bar" [("DEFAULT", [("foo", "bar")])]
 
 tests = TestList [TestLabel "test_basic" (TestCase test_basic)

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list