{-
-----------------------------------------------------------------------------
-$Id: Parser.y,v 1.32 2000/06/01 08:51:46 simonmar Exp $
+$Id: Parser.y,v 1.35 2000/09/14 13:46:40 simonpj Exp $
Haskell grammar.
'__float' { ITfloat_lit }
'__rational' { ITrational_lit }
'__addr' { ITaddr_lit }
+ '__label' { ITlabel_lit }
'__litlit' { ITlit_lit }
'__string' { ITstring_lit }
'__ccall' { ITccall $$ }
| layout_on top close { $2 }
top :: { ([RdrNameImportDecl], [RdrNameHsDecl]) }
- : importdecls ';' cvtopdecls { (reverse $1,$3) }
- | importdecls { (reverse $1,[]) }
+ : importdecls { (reverse $1,[]) }
+ | importdecls ';' cvtopdecls { (reverse $1,$3) }
| cvtopdecls { ([],$1) }
cvtopdecls :: { [RdrNameHsDecl] }
| srcloc 'class' ctype fds where
{% checkDataHeader $3 `thenP` \(cs,c,ts) ->
- let (binds,sigs)
- = cvMonoBindsAndSigs cvClassOpSig
- (groupBindings $5)
+ let
+ (binds,sigs) = cvMonoBindsAndSigs cvClassOpSig (groupBindings $5)
in
returnP (RdrHsDecl (TyClD
(mkClassDecl cs c ts $4 sigs binds
{ let (binds,sigs)
= cvMonoBindsAndSigs cvInstDeclSig
(groupBindings $4)
- in RdrHsDecl (InstD
- (InstDecl $3 binds sigs dummyRdrVarName $1)) }
+ in RdrHsDecl (InstD (InstDecl $3 binds sigs Nothing $1)) }
| srcloc 'default' '(' types0 ')'
{ RdrHsDecl (DefD (DefaultDecl $4 $1)) }
| '[' type ']' { HsListTy $2 }
| '(' ctype ')' { $2 }
-gtycon :: { RdrName }
- : qtycon { $1 }
- | '(' ')' { unitTyCon_RDR }
- | '(' '->' ')' { funTyCon_RDR }
- | '[' ']' { listTyCon_RDR }
- | '(' commas ')' { tupleTyCon_RDR $2 }
-
-- An inst_type is what occurs in the head of an instance decl
-- e.g. (Foo a, Gaz b) => Wibble a b
-- It's kept as a single type, with a MonoDictTy at the right
| con '{' fielddecls '}' { ($1, RecCon (reverse $3)) }
newconstr :: { RdrNameConDecl }
- : srcloc conid atype { mkConDecl $2 [] [] (NewCon $3 Nothing) $1 }
+ : srcloc conid atype { mkConDecl $2 [] [] (VanillaCon [Unbanged $3]) $1 }
| srcloc conid '{' var '::' type '}'
- { mkConDecl $2 [] [] (NewCon $6 (Just $4)) $1 }
+ { mkConDecl $2 [] [] (RecCon [([$4], Unbanged $6)]) $1 }
scontype :: { (RdrName, [RdrNameBangType]) }
: btype {% splitForConApp $1 [] }
| '_' { EWildPat }
| '~' aexp1 { ELazyPat $2 }
-commas :: { Int }
- : commas ',' { $1 + 1 }
- | ',' { 2 }
-
texps :: { [RdrNameHsExpr] }
: texps ',' exp { $3 : $1 }
| exp { [$1] }
-----------------------------------------------------------------------------
-- Variables, Constructors and Operators.
+gtycon :: { RdrName }
+ : qtycon { $1 }
+ | '(' ')' { unitTyCon_RDR }
+ | '(' '->' ')' { funTyCon_RDR }
+ | '[' ']' { listTyCon_RDR }
+ | '(' commas ')' { tupleTyCon_RDR $2 }
+
gcon :: { RdrName }
: '(' ')' { unitCon_RDR }
| '[' ']' { nilCon_RDR }
| 'ccall' { ccall_tyvar_RDR }
-- NOTE: no 'forall'
+commas :: { Int }
+ : commas ',' { $1 + 1 }
+ | ',' { 2 }
+
-----------------------------------------------------------------------------
{