X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FParser.y.pp;h=6f1b2e449f418636bf87676b712de866aba0afb4;hp=a2e2ff023225951ec6a391c77efbbcea24f942c0;hb=0cbdc7b1bd76c61ad31a14a43398ae05ce138489;hpb=5e4375adca19f66803c3ad47fb1ba2c2ac6b4b62 diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index a2e2ff0..6f1b2e4 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -1269,7 +1269,9 @@ exp10 :: { LHsExpr RdrName } (unguardedGRHSs $6) ]) } | 'let' binds 'in' exp { LL $ HsLet (unLoc $2) $4 } - | 'if' exp 'then' exp 'else' exp { LL $ HsIf $2 $4 $6 } + | 'if' exp optSemi 'then' exp optSemi 'else' exp + {% checkDoAndIfThenElse $2 $3 $5 $6 $8 >> + return (LL $ HsIf $2 $5 $8) } | 'case' exp 'of' altslist { LL $ HsCase $2 (mkMatchGroup (unLoc $4)) } | '-' fexp { LL $ NegApp $2 noSyntaxExpr } @@ -1296,6 +1298,10 @@ exp10 :: { LHsExpr RdrName } -- hdaume: core annotation | fexp { $1 } +optSemi :: { Bool } + : ';' { True } + | {- empty -} { False } + scc_annot :: { Located FastString } : '_scc_' STRING {% (addWarning Opt_WarnWarningsDeprecations (getLoc $1) (text "_scc_ is deprecated; use an SCC pragma instead")) >>= \_ -> ( do scc <- getSCC $2; return $ LL scc ) }