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


The following commit has been merged in the master branch:
commit 40663738cf9266c6b3abcf60605ec93fdec0ed2e
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri Nov 19 22:02:15 2004 +0100

    Fixed several extension line parsing bugs
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.5--patch-99)

diff --git a/ChangeLog b/ChangeLog
index 8af7268..081ec24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
 #
 
+2004-11-19 15:02:15 GMT	John Goerzen <jgoerzen at complete.org>	patch-99
+
+    Summary:
+      Fixed several extension line parsing bugs
+    Revision:
+      missingh--head--0.5--patch-99
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/ConfigParser/Lexer.hs
+     testsrc/ConfigParser/Parsertest.hs
+
+
 2004-11-19 14:52:40 GMT	John Goerzen <jgoerzen at complete.org>	patch-98
 
     Summary:
diff --git a/libsrc/MissingH/ConfigParser/Lexer.hs b/libsrc/MissingH/ConfigParser/Lexer.hs
index 5ff0d0c..fbcf8bb 100644
--- a/libsrc/MissingH/ConfigParser/Lexer.hs
+++ b/libsrc/MissingH/ConfigParser/Lexer.hs
@@ -59,7 +59,7 @@ optionsep = oneOf ":=" <?> "Option separator"
 whitespace_chars = oneOf " \t" <?> "Whitespace"
 comment_line = do skipMany whitespace_chars <?> "whitespace in comment"
                   comment_chars             <?> "start of comment"
-                  (many1 $ noneOf "\r\n")   <?> "content of comment"
+                  (many $ noneOf "\r\n")   <?> "content of comment"
                   eoleof
 eolstuff = (try comment_line) <|> (try empty_line)
 empty_line = do many whitespace_chars         <?> "empty line"
@@ -76,7 +76,7 @@ extension_line = do
                  many1 whitespace_chars
                  c1 <- noneOf "\r\n#;"
                  remainder <- many value_chars
-                 eoleof
+                 eolstuff
                  return (c1 : remainder)
 
 optionkey = many1 oname_chars
@@ -96,8 +96,8 @@ iloken =
     
     -- Real stuff
     <|> (do {sname <- sectheader; togtok $ NEWSECTION sname})
+    <|> try (do {extension <- extension_line; togtok $ EXTENSIONLINE extension})
     <|> try (do {pair <- optionpair; togtok $ NEWOPTION pair})
-    <|> (do {extension <- extension_line; togtok $ EXTENSIONLINE extension})
     <?> "Invalid syntax in configuration file"
         
 loken :: Parser [GeneralizedToken CPTok]
diff --git a/testsrc/ConfigParser/Parsertest.hs b/testsrc/ConfigParser/Parsertest.hs
index abb8a40..65c88da 100644
--- a/testsrc/ConfigParser/Parsertest.hs
+++ b/testsrc/ConfigParser/Parsertest.hs
@@ -28,6 +28,9 @@ test_basic =
         f "empty string" "" []
 
         ,f "one empty line" "\n" []
+        -- These two should go to OCaml
+        ,f "one empty comment" "#" []
+        ,f "one empty comment eol" "#\n" []
         ,f "one comment line" "#foo bar" []
         ,f "one comment line with eol" "#foo bar\n" []
         ,f "one empty section" "[emptysect]" [("emptysect", [])]

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list