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
This commit is contained in:
parent
a6da87f484
commit
f04df62db1
4 changed files with 7 additions and 7 deletions
|
@ -551,7 +551,7 @@ singleQuoteEnd = try $ char '\'' >> notFollowedBy alphaNum
|
||||||
|
|
||||||
doubleQuoteStart = string "``"
|
doubleQuoteStart = string "``"
|
||||||
|
|
||||||
doubleQuoteEnd = string "''"
|
doubleQuoteEnd = try $ string "''"
|
||||||
|
|
||||||
ellipses = try $ string "\\ldots" >> optional (try (string "{}")) >>
|
ellipses = try $ string "\\ldots" >> optional (try (string "{}")) >>
|
||||||
return Ellipses
|
return Ellipses
|
||||||
|
|
|
@ -684,11 +684,11 @@ emph = ((enclosed (char '*') (char '*') inline) <|>
|
||||||
(enclosed (char '_') (char '_') inline)) >>=
|
(enclosed (char '_') (char '_') inline)) >>=
|
||||||
return . Emph . normalizeSpaces
|
return . Emph . normalizeSpaces
|
||||||
|
|
||||||
strong = ((enclosed (string "**") (string "**") inline) <|>
|
strong = ((enclosed (string "**") (try $ string "**") inline) <|>
|
||||||
(enclosed (string "__") (string "__") inline)) >>=
|
(enclosed (string "__") (try $ string "__") inline)) >>=
|
||||||
return . Strong . normalizeSpaces
|
return . Strong . normalizeSpaces
|
||||||
|
|
||||||
strikeout = failIfStrict >> enclosed (string "~~") (string "~~") inline >>=
|
strikeout = failIfStrict >> enclosed (string "~~") (try $ string "~~") inline >>=
|
||||||
return . Strikeout . normalizeSpaces
|
return . Strikeout . normalizeSpaces
|
||||||
|
|
||||||
superscript = failIfStrict >> enclosed (char '^') (char '^')
|
superscript = failIfStrict >> enclosed (char '^') (char '^')
|
||||||
|
|
|
@ -514,7 +514,7 @@ code = try $ do
|
||||||
emph = enclosed (char '*') (char '*') inline >>=
|
emph = enclosed (char '*') (char '*') inline >>=
|
||||||
return . Emph . normalizeSpaces
|
return . Emph . normalizeSpaces
|
||||||
|
|
||||||
strong = enclosed (string "**") (string "**") inline >>=
|
strong = enclosed (string "**") (try $ string "**") inline >>=
|
||||||
return . Strong . normalizeSpaces
|
return . Strong . normalizeSpaces
|
||||||
|
|
||||||
interpreted role = try $ do
|
interpreted role = try $ do
|
||||||
|
|
|
@ -287,7 +287,7 @@ enclosed :: GenParser Char st t -- ^ start parser
|
||||||
-> GenParser Char st a -- ^ content parser (to be used repeatedly)
|
-> GenParser Char st a -- ^ content parser (to be used repeatedly)
|
||||||
-> GenParser Char st [a]
|
-> GenParser Char st [a]
|
||||||
enclosed start end parser = try $
|
enclosed start end parser = try $
|
||||||
start >> notFollowedBy space >> many1Till parser (try end)
|
start >> notFollowedBy space >> many1Till parser end
|
||||||
|
|
||||||
-- | Parse string, case insensitive.
|
-- | Parse string, case insensitive.
|
||||||
stringAnyCase :: [Char] -> CharParser st String
|
stringAnyCase :: [Char] -> CharParser st String
|
||||||
|
|
Loading…
Reference in a new issue