Commit 2476249a authored by Ian Lynagh's avatar Ian Lynagh

Add support for multi-line deprecated pragmas; trac #3303

parent 8864c6d9
......@@ -119,13 +119,14 @@ initialVersion = 1
\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}
%************************************************************************
......
......@@ -399,8 +399,8 @@ missing_module_keyword :: { () }
: {- 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]) }
......@@ -839,8 +839,8 @@ warnings :: { OrdList (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) }
......@@ -851,10 +851,18 @@ 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 }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment