Greatly shortened parseQuotedLine, because I can just use greedyParse
instead of using manyTill
This commit is contained in:
@@ -218,26 +218,13 @@ parseQuotedLine = do
|
||||
return restOfLine
|
||||
|
||||
-- Parse many 'quoted lines' until I see a non-quoted line.
|
||||
-- There HAS to be a better way of doing this, but I'm not sure what it is.
|
||||
-- I rewrote it because I wanted it to consume all input, rather than being non-deterministic
|
||||
-- and giving all intermediate parse results.
|
||||
parseQuotedLines :: ReadP [String]
|
||||
parseQuotedLines =
|
||||
manyTill
|
||||
( do
|
||||
greedyParse1 $ do
|
||||
look >>= \line ->
|
||||
case line of
|
||||
('>' : _) -> parseQuotedLine
|
||||
_ -> pfail
|
||||
)
|
||||
( ( do
|
||||
look >>= \line ->
|
||||
case line of
|
||||
('>' : _) -> pfail
|
||||
_ -> return ()
|
||||
)
|
||||
<* eof
|
||||
)
|
||||
|
||||
-- Parse a blockquote, which is a greater-than sign followed by a paragraph.
|
||||
parseBlockquote :: ReadP MdToken
|
||||
|
Reference in New Issue
Block a user