Fixed bug in anyLine parser. Previously anyLine would parse an
empty string "". But it should fail on an empty string, or we get an
error from its use inside "many" combinators.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@587 788f1e2b-df1e-0410-8736-df70ead52e1b
commit726685af1b21d022784758b62c9f5da14c46a055
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>
dateSun 22 Apr 2007, 04:19 (20 years ago)
parent7742301
src/Text/ParserCombinators/Pandoc.hs+2−1
@@ -46,7 +46,8 @@ import Data.Char ( toUpper, toLower )
4646
4747--- | Parse any line of text
4848anyLine :: GenParser Char st [Char]
49−anyLine = manyTill anyChar (newline <|> (do{eof; return '\n'}))
49+anyLine = try (manyTill anyChar newline) <|> many1 anyChar
50+ -- second alternative is for a line ending with eof
5051
5152-- | Parses a space or tab.
5253spaceChar :: CharParser st Char