lib: fix performance regression introduced in 30ae9914
This commit is contained in:
parent
f125825d97
commit
99e457f1da
@ -830,12 +830,14 @@ followingcommentp = T.unlines . map snd <$> followingcommentlinesp
|
|||||||
followingcommentlinesp :: JournalParser m [(SourcePos, Text)]
|
followingcommentlinesp :: JournalParser m [(SourcePos, Text)]
|
||||||
followingcommentlinesp = do
|
followingcommentlinesp = do
|
||||||
lift $ skipMany spacenonewline
|
lift $ skipMany spacenonewline
|
||||||
samelineComment <- try commentp
|
samelineComment@(_, samelineCommentText)
|
||||||
<|> (,) <$> (getPosition <* newline) <*> pure ""
|
<- try commentp <|> (,) <$> (getPosition <* newline) <*> pure ""
|
||||||
newlineComments <- many $ try $ do
|
newlineComments <- many $ try $ do
|
||||||
lift $ skipSome spacenonewline -- leading whitespace is required
|
lift $ skipSome spacenonewline -- leading whitespace is required
|
||||||
commentp
|
commentp
|
||||||
pure $ samelineComment : newlineComments
|
if T.null samelineCommentText && null newlineComments
|
||||||
|
then pure []
|
||||||
|
else pure $ samelineComment : newlineComments
|
||||||
|
|
||||||
-- | Parse a possibly multi-line comment following a semicolon, and
|
-- | Parse a possibly multi-line comment following a semicolon, and
|
||||||
-- any tags and/or posting dates within it. Posting dates can be
|
-- any tags and/or posting dates within it. Posting dates can be
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user