@@ -102,6 +102,7 @@ import Text.ParserCombinators.Parsec
102import Text.Pandoc.CharacterReferences ( characterReference )
102import Text.Pandoc.CharacterReferences ( characterReference )
103import Data.Char ( toLower, toUpper, ord, chr, isLower, isUpper )
103import Data.Char ( toLower, toUpper, ord, chr, isLower, isUpper )
104import Data.List ( find, groupBy, isPrefixOf, isSuffixOf )
104import Data.List ( find, groupBy, isPrefixOf, isSuffixOf )
105+import Control.Monad ( join )
107-- List processing
108-- List processing
@@ -254,9 +255,11 @@ many1Till p end = do
254-- type of parser to be specified, and succeeds only if that parser fails.
255-- type of parser to be specified, and succeeds only if that parser fails.
255-- It does not consume any input.
256-- It does not consume any input.
256notFollowedBy' :: Show b => GenParser a st b -> GenParser a st ()
257notFollowedBy' :: Show b => GenParser a st b -> GenParser a st ()
257−notFollowedBy' parser = try $ (do result <- try parser
258+notFollowedBy' p = try $ join $ do a <- try p
258− unexpected (show result))
259+ return (unexpected (show a))
259− <|> return ()
261+ return (return ())
262+-- (This version due to Andrew Pimlott on the Haskell mailing list.)
261-- | Parses one of a list of strings (tried in order).
264-- | Parses one of a list of strings (tried in order).
262oneOfStrings :: [String] -> GenParser Char st String
265oneOfStrings :: [String] -> GenParser Char st String
@@ -264,7 +267,7 @@ oneOfStrings listOfStrings = choice $ map (try . string) listOfStrings
265-- | Parses a space or tab.
268-- | Parses a space or tab.
266spaceChar :: CharParser st Char
269spaceChar :: CharParser st Char
267−spaceChar = oneOf " \t"
270+spaceChar = char ' ' <|> char '\t'
269-- | Skips zero or more spaces or tabs.
272-- | Skips zero or more spaces or tabs.
270skipSpaces :: GenParser Char st ()
273skipSpaces :: GenParser Char st ()