Tweaked to accept empty declarations (again.)
gcon gconk gtycon itycon qop1 qvarop1
ename iname
gcon gconk gtycon itycon qop1 qvarop1
ename iname
-%type <ubinding> topdecl topdecls topdecls1 letdecls
+%type <ubinding> topdecl topdecls letdecls
typed datad newtd classd instd defaultd foreignd
typed datad newtd classd instd defaultd foreignd
- decl decls decls1 fixdecl fix_op fix_ops valdef
- maybe_where type_and_maybe_id
+ decl decls fixdecl fix_op fix_ops valdef
+ maybe_where with_where where_body type_and_maybe_id
%type <uttype> polytype
conargatype conapptype
%type <uttype> polytype
conargatype conapptype
* *
**********************************************************************/
* *
**********************************************************************/
-topdecls: topdecls1 opt_semi { $$ = $1; }
-
-topdecls1: topdecl
- | topdecls1 SEMI topdecl
+topdecls : topdecl
+ | topdecls SEMI { $$ = $1; }
+ | topdecls SEMI topdecl
{
if($1 != NULL)
if($3 != NULL)
{
if($1 != NULL)
if($3 != NULL)
| /*empty*/ { $$ = 0; }
;
| /*empty*/ { $$ = 0; }
;
-decls : decls1 opt_semi { $$ = $1; }
-
-decls1 : decl
- | decls1 SEMI decl
+decls : decl
+ | decls SEMI { $$ = $1; }
+ | decls SEMI decl
-opt_semi : /*empty*/
- | SEMI
- ;
-
/*
Note: if there is an iclasop_pragma here, then we must be
doing a class-op in an interface -- unless the user is up
/*
Note: if there is an iclasop_pragma here, then we must be
doing a class-op in an interface -- unless the user is up
| gd EQUAL get_line_no exp gdrhs { $$ = mklcons(mkpgdexp($1,$3,$4),$5); }
;
| gd EQUAL get_line_no exp gdrhs { $$ = mklcons(mkpgdexp($1,$3,$4),$5); }
;
-maybe_where:
- WHERE ocurly decls ccurly { $$ = $3; }
- | WHERE vocurly decls vccurly { $$ = $3; }
- /* A where containing no decls is OK */
- | WHERE { $$ = mknullbind(); }
- | WHERE ocurly ccurly { $$ = mknullbind(); }
- | /* empty */ { $$ = mknullbind(); }
- ;
+maybe_where: /* empty */ { $$ = mknullbind(); }
+ | WHERE with_where { $$ = $2; }
+ ;
+
+with_where : /* empty */ { $$ = mknullbind(); }
+ | where_body { $$ = $1; }
+ ;
+
+where_body : ocurly decls ccurly { $$ = $2; }
+ | vocurly decls vccurly { $$ = $2; }
+ | ocurly ccurly { $$ = mknullbind(); }
+ ;
gd : VBAR quals { $$ = $2; }
;
gd : VBAR quals { $$ = $2; }
;
at it, it *will* do the wrong thing [WDP 94/06])
*/
at it, it *will* do the wrong thing [WDP 94/06])
*/
-letdecls: LET { pat_check = TRUE; } ocurly decls ccurly { $$ = $4; }
+letdecls: LET { pat_check = TRUE; } ocurly decls ccurly { $$ = $4; }
| LET { pat_check = TRUE; } vocurly decls vccurly { $$ = $4; }
;
| LET { pat_check = TRUE; } vocurly decls vccurly { $$ = $4; }
;