summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-10-02 03:15:14 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-04 23:46:21 -0400
commita762933454f1dbecaa2048f810f6ab6bbfe3a93d (patch)
tree05d54919ee3e2ccddb1b4ddce580afee479b620d /utils
parenta0f44cebb217b3586d861750366301b973073dd1 (diff)
downloadhaskell-a762933454f1dbecaa2048f810f6ab6bbfe3a93d.tar.gz
Bespoke TokenLocation data type
The EpaAnnCO we were using contained an Anchor instead of EpaLocation, making it harder to work with. At the same time, using EpaLocation by itself isn't possible either, as we may have tokens without location information. Hence the new data type: data TokenLocation = NoTokenLoc | TokenLoc !EpaLocation
Diffstat (limited to 'utils')
-rw-r--r--utils/check-exact/ExactPrint.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index 16631d0bd2..583adc682f 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -627,11 +627,8 @@ markKwA :: AnnKeywordId -> EpaLocation -> EPP ()
markKwA kw aa = printStringAtAA aa (keywordToString (G kw))
markToken :: forall tok. KnownSymbol tok => LHsToken tok GhcPs -> EPP ()
-markToken (L EpAnnNotUsed _) = return ()
-markToken (L (EpAnn (Anchor a a_op) _ _) _) = printStringAtAA aa (symbolVal (Proxy @tok))
- where aa = case a_op of
- UnchangedAnchor -> EpaSpan a
- MovedAnchor dp -> EpaDelta dp
+markToken (L NoTokenLoc _) = return ()
+markToken (L (TokenLoc aa) _) = printStringAtAA aa (symbolVal (Proxy @tok))
markUniToken :: forall tok utok. (KnownSymbol tok, KnownSymbol utok) => LHsUniToken tok utok GhcPs -> EPP ()
markUniToken (L l HsNormalTok) = markToken (L l (HsTok @tok))