Skip to content

Commit d7a2c65

Browse files
committed
Add isCommentHaddock
1 parent f75894c commit d7a2c65

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/GHC/Util/ApiAnnotation.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module GHC.Util.ApiAnnotation (
66
, GHC.Util.ApiAnnotation.comments
77
, isCommentMultiline
88
, isCommentPragma
9+
, isCommentHaddock
910
, pragmas
1011
, flags
1112
, languagePragmas
@@ -67,6 +68,13 @@ isCommentPragma (L _ (EpaComment (EpaBlockComment comm) _)) =
6768
"{-#" `isPrefixOf` comm && "#-}" `isSuffixOf` comm
6869
isCommentPragma _ = False
6970

71+
isCommentHaddock :: LEpaComment -> Bool
72+
isCommentHaddock (L _ (EpaComment (EpaBlockComment comm) _)) =
73+
"{- |" `isPrefixOf` comm && "#-}" `isSuffixOf` comm
74+
isCommentHaddock (L _ (EpaComment (EpaLineComment comm) _)) =
75+
"-- |" `isPrefixOf` comm || "-- ^" `isPrefixOf` comm
76+
isCommentHaddock _ = False
77+
7078
-- Pragmas have the form @{-# ...#-}@.
7179
pragmas :: EpAnnComments -> [(LEpaComment, String)]
7280
pragmas x =

0 commit comments

Comments
 (0)