git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: internal changes.

Refactored escapedChar into escapedChar', escapedChar.

commitc39cdc15baaded62b5af066d99dd779120f7b298 authorJohn MacFarlane <fiddlosopher@gmail.com> dateMon 5 Dec 2011, 20:27 (15 years ago) parent7b97151
1 file changed+9−5
src/Text/Pandoc/Readers/Markdown.hs+9−5
src/Text/Pandoc/Readers/Markdown.hs+9−5
@@ -939,13 +939,17 @@ failIfLink :: Inline -> GenParser tok st Inline
939939failIfLink (Link _ _) = pzero
940940failIfLink elt = return elt
941941
942−escapedChar :: GenParser Char ParserState Inline
943−escapedChar = try $ do
942+escapedChar' :: GenParser Char ParserState Char
943+escapedChar' = try $ do
944944 char '\\'
945945 state <- getState
946− result <- if stateStrict state
947− then oneOf "\\`*_{}[]()>#+-.!~"
948− else satisfy (not . isAlphaNum)
946+ if stateStrict state
947+ then oneOf "\\`*_{}[]()>#+-.!~"
948+ else satisfy (not . isAlphaNum)
949+
950+escapedChar :: GenParser Char ParserState Inline
951+escapedChar = do
952+ result <- escapedChar'
949953 return $ case result of
950954 ' ' -> Str "\160" -- "\ " is a nonbreaking space
951955 '\n' -> LineBreak -- "\[newline]" is a linebreak