aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-28 05:58:21 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-08-28 05:58:21 +0000
commitf04df62db11448da41d7b8daa280ac32459e1176 (patch)
tree617acf97e82d69cf7ee58365a1b8f35c5c40e71c /src/Text/Pandoc
parenta6da87f4841c6627bd5d9162fa2775ec92f4d61d (diff)
downloadpandoc-f04df62db11448da41d7b8daa280ac32459e1176.tar.gz
Changed definition of 'enclosed' in Text.Pandoc.Shared so that
'try' is not automatically applied to the 'end' parser. Added 'try' in calls to 'enclosed' where needed. Slight speed increase. git-svn-id: https://pandoc.googlecode.com/svn/trunk@926 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs2
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
-rw-r--r--src/Text/Pandoc/Readers/RST.hs2
-rw-r--r--src/Text/Pandoc/Shared.hs4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 9440b446a..729f597fa 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -551,7 +551,7 @@ singleQuoteEnd = try $ char '\'' >> notFollowedBy alphaNum
doubleQuoteStart = string "``"
-doubleQuoteEnd = string "''"
+doubleQuoteEnd = try $ string "''"
ellipses = try $ string "\\ldots" >> optional (try (string "{}")) >>
return Ellipses
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index eedf0311d..4d81e78c4 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -684,11 +684,11 @@ emph = ((enclosed (char '*') (char '*') inline) <|>
(enclosed (char '_') (char '_') inline)) >>=
return . Emph . normalizeSpaces
-strong = ((enclosed (string "**") (string "**") inline) <|>
- (enclosed (string "__") (string "__") inline)) >>=
+strong = ((enclosed (string "**") (try $ string "**") inline) <|>
+ (enclosed (string "__") (try $ string "__") inline)) >>=
return . Strong . normalizeSpaces
-strikeout = failIfStrict >> enclosed (string "~~") (string "~~") inline >>=
+strikeout = failIfStrict >> enclosed (string "~~") (try $ string "~~") inline >>=
return . Strikeout . normalizeSpaces
superscript = failIfStrict >> enclosed (char '^') (char '^')
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index abbf502a1..6bc8c1197 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -514,7 +514,7 @@ code = try $ do
emph = enclosed (char '*') (char '*') inline >>=
return . Emph . normalizeSpaces
-strong = enclosed (string "**") (string "**") inline >>=
+strong = enclosed (string "**") (try $ string "**") inline >>=
return . Strong . normalizeSpaces
interpreted role = try $ do
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index f3da7cb83..26a47b3d0 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -287,8 +287,8 @@ enclosed :: GenParser Char st t -- ^ start parser
-> GenParser Char st a -- ^ content parser (to be used repeatedly)
-> GenParser Char st [a]
enclosed start end parser = try $
- start >> notFollowedBy space >> many1Till parser (try end)
-
+ start >> notFollowedBy space >> many1Till parser end
+
-- | Parse string, case insensitive.
stringAnyCase :: [Char] -> CharParser st String
stringAnyCase [] = string ""