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
|
return restOfLine
|
||||||
|
|
||||||
-- Parse many 'quoted lines' until I see a non-quoted line.
|
-- 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 :: ReadP [String]
|
||||||
parseQuotedLines =
|
parseQuotedLines =
|
||||||
manyTill
|
greedyParse1 $ do
|
||||||
( do
|
look >>= \line ->
|
||||||
look >>= \line ->
|
case line of
|
||||||
case line of
|
('>' : _) -> parseQuotedLine
|
||||||
('>' : _) -> parseQuotedLine
|
_ -> pfail
|
||||||
_ -> pfail
|
|
||||||
)
|
|
||||||
( ( do
|
|
||||||
look >>= \line ->
|
|
||||||
case line of
|
|
||||||
('>' : _) -> pfail
|
|
||||||
_ -> return ()
|
|
||||||
)
|
|
||||||
<* eof
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Parse a blockquote, which is a greater-than sign followed by a paragraph.
|
-- Parse a blockquote, which is a greater-than sign followed by a paragraph.
|
||||||
parseBlockquote :: ReadP MdToken
|
parseBlockquote :: ReadP MdToken
|
||||||
|
Reference in New Issue
Block a user