From: simonmar Date: Wed, 26 Nov 2003 10:07:19 +0000 (+0000) Subject: [project @ 2003-11-26 10:07:19 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~228 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=cf45ed4d1eb7ac250a124504415921535c1224de;p=ghc-hetmet.git [project @ 2003-11-26 10:07:19 by simonmar] Haskell 98 doesn't allow extra commas in record construction/update, so neither should GHC. --- diff --git a/ghc/compiler/parser/Parser.y b/ghc/compiler/parser/Parser.y index 68cc7ea..9333122 100644 --- a/ghc/compiler/parser/Parser.y +++ b/ghc/compiler/parser/Parser.y @@ -1,6 +1,6 @@ {- -*-haskell-*- ----------------------------------------------------------------------------- -$Id: Parser.y,v 1.129 2003/11/06 17:09:53 simonpj Exp $ +$Id: Parser.y,v 1.130 2003/11/26 10:07:19 simonmar Exp $ Haskell grammar. @@ -951,7 +951,7 @@ aexp :: { RdrNameHsExpr } | aexp1 { $1 } aexp1 :: { RdrNameHsExpr } - : aexp1 '{' fbinds '}' {% (mkRecConstrOrUpdate $1 (reverse $3)) } + : aexp1 '{' fbinds '}' {% (mkRecConstrOrUpdate $1 (reverse $3)) } | aexp2 { $1 } -- Here was the syntax for type applications that I was planning @@ -1148,12 +1148,14 @@ qual :: { RdrNameStmt } ----------------------------------------------------------------------------- -- Record Field Update/Construction -fbinds :: { RdrNameHsRecordBinds } - : fbinds ',' fbind { $3 : $1 } - | fbinds ',' { $1 } - | fbind { [$1] } +fbinds :: { RdrNameHsRecordBinds } + : fbinds1 { $1 } | {- empty -} { [] } +fbinds1 :: { RdrNameHsRecordBinds } + : fbinds1 ',' fbind { $3 : $1 } + | fbind { [$1] } + fbind :: { (RdrName, RdrNameHsExpr) } : qvar '=' exp { ($1,$3) }