Created a separate list of escapable chars
This commit is contained in:
@@ -88,7 +88,9 @@ leftmostLongestParse parser input =
|
|||||||
Nothing -> (mempty, mempty)
|
Nothing -> (mempty, mempty)
|
||||||
Just x -> x
|
Just x -> x
|
||||||
|
|
||||||
specialChars = "\\#*_[\n"
|
specialChars = "\\#*_[\n`"
|
||||||
|
|
||||||
|
escapableChars = '~' : specialChars
|
||||||
|
|
||||||
-- Makes a parser greedy. Instead of returning all possible parses, only the longest one is returned.
|
-- Makes a parser greedy. Instead of returning all possible parses, only the longest one is returned.
|
||||||
greedyParse :: ReadP a -> ReadP [a]
|
greedyParse :: ReadP a -> ReadP [a]
|
||||||
@@ -196,7 +198,7 @@ parseSingleNewline = do
|
|||||||
parseEscapedChar :: ReadP MdToken
|
parseEscapedChar :: ReadP MdToken
|
||||||
parseEscapedChar = do
|
parseEscapedChar = do
|
||||||
char '\\'
|
char '\\'
|
||||||
escapedChar <- choice (map char specialChars) -- Parse any of the special chars.
|
escapedChar <- choice (map char escapableChars) -- Parse any of the special chars.
|
||||||
return (Unit [escapedChar])
|
return (Unit [escapedChar])
|
||||||
|
|
||||||
-- Parse a character as a Unit.
|
-- Parse a character as a Unit.
|
||||||
|
Reference in New Issue
Block a user