- | Just s2 <- maybePrefixMatch "OPTIONS_GHC" s = matchOptions2 s2
- | Just s2 <- maybePrefixMatch "OPTIONS" s = matchOptions2 s2
- | otherwise = Nothing
+ | Just s2 <- maybePrefixMatch "OPTIONS" s
+ = case () of
+ _ | Just s3 <- maybePrefixMatch "_GHC" s2, not (is_ident (head s3))
+ -> matchOptions2 s3
+ | not (is_ident (head s2))
+ -> matchOptions2 s2
+ | otherwise
+ -> Just [] -- OPTIONS_anything is ignored, not treated as start of source
+ | otherwise = Nothing