diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-28 03:06:05 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-28 03:06:05 +0000 |
commit | a6da87f4841c6627bd5d9162fa2775ec92f4d61d (patch) | |
tree | b6bcd001d35c2aff8dd2dafe9f57648d93b299b8 /src/Text | |
parent | 1d8fe2653a7e67da06c15588a5940b20b0d8587e (diff) | |
download | pandoc-a6da87f4841c6627bd5d9162fa2775ec92f4d61d.tar.gz |
Minor code cleanup in Text.Pandoc.Shared.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@925 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 9b5e112b6..f3da7cb83 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -102,6 +102,7 @@ import Text.ParserCombinators.Parsec import Text.Pandoc.CharacterReferences ( characterReference ) import Data.Char ( toLower, toUpper, ord, chr, isLower, isUpper ) import Data.List ( find, groupBy, isPrefixOf, isSuffixOf ) +import Control.Monad ( join ) -- -- List processing @@ -254,9 +255,11 @@ many1Till p end = do -- type of parser to be specified, and succeeds only if that parser fails. -- It does not consume any input. notFollowedBy' :: Show b => GenParser a st b -> GenParser a st () -notFollowedBy' parser = try $ (do result <- try parser - unexpected (show result)) - <|> return () +notFollowedBy' p = try $ join $ do a <- try p + return (unexpected (show a)) + <|> + return (return ()) +-- (This version due to Andrew Pimlott on the Haskell mailing list.) -- | Parses one of a list of strings (tried in order). oneOfStrings :: [String] -> GenParser Char st String @@ -264,7 +267,7 @@ oneOfStrings listOfStrings = choice $ map (try . string) listOfStrings -- | Parses a space or tab. spaceChar :: CharParser st Char -spaceChar = oneOf " \t" +spaceChar = char ' ' <|> char '\t' -- | Skips zero or more spaces or tabs. skipSpaces :: GenParser Char st () |