diff options
Diffstat (limited to 'compiler/parser/Parser.y.pp')
-rw-r--r-- | compiler/parser/Parser.y.pp | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 72dfc88fa6..db7cb10854 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -1203,10 +1203,12 @@ atype :: { LHsType RdrName } -- see Note [Promotion] for the followings | SIMPLEQUOTE qcon { LL $ HsTyVar $ unLoc $2 } | SIMPLEQUOTE '(' ctype ',' comma_types1 ')' { LL $ HsExplicitTupleTy [] ($3 : $5) } - | SIMPLEQUOTE '[' comma_types0 ']' { LL $ HsExplicitListTy placeHolderKind $3 } - | SIMPLEQUOTE var { LL $ HsTyVar $ unLoc $2 } + | SIMPLEQUOTE '[' comma_types0 ']' { LL $ HsExplicitListTy + placeHolderKind $3 } + | SIMPLEQUOTE var { LL $ HsTyVar $ unLoc $2 } - | '[' ctype ',' comma_types1 ']' { LL $ HsExplicitListTy placeHolderKind ($2 : $4) } + | '[' ctype ',' comma_types1 ']' { LL $ HsExplicitListTy + placeHolderKind ($2 : $4) } | INTEGER {% mkTyLit $ LL $ HsNumTy $ getINTEGER $1 } | STRING {% mkTyLit $ LL $ HsStrTy $ getSTRING $1 } @@ -1437,7 +1439,9 @@ decl_no_th :: { Located (OrdList (LHsDecl RdrName)) } pat <- checkPattern empty e; return $ LL $ unitOL $ LL $ ValD $ PatBind pat (unLoc $3) - placeHolderType placeHolderNames (Nothing,[]) } } + placeHolderType + placeHolderNames + (Nothing,[]) } } -- Turn it all into an expression so that -- checkPattern can check that bangs are enabled @@ -1513,16 +1517,20 @@ quasiquote :: { Located (HsQuasiQuote RdrName) } in sL (getLoc $1) (mkHsQuasiQuote quoterId (RealSrcSpan quoteSpan) quote) } exp :: { LHsExpr RdrName } - : infixexp '::' sigtype { LL $ ExprWithTySig $1 $3 } - | infixexp '-<' exp { LL $ HsArrApp $1 $3 placeHolderType HsFirstOrderApp True } - | infixexp '>-' exp { LL $ HsArrApp $3 $1 placeHolderType HsFirstOrderApp False } - | infixexp '-<<' exp { LL $ HsArrApp $1 $3 placeHolderType HsHigherOrderApp True } - | infixexp '>>-' exp { LL $ HsArrApp $3 $1 placeHolderType HsHigherOrderApp False} - | infixexp { $1 } + : infixexp '::' sigtype { LL $ ExprWithTySig $1 $3 } + | infixexp '-<' exp { LL $ HsArrApp $1 $3 placeHolderType + HsFirstOrderApp True } + | infixexp '>-' exp { LL $ HsArrApp $3 $1 placeHolderType + HsFirstOrderApp False } + | infixexp '-<<' exp { LL $ HsArrApp $1 $3 placeHolderType + HsHigherOrderApp True } + | infixexp '>>-' exp { LL $ HsArrApp $3 $1 placeHolderType + HsHigherOrderApp False} + | infixexp { $1 } infixexp :: { LHsExpr RdrName } - : exp10 { $1 } - | infixexp qop exp10 { LL (OpApp $1 $2 (panic "fixity") $3) } + : exp10 { $1 } + | infixexp qop exp10 { LL (OpApp $1 $2 placeHolderFixity $3) } exp10 :: { LHsExpr RdrName } : '\\' apat apats opt_asig '->' exp @@ -1536,7 +1544,9 @@ exp10 :: { LHsExpr RdrName } {% checkDoAndIfThenElse $2 $3 $5 $6 $8 >> return (LL $ mkHsIf $2 $5 $8) } | 'if' ifgdpats {% hintMultiWayIf (getLoc $1) >> - return (LL $ HsMultiIf placeHolderType (reverse $ unLoc $2)) } + return (LL $ HsMultiIf + placeHolderType + (reverse $ unLoc $2)) } | 'case' exp 'of' altslist { LL $ HsCase $2 (mkMatchGroup FromSource (unLoc $4)) } | '-' fexp { LL $ NegApp $2 noSyntaxExpr } @@ -1556,7 +1566,7 @@ exp10 :: { LHsExpr RdrName } {% checkPattern empty $2 >>= \ p -> checkCommand $4 >>= \ cmd -> return (LL $ HsProc p (LL $ HsCmdTop cmd placeHolderType - placeHolderType undefined)) } + placeHolderType [])) } -- TODO: is LL right here? | '{-# CORE' STRING '#-}' exp { LL $ HsCoreAnn (getSTRING $2) $4 } @@ -1603,9 +1613,12 @@ aexp2 :: { LHsExpr RdrName } | literal { L1 (HsLit $! unLoc $1) } -- This will enable overloaded strings permanently. Normally the renamer turns HsString -- into HsOverLit when -foverloaded-strings is on. --- | STRING { sL (getLoc $1) (HsOverLit $! mkHsIsString (getSTRING $1) placeHolderType) } - | INTEGER { sL (getLoc $1) (HsOverLit $! mkHsIntegral (getINTEGER $1) placeHolderType) } - | RATIONAL { sL (getLoc $1) (HsOverLit $! mkHsFractional (getRATIONAL $1) placeHolderType) } +-- | STRING { sL (getLoc $1) (HsOverLit $! mkHsIsString +-- (getSTRING $1) placeHolderType) } + | INTEGER { sL (getLoc $1) (HsOverLit $! mkHsIntegral + (getINTEGER $1) placeHolderType) } + | RATIONAL { sL (getLoc $1) (HsOverLit $! mkHsFractional + (getRATIONAL $1) placeHolderType) } -- N.B.: sections get parsed by these next two productions. -- This allows you to write, e.g., '(+ 3, 4 -)', which isn't @@ -1655,7 +1668,8 @@ cmdargs :: { [LHsCmdTop RdrName] } acmd :: { LHsCmdTop RdrName } : aexp2 {% checkCommand $1 >>= \ cmd -> - return (L1 $ HsCmdTop cmd placeHolderType placeHolderType undefined) } + return (L1 $ HsCmdTop cmd + placeHolderType placeHolderType []) } cvtopbody :: { [LHsDecl RdrName] } : '{' cvtopdecls0 '}' { $2 } @@ -1713,8 +1727,9 @@ tup_tail :: { [HsTupArg RdrName] } -- avoiding another shift/reduce-conflict. list :: { LHsExpr RdrName } - : texp { L1 $ ExplicitList placeHolderType Nothing [$1] } - | lexps { L1 $ ExplicitList placeHolderType Nothing (reverse (unLoc $1)) } + : texp { L1 $ ExplicitList placeHolderType Nothing [$1] } + | lexps { L1 $ ExplicitList placeHolderType Nothing + (reverse (unLoc $1)) } | texp '..' { LL $ ArithSeq noPostTcExpr Nothing (From $1) } | texp ',' exp '..' { LL $ ArithSeq noPostTcExpr Nothing (FromThen $1 $3) } | texp '..' exp { LL $ ArithSeq noPostTcExpr Nothing (FromTo $1 $3) } @@ -1737,7 +1752,8 @@ flattenedpquals :: { Located [LStmt RdrName (LHsExpr RdrName)] } -- We just had one thing in our "parallel" list so -- we simply return that thing directly - qss -> L1 [L1 $ ParStmt [ParStmtBlock qs undefined noSyntaxExpr | qs <- qss] + qss -> L1 [L1 $ ParStmt [ParStmtBlock qs [] noSyntaxExpr | + qs <- qss] noSyntaxExpr noSyntaxExpr] -- We actually found some actual parallel lists so -- we wrap them into as a ParStmt |