[project @ 1999-01-23 17:34:37 by sof]
authorsof <unknown>
Sat, 23 Jan 1999 17:34:37 +0000 (17:34 +0000)
committersof <unknown>
Sat, 23 Jan 1999 17:34:37 +0000 (17:34 +0000)
Parser didn't accept the (all-important) empty module. Does now.

ghc/compiler/parser/hsparser.y

index 4bd6d8b..f2fc70d 100644 (file)
@@ -279,7 +279,7 @@ BOOLEAN pat_check=TRUE;
                gcon gconk gtycon itycon qop1 qvarop1 
                ename iname
 
-%type <ubinding>  topdecl topdecls letdecls
+%type <ubinding>  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(); }
        ;
 
 /*