Removed unecessary case statement
This commit is contained in:
@@ -161,7 +161,6 @@ parseLine = do
|
|||||||
return (Line parsed)
|
return (Line parsed)
|
||||||
|
|
||||||
-- Parse a paragraph, which is a 'Line' (can span multiple actual lines), separated by double-newlines.
|
-- Parse a paragraph, which is a 'Line' (can span multiple actual lines), separated by double-newlines.
|
||||||
-- As a weird special case, a 'Paragraph' can also be a 'Header'.
|
|
||||||
parsePara :: ReadP MdToken
|
parsePara :: ReadP MdToken
|
||||||
parsePara = do
|
parsePara = do
|
||||||
parseMany (char '\n')
|
parseMany (char '\n')
|
||||||
@@ -169,11 +168,8 @@ parsePara = do
|
|||||||
-- string "\n\n" <|> (eof >> return "") -- Consume the next double-newline or EOF.
|
-- string "\n\n" <|> (eof >> return "") -- Consume the next double-newline or EOF.
|
||||||
text <- manyTill get (string "\n\n" <|> (eof >> return ""))
|
text <- manyTill get (string "\n\n" <|> (eof >> return ""))
|
||||||
when (null text) pfail
|
when (null text) pfail
|
||||||
let parsedText = fst $ leftmostLongestParse parseLine text -- Parse either a line or a header.
|
let parsedText = fst $ leftmostLongestParse parseLine text -- Parse a line
|
||||||
-- If the paragraph is a header, return a Header token. Otheriwse return a Para token.
|
return (Para parsedText)
|
||||||
case parsedText of
|
|
||||||
Header level token -> return (Header level token)
|
|
||||||
_ -> return (Para parsedText)
|
|
||||||
|
|
||||||
-- Parse a document, which is multiple paragraphs.
|
-- Parse a document, which is multiple paragraphs.
|
||||||
parseDocument :: ReadP MdToken
|
parseDocument :: ReadP MdToken
|
||||||
|
Reference in New Issue
Block a user