git.iko.soy/typeable/pandoc
on master help sign in
+ Added some needed "try"s before multicharacter parsers,

especially in "option" contexts. + Removed the "try" from the "end" parser in "enclosed" (Text.Pandoc.Shared). Now "enclosed" behaves like "option", "manyTill", etc. git-svn-id: https://pandoc.googlecode.com/svn/trunk@527 788f1e2b-df1e-0410-8736-df70ead52e1b

commitf3437dd27cbc3e82cdcef7433d0fbff5acd22eb9 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateMon 12 Feb 2007, 17:14 (20 years ago) parent73cbae7
4 files changed+9−9
src/Text/Pandoc/Readers/LaTeX.hs+2−2 src/Text/Pandoc/Readers/Markdown.hs+4−4 src/Text/Pandoc/Readers/RST.hs+1−1 src/Text/ParserCombinators/Pandoc.hs+2−2
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -131,7 +131,7 @@ parseLaTeX = do
131131 option () processLaTeXPreamble -- preamble might not be present (fragment)
132132 blocks <- parseBlocks
133133 spaces
134− option "" (string "\\end{document}") -- might not be present (in fragment)
134+ option "" (try (string "\\end{document}")) -- might not be present (in fragment)
135135 spaces
136136 eof
137137 state <- getState
@@ -540,7 +540,7 @@ doubleQuoteEnd = try (string "''")
540540
541541ellipses = try (do
542542 string "\\ldots"
543− option "" (string "{}")
543+ option "" (try (string "{}"))
544544 return Ellipses)
545545
546546enDash = try (do
src/Text/Pandoc/Readers/Markdown.hs+4−4
@@ -729,10 +729,10 @@ emph = do
729729 return (Emph (normalizeSpaces result))
730730
731731strong = do
732− result <- choice [ (enclosed (count 2 (char emphStart))
733− (count 2 (char emphEnd)) inline),
734− (enclosed (count 2 (char emphStartAlt))
735− (count 2 (char emphEndAlt)) inline) ]
732+ result <- choice [ (enclosed (try (count 2 (char emphStart)))
733+ (try (count 2 (char emphEnd))) inline),
734+ (enclosed (try (count 2 (char emphStartAlt)))
735+ (try (count 2 (char emphEndAlt))) inline) ]
736736 return (Strong (normalizeSpaces result))
737737
738738smartPunctuation = do
src/Text/Pandoc/Readers/RST.hs+1−1
@@ -567,7 +567,7 @@ emph = do
567567 return (Emph (normalizeSpaces result))
568568
569569strong = do
570− result <- enclosed (string "**") (string "**") inline
570+ result <- enclosed (try (string "**")) (try (string "**")) inline
571571 return (Strong (normalizeSpaces result))
572572
573573whitespace = do
src/Text/ParserCombinators/Pandoc.hs+2−2
@@ -93,14 +93,14 @@ escaped parser = try (do
9393 return (Str [result]))
9494
9595-- | Parses material enclosed between start and end parsers.
96−enclosed :: GenParser Char st t -- ^ start parser
96+enclosed :: GenParser Char st t -- ^ start parser
9797 -> GenParser Char st end -- ^ end parser
9898 -> GenParser Char st a -- ^ content parser (to be used repeatedly)
9999 -> GenParser Char st [a]
100100enclosed start end parser = try (do
101101 start
102102 notFollowedBy space
103− result <- many1Till parser (try end)
103+ result <- many1Till parser end
104104 return result)
105105
106106-- | Like @manyTill@, but reads at least one item.