Skip to content

Commit a122f78

Browse files
committed
Add isCommentPragma
1 parent 8e172fa commit a122f78

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/GHC/Util/ApiAnnotation.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module GHC.Util.ApiAnnotation (
55
, commentText
66
, GHC.Util.ApiAnnotation.comments
77
, isCommentMultiline
8+
, isCommentPragma
89
, pragmas
910
, flags
1011
, languagePragmas
@@ -61,6 +62,11 @@ isCommentMultiline :: LEpaComment -> Bool
6162
isCommentMultiline (L _ (EpaComment (EpaBlockComment _) _)) = True
6263
isCommentMultiline _ = False
6364

65+
isCommentPragma :: LEpaComment -> Bool
66+
isCommentPragma (L _ (EpaComment (EpaBlockComment comm) _)) =
67+
"{-#" `isPrefixOf` comm && "#-}" `isSuffixOf` comm
68+
isCommentPragma _ = False
69+
6470
-- Pragmas have the form @{-# ...#-}@.
6571
pragmas :: EpAnnComments -> [(LEpaComment, String)]
6672
pragmas x =

0 commit comments

Comments
 (0)