|
|
|
@ -88,7 +88,9 @@ leftmostLongestParse parser input =
|
|
|
|
|
Nothing -> (mempty, mempty)
|
|
|
|
|
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.
|
|
|
|
|
greedyParse :: ReadP a -> ReadP [a]
|
|
|
|
@ -196,7 +198,7 @@ parseSingleNewline = do
|
|
|
|
|
parseEscapedChar :: ReadP MdToken
|
|
|
|
|
parseEscapedChar = do
|
|
|
|
|
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])
|
|
|
|
|
|
|
|
|
|
-- Parse a character as a Unit.
|
|
|
|
|