From fd2d74d63f2a1229b3e4debe11316b4aa3b975d6 Mon Sep 17 00:00:00 2001 From: sof Date: Sat, 23 Jan 1999 17:34:37 +0000 Subject: [PATCH] [project @ 1999-01-23 17:34:37 by sof] Parser didn't accept the (all-important) empty module. Does now. --- ghc/compiler/parser/hsparser.y | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/parser/hsparser.y b/ghc/compiler/parser/hsparser.y index 4bd6d8b..f2fc70d 100644 --- a/ghc/compiler/parser/hsparser.y +++ b/ghc/compiler/parser/hsparser.y @@ -279,7 +279,7 @@ BOOLEAN pat_check=TRUE; gcon gconk gtycon itycon qop1 qvarop1 ename iname -%type topdecl topdecls letdecls +%type topdecl topdecls topdecls1 letdecls typed datad newtd classd instd defaultd foreignd decl decls fixdecl fix_op fix_ops valdef maybe_where with_where where_body type_and_maybe_id @@ -438,9 +438,13 @@ iname : var { $$ = mknoqual($1); } * * **********************************************************************/ -topdecls : topdecl - | topdecls SEMI { $$ = $1; } - | topdecls SEMI topdecl +topdecls : /* empty */ { $$ = mknullbind(); } + | topdecls1 + ; + +topdecls1: topdecl + | topdecls1 SEMI { $$ = $1; } + | topdecls1 SEMI topdecl { if($1 != NULL) if($3 != NULL) @@ -1132,8 +1136,9 @@ list_rest : exp { $$ = lsing($1); } 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 /* empty */ { $$ = mknullbind(); } ; /* -- 1.7.10.4