diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2017-02-27 11:43:01 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2017-02-27 11:46:52 +0200 |
commit | c0af206f26b97d8d4f1c5722825577b27087c0a9 (patch) | |
tree | 3796ca99b4f608a0d8d7d2d39b80b968337debed /compiler/parser | |
parent | 76f2cd02ab04818f19be1927c2a640dede3e9dd3 (diff) | |
download | haskell-c0af206f26b97d8d4f1c5722825577b27087c0a9.tar.gz |
Explicitly capture whether a splice has a dollar prefix
A top-level splice can be written
$splice
or
splice
For accurate pretty-printing, and for ghc-exactprint, capture in the hsSyn AST
which variant was parsed.
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Parser.y | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 721559f166..b590333c1f 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1876,7 +1876,7 @@ atype :: { LHsType RdrName } | quasiquote { sL1 $1 (HsSpliceTy (unLoc $1) placeHolderKind) } | '$(' exp ')' {% ams (sLL $1 $> $ mkHsSpliceTy HasParens $2) [mj AnnOpenPE $1,mj AnnCloseP $3] } - | TH_ID_SPLICE {%ams (sLL $1 $> $ mkHsSpliceTy NoParens $ sL1 $1 $ HsVar $ + | TH_ID_SPLICE {%ams (sLL $1 $> $ mkHsSpliceTy HasDollar $ sL1 $1 $ HsVar $ (sL1 $1 (mkUnqual varName (getTH_ID_SPLICE $1)))) [mj AnnThIdSplice $1] } -- see Note [Promotion] for the followings @@ -2540,13 +2540,13 @@ aexp2 :: { LHsExpr RdrName } [mu AnnOpenB $1,mu AnnCloseB $4] } splice_exp :: { LHsExpr RdrName } - : TH_ID_SPLICE {% ams (sL1 $1 $ mkHsSpliceE NoParens + : TH_ID_SPLICE {% ams (sL1 $1 $ mkHsSpliceE HasDollar (sL1 $1 $ HsVar (sL1 $1 (mkUnqual varName (getTH_ID_SPLICE $1))))) [mj AnnThIdSplice $1] } | '$(' exp ')' {% ams (sLL $1 $> $ mkHsSpliceE HasParens $2) [mj AnnOpenPE $1,mj AnnCloseP $3] } - | TH_ID_TY_SPLICE {% ams (sL1 $1 $ mkHsSpliceTE NoParens + | TH_ID_TY_SPLICE {% ams (sL1 $1 $ mkHsSpliceTE HasDollar (sL1 $1 $ HsVar (sL1 $1 (mkUnqual varName (getTH_ID_TY_SPLICE $1))))) [mj AnnThIdTySplice $1] } |