[commit: ghc] master: Fix bug in parsing of module headers (see #5243) (bf04ddc)

Simon Marlow marlowsd at gmail.com
Tue Jul 12 17:35:40 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/bf04ddcce48856a4185c05bd890635b9450762a4

>---------------------------------------------------------------

commit bf04ddcce48856a4185c05bd890635b9450762a4
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Jul 12 11:48:00 2011 +0100

    Fix bug in parsing of module headers (see #5243)

>---------------------------------------------------------------

 compiler/parser/Parser.y.pp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index bb82aaa..2641cc5 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -427,14 +427,18 @@ header 	:: { Located (HsModule RdrName) }
 		{% fileSrcSpan >>= \ loc ->
 		   return (L loc (HsModule (Just $3) $5 $7 [] $4 $1
                           ))}
-	| missing_module_keyword importdecls
+        | header_body2
 		{% fileSrcSpan >>= \ loc ->
-		   return (L loc (HsModule Nothing Nothing $2 [] Nothing
+                   return (L loc (HsModule Nothing Nothing $1 [] Nothing
                           Nothing)) }
 
 header_body :: { [LImportDecl RdrName] }
 	:  '{'            importdecls		{ $2 }
- 	|      vocurly    importdecls		{ $2 }
+        |      vocurly    importdecls           { $2 }
+
+header_body2 :: { [LImportDecl RdrName] }
+        :  '{' importdecls                      { $2 }
+        |  missing_module_keyword importdecls   { $2 }
 
 -----------------------------------------------------------------------------
 -- The Export List





More information about the Cvs-ghc mailing list