summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser.y
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-04-01 21:51:17 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-23 18:53:50 -0400
commitf8c6fce4a09762adea6009540e523c2b984b2978 (patch)
treefb0898eadf884f4320e5a05f783f6308663350e9 /compiler/GHC/Parser.y
parentd82d38239f232c3970a8641bb6d47d436e3cbc11 (diff)
downloadhaskell-f8c6fce4a09762adea6009540e523c2b984b2978.tar.gz
HsToken for HsPar, ParPat, HsCmdPar (#19523)
This patch is a first step towards a simpler design for exact printing.
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r--compiler/GHC/Parser.y5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index 1848b6b1df..c89079ca70 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -2880,7 +2880,7 @@ aexp2 :: { ECP }
-- but the less cluttered version fell out of having texps.
| '(' texp ')' { ECP $
unECP $2 >>= \ $2 ->
- mkHsParPV (comb2 $1 $>) $2 (AnnParen AnnParens (glAA $1) (glAA $3)) }
+ mkHsParPV (comb2 $1 $>) (hsTok $1) $2 (hsTok $3) }
| '(' tup_exprs ')' { ECP $
$2 >>= \ $2 ->
mkSumOrTuplePV (noAnnSrcSpan $ comb2 $1 $>) Boxed $2
@@ -4343,6 +4343,9 @@ listAsAnchor :: [LocatedAn t a] -> Anchor
listAsAnchor [] = spanAsAnchor noSrcSpan
listAsAnchor (L l _:_) = spanAsAnchor (locA l)
+hsTok :: Located Token -> LHsToken tok GhcPs
+hsTok (L l _) = L (EpAnn (Anchor (realSrcSpan l) UnchangedAnchor) NoEpAnns emptyComments) HsTok
+
-- -------------------------------------
addTrailingCommaFBind :: MonadP m => Fbind b -> SrcSpan -> m (Fbind b)