Commit e97c8fa8 authored by Simon Marlow's avatar Simon Marlow
Browse files

FIX parsing of Haddock comments (broken by me in the previous patch)

parent 897bcbf8
......@@ -699,8 +699,19 @@ notFollowedBy char _ _ _ (AI _ _ buf)
notFollowedBySymbol _ _ _ (AI _ _ buf)
= nextCharIs buf (`notElem` "!#$%&*+./<=>?@\\^|-~")
-- We must reject doc comments as being ordinary comments everywhere.
-- In some cases the doc comment will be selected as the lexeme due to
-- maximal munch, but not always, because the nested comment rule is
-- valid in all states, but the doc-comment rules are only valid in
-- the non-layout states.
isNormalComment bits _ _ (AI _ _ buf)
= nextCharIs buf (/='#')
| haddockEnabled bits = notFollowedByDocOrPragma
| otherwise = nextCharIs buf (/='#')
where
notFollowedByDocOrPragma
= not $ spaceAndP buf (`nextCharIs` (`elem` "|^*$#"))
spaceAndP buf p = p buf || nextCharIs buf (==' ') && p (snd (nextChar buf))
haddockDisabledAnd p bits _ _ (AI _ _ buf)
= if haddockEnabled bits then False else (p buf)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment