X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fparser%2FParser.y.pp;h=18565a95478b7f59d1f6d7fe9701ed8c722c5729;hb=35f950020ff9eb503f383c642e8be2562605211f;hp=c650a7c4bac4b68da3288cfdeadba02f10c78b41;hpb=7ab880e6cbce4e095d8316d4289066aa2d50419b;p=ghc-hetmet.git diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index c650a7c..18565a9 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -159,6 +159,7 @@ incorrect. 'deriving' { L _ ITderiving } 'do' { L _ ITdo } 'else' { L _ ITelse } + 'for' { L _ ITfor } 'hiding' { L _ IThiding } 'if' { L _ ITif } 'import' { L _ ITimport } @@ -255,7 +256,6 @@ incorrect. QCONSYM { L _ (ITqconsym _) } IPDUPVARID { L _ (ITdupipvarid _) } -- GHC extension - IPSPLITVARID { L _ (ITsplitipvarid _) } -- GHC extension CHAR { L _ (ITchar _) } STRING { L _ (ITstring _) } @@ -459,6 +459,7 @@ topdecl :: { OrdList (LHsDecl RdrName) } { let (binds, sigs, ats) = cvBindsAndSigs (unLoc $3) in unitOL (L (comb3 $1 $2 $3) (InstD (InstDecl $2 binds sigs ats))) } + | stand_alone_deriving { unitOL (LL (DerivD (unLoc $1))) } | 'default' '(' comma_types0 ')' { unitOL (LL $ DefD (DefaultDecl $3)) } | 'foreign' fdecl { unitOL (LL (unLoc $2)) } | '{-# DEPRECATED' deprecations '#-}' { $2 } @@ -664,6 +665,16 @@ tycl_hdr :: { Located (LHsContext RdrName, | type {% checkTyClHdr (noLoc []) $1 >>= return.L1 } ----------------------------------------------------------------------------- +-- Stand-alone deriving + +-- Glasgow extension: stand-alone deriving declarations +stand_alone_deriving :: { LDerivDecl RdrName } + : 'deriving' qtycon 'for' qtycon {% do { p <- checkInstType (fmap HsTyVar $2) + ; checkDerivDecl (LL (DerivDecl p $4)) } } + + | 'deriving' '(' inst_type ')' 'for' qtycon {% checkDerivDecl (LL (DerivDecl $3 $6)) } + +----------------------------------------------------------------------------- -- Nested declarations -- Type declaration or value declaration @@ -1382,8 +1393,7 @@ dbind :: { LIPBind RdrName } dbind : ipvar '=' exp { LL (IPBind (unLoc $1) $3) } ipvar :: { Located (IPName RdrName) } - : IPDUPVARID { L1 (Dupable (mkUnqual varName (getIPDUPVARID $1))) } - | IPSPLITVARID { L1 (Linear (mkUnqual varName (getIPSPLITVARID $1))) } + : IPDUPVARID { L1 (IPName (mkUnqual varName (getIPDUPVARID $1))) } ----------------------------------------------------------------------------- -- Deprecations @@ -1567,6 +1577,7 @@ special_id : 'as' { L1 FSLIT("as") } | 'qualified' { L1 FSLIT("qualified") } | 'hiding' { L1 FSLIT("hiding") } + | 'for' { L1 FSLIT("for") } | 'export' { L1 FSLIT("export") } | 'label' { L1 FSLIT("label") } | 'dynamic' { L1 FSLIT("dynamic") } @@ -1648,7 +1659,6 @@ getQCONID (L _ (ITqconid x)) = x getQVARSYM (L _ (ITqvarsym x)) = x getQCONSYM (L _ (ITqconsym x)) = x getIPDUPVARID (L _ (ITdupipvarid x)) = x -getIPSPLITVARID (L _ (ITsplitipvarid x)) = x getCHAR (L _ (ITchar x)) = x getSTRING (L _ (ITstring x)) = x getINTEGER (L _ (ITinteger x)) = x