From 4ff49f0a54725d3f862608c22ee879e4d1d0a4b9 Mon Sep 17 00:00:00 2001 From: sof Date: Wed, 10 Mar 1999 18:50:24 +0000 Subject: [PATCH] [project @ 1999-03-10 18:50:24 by sof] Last commit made empty where bodies illegal, i.e., x = 2 where Re-added support for this "feature". --- ghc/compiler/parser/hsparser.y | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/parser/hsparser.y b/ghc/compiler/parser/hsparser.y index 439d98f..37984e8 100644 --- a/ghc/compiler/parser/hsparser.y +++ b/ghc/compiler/parser/hsparser.y @@ -281,7 +281,7 @@ BOOLEAN pat_check=TRUE; %type topdecl topdecls letdecls typed datad newtd classd instd defaultd foreignd - decl decls fixdecl fix_op fix_ops valdef + decl decls non_empty_decls fixdecl fix_op fix_ops valdef maybe_where where_body type_and_maybe_id %type polytype @@ -557,6 +557,20 @@ decls : /* empty */ { $$ = mknullbind(); } } ; +non_empty_decls : decl + | non_empty_decls SEMI { $$ = $1; } + | non_empty_decls SEMI decl + { + if(SAMEFN) + { + extendfn($1,$3); + $$ = $1; + } + else + $$ = mkabind($1,$3); + } + ; + /* Note: if there is an iclasop_pragma here, then we must be doing a class-op in an interface -- unless the user is up @@ -915,10 +929,11 @@ gdrhs : gd EQUAL get_line_no exp { $$ = lsing(mkpgdexp($1,$3,$4)); } maybe_where: /* empty */ { $$ = mknullbind(); } | WHERE where_body { $$ = $2; } + | WHERE { $$ = mknullbind(); } ; where_body : ocurly decls ccurly { $$ = $2; } - | vocurly decls vccurly { $$ = $2; } + | vocurly non_empty_decls vccurly { $$ = $2; } ; gd : VBAR quals { $$ = $2; } -- 1.7.10.4