[project @ 1999-06-30 11:29:53 by simonmar]
[ghc-hetmet.git] / ghc / compiler / parser / Parser.y
index 4d24d4c..ef83b5e 100644 (file)
@@ -1,6 +1,6 @@
 {-
 -----------------------------------------------------------------------------
-$Id: Parser.y,v 1.6 1999/06/07 14:58:40 simonmar Exp $
+$Id: Parser.y,v 1.10 1999/06/30 11:29:53 simonmar Exp $
 
 Haskell grammar.
 
@@ -760,14 +760,17 @@ gdpat     :: { RdrNameGRHS }
 -- Statement sequences
 
 stmtlist :: { [RdrNameStmt] }
-       : '{'            stmts '}'      { reverse $2 }
-       |     layout_on  stmts close    { reverse $2 }
+       : '{'                   stmts '}'       { reverse $2 }
+       |     layout_on_for_do  stmts close     { reverse $2 }
 
 stmts :: { [RdrNameStmt] }
-       : stmts ';' stmt                { $3 : $1 }
-       | stmts ';'                     { $1 }
+       : ';' stmts1                    { $2 }
+       | stmts1                        { $1 }
+
+stmts1 :: { [RdrNameStmt] }
+       : stmts1 ';' stmt               { $3 : $1 }
+       | stmts1 ';'                    { $1 }
        | stmt                          { [$1] }
-       | {- empty -}                   { [] }
 
 stmt  :: { RdrNameStmt }
        : srcloc infixexp '<-' exp      {% checkPattern $2 `thenP` \p ->
@@ -946,7 +949,8 @@ close :: { () }
        : vccurly               { () } -- context popped in lexer.
        | error                 {% popContext }
 
-layout_on  :: { () }   :       {% layoutOn  }
+layout_on        :: { () }     : {% layoutOn True{-strict-} }
+layout_on_for_do  :: { () }    : {% layoutOn False }
 
 -----------------------------------------------------------------------------
 -- Miscellaneous (mostly renamings)