+languagePragParseError i fn =
+ pgmError (showSDoc (mkLocMessage loc (
+ text "cannot parse LANGUAGE pragma")))
+ where loc = srcLocSpan (mkSrcLoc (mkFastString fn) i 0)
+
+unsupportedExtnError i fn unsup =
+ pgmError (showSDoc (mkLocMessage loc (
+ text "unsupported extensions: " <>
+ hcat (punctuate comma (map (text.show) unsup)))))
+ where loc = srcLocSpan (mkSrcLoc (mkFastString fn) i 0)
+
+
+optionsErrorMsgs :: [String] -> [(Int,String)] -> FilePath -> Messages
+optionsErrorMsgs unhandled_flags flags_lines filename
+ = (emptyBag, listToBag (map mkMsg unhandled_flags_lines))
+ where
+ unhandled_flags_lines = [ (l,f) | f <- unhandled_flags,
+ (l,f') <- flags_lines, f == f' ]
+ mkMsg (line,flag) =
+ ErrUtils.mkPlainErrMsg (srcLocSpan loc) $
+ text "unknown flag in {-# OPTIONS #-} pragma:" <+> text flag
+ where
+ loc = mkSrcLoc (mkFastString filename) line 0
+ -- ToDo: we need a better SrcSpan here
+