FIX: #1253 (Can't use non-layout at top level)
authorSimon Marlow <simonmar@microsoft.com>
Mon, 7 May 2007 13:25:14 +0000 (13:25 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Mon, 7 May 2007 13:25:14 +0000 (13:25 +0000)
compiler/parser/Parser.y.pp

index abfc258..9ad9518 100644 (file)
@@ -361,10 +361,10 @@ module    :: { Located (HsModule RdrName) }
                {% fileSrcSpan >>= \ loc -> case $1 of { (opt, info, doc) -> 
                   return (L loc (HsModule (Just $3) $5 (fst $7) (snd $7) $4 
                           opt info doc) )}}
-       | missing_module_keyword top close
+        | body2
                {% fileSrcSpan >>= \ loc ->
                   return (L loc (HsModule Nothing Nothing 
-                          (fst $2) (snd $2) Nothing Nothing emptyHaddockModInfo 
+                          (fst $1) (snd $1) Nothing Nothing emptyHaddockModInfo 
                           Nothing)) }
 
 optdoc :: { (Maybe String, HaddockModInfo RdrName, Maybe (HsDoc RdrName)) }                             
@@ -385,6 +385,10 @@ body       :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
        :  '{'            top '}'               { $2 }
        |      vocurly    top close             { $2 }
 
+body2  :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
+       :  '{' top '}'                          { $2 }
+       |  missing_module_keyword top close     { $2 }
+
 top    :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
        : importdecls                           { (reverse $1,[]) }
        | importdecls ';' cvtopdecls            { (reverse $1,$3) }