Permalink
Browse files

Allow for comments to start with semicolons.

This is pretty common, and I was surprised when it didn't work. A test
case for the new comment style is also added.
  • Loading branch information...
1 parent fbdc67a commit 59e7770b63bfb1f30cdfa892df88e15898200601 @adimit adimit committed with Mar 19, 2012
Showing with 7 additions and 2 deletions.
  1. +1 −1 src/Data/Ini/Reader/Internals.hs
  2. +6 −1 tst/ReaderI.hs
@@ -114,7 +114,7 @@ optContParser = do
noiseParser :: Parser IniFile
noiseParser = let
commentP = do
- char '#'
+ oneOf "#;"
manyTill anyChar newline
emptyL = newline >> return ""
in choice [commentP, emptyL] >> return CommentL
View
@@ -123,11 +123,16 @@ case_noiseParserEmptyLine = let
actual = p2E noiseParser "noise" "\n"
in expected @=? actual
-case_noiseParserComment = let
+case_noiseParserComment1 = let
expected = Right CommentL
actual = p2E noiseParser "noise" "# a comment\n"
in expected @=? actual
+case_noiseParserComment2 = let
+ expected = Right CommentL
+ actual = p2E noiseParser "noise" "; another comment\n"
+ in expected @=? actual
+
case_noiseParserNonEmpty = let
expected = Left "bad"
actual = p2E noiseParser "noise" " \n"

0 comments on commit 59e7770

Please sign in to comment.