\begin{code}
-- reason/explanation from a WARNING or DEPRECATED pragma
-data WarningTxt = WarningTxt FastString
- | DeprecatedTxt FastString
+data WarningTxt = WarningTxt [FastString]
+ | DeprecatedTxt [FastString]
deriving Eq
instance Outputable WarningTxt where
- ppr (WarningTxt w) = doubleQuotes (ftext w)
- ppr (DeprecatedTxt d) = text "Deprecated:" <+> doubleQuotes (ftext d)
+ ppr (WarningTxt ws) = doubleQuotes (vcat (map ftext ws))
+ ppr (DeprecatedTxt ds) = text "Deprecated:" <+>
+ doubleQuotes (vcat (map ftext ds))
\end{code}
%************************************************************************
: {- empty -} {% pushCurrentContext }
maybemodwarning :: { Maybe WarningTxt }
- : '{-# DEPRECATED' STRING '#-}' { Just (DeprecatedTxt (getSTRING $2)) }
- | '{-# WARNING' STRING '#-}' { Just (WarningTxt (getSTRING $2)) }
+ : '{-# DEPRECATED' strings '#-}' { Just (DeprecatedTxt $ unLoc $2) }
+ | '{-# WARNING' strings '#-}' { Just (WarningTxt $ unLoc $2) }
| {- empty -} { Nothing }
body :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
-- SUP: TEMPORARY HACK, not checking for `module Foo'
warning :: { OrdList (LHsDecl RdrName) }
- : namelist STRING
- { toOL [ LL $ WarningD (Warning n (WarningTxt (getSTRING $2)))
+ : namelist strings
+ { toOL [ LL $ WarningD (Warning n (WarningTxt $ unLoc $2))
| n <- unLoc $1 ] }
deprecations :: { OrdList (LHsDecl RdrName) }
-- SUP: TEMPORARY HACK, not checking for `module Foo'
deprecation :: { OrdList (LHsDecl RdrName) }
- : namelist STRING
- { toOL [ LL $ WarningD (Warning n (DeprecatedTxt (getSTRING $2)))
+ : namelist strings
+ { toOL [ LL $ WarningD (Warning n (DeprecatedTxt $ unLoc $2))
| n <- unLoc $1 ] }
+strings :: { Located [FastString] }
+ : STRING { L1 [getSTRING $1] }
+ | '[' stringlist ']' { LL $ fromOL (unLoc $2) }
+
+stringlist :: { Located (OrdList FastString) }
+ : stringlist ',' STRING { LL (unLoc $1 `snocOL` getSTRING $3) }
+ | STRING { LL (unitOL (getSTRING $1)) }
+
-----------------------------------------------------------------------------
-- Annotations
annotation :: { LHsDecl RdrName }