summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-03-25 21:38:13 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-31 11:13:28 -0400
commitd03005e642710d0f1f78757292e0fe65287e5f0a (patch)
tree2bd2c11a00577649ac19ddc6aa9705efa19bc8e5 /compiler/GHC/Parser
parent0fe5175ac537c0ce2afe969ec82a0d1c73a4ae38 (diff)
downloadhaskell-d03005e642710d0f1f78757292e0fe65287e5f0a.tar.gz
EPA : rename 'api annotations' to 'exact print annotations'
In comments, and notes. Follow-up from !2418, see #19579
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r--compiler/GHC/Parser/Annotation.hs26
-rw-r--r--compiler/GHC/Parser/Lexer.x2
-rw-r--r--compiler/GHC/Parser/PostProcess.hs6
3 files changed, 17 insertions, 17 deletions
diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs
index 6acb712833..23b0864246 100644
--- a/compiler/GHC/Parser/Annotation.hs
+++ b/compiler/GHC/Parser/Annotation.hs
@@ -57,9 +57,9 @@ module GHC.Parser.Annotation (
-- ** Querying annotations
getLocAnn,
- apiAnnAnns, apiAnnAnnsL,
+ epAnnAnns, epAnnAnnsL,
annParen2AddEpAnn,
- apiAnnComments,
+ epAnnComments,
-- ** Working with locations of annotations
sortLocatedA,
@@ -95,7 +95,7 @@ import GHC.Utils.Outputable hiding ( (<>) )
import GHC.Utils.Panic
{-
-Note [Api annotations]
+Note [exact print annotations]
~~~~~~~~~~~~~~~~~~~~~~
Given a parse tree of a Haskell module, how can we reconstruct
the original Haskell source code, retaining all whitespace and
@@ -195,7 +195,7 @@ https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations
--
-- Note: in general the names of these are taken from the
-- corresponding token, unless otherwise noted
--- See note [Api annotations] above for details of the usage
+-- See note [exact print annotations] above for details of the usage
data AnnKeywordId
= AnnAnyclass
| AnnAs
@@ -967,13 +967,13 @@ widenAnchorR (Anchor s op) r = Anchor (combineRealSrcSpans s r) op
widenLocatedAn :: SrcSpanAnn' an -> [AddEpAnn] -> SrcSpanAnn' an
widenLocatedAn (SrcSpanAnn a l) as = SrcSpanAnn a (widenSpan l as)
-apiAnnAnnsL :: EpAnn' a -> [a]
-apiAnnAnnsL EpAnnNotUsed = []
-apiAnnAnnsL (EpAnn _ anns _) = [anns]
+epAnnAnnsL :: EpAnn' a -> [a]
+epAnnAnnsL EpAnnNotUsed = []
+epAnnAnnsL (EpAnn _ anns _) = [anns]
-apiAnnAnns :: EpAnn -> [AddEpAnn]
-apiAnnAnns EpAnnNotUsed = []
-apiAnnAnns (EpAnn _ anns _) = anns
+epAnnAnns :: EpAnn -> [AddEpAnn]
+epAnnAnns EpAnnNotUsed = []
+epAnnAnns (EpAnn _ anns _) = anns
annParen2AddEpAnn :: EpAnn' AnnParen -> [AddEpAnn]
annParen2AddEpAnn EpAnnNotUsed = []
@@ -982,9 +982,9 @@ annParen2AddEpAnn (EpAnn _ (AnnParen pt o c) _)
where
(ai,ac) = parenTypeKws pt
-apiAnnComments :: EpAnn' an -> EpAnnComments
-apiAnnComments EpAnnNotUsed = AnnComments []
-apiAnnComments (EpAnn _ _ cs) = cs
+epAnnComments :: EpAnn' an -> EpAnnComments
+epAnnComments EpAnnNotUsed = AnnComments []
+epAnnComments (EpAnn _ _ cs) = cs
-- ---------------------------------------------------------------------
-- sortLocatedA :: [LocatedA a] -> [LocatedA a]
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index 125e6aaaf6..be99757176 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -2346,7 +2346,7 @@ data PState = PState {
-- The next three are used to implement Annotations giving the
-- locations of 'noise' tokens in the source, so that users of
-- the GHC API can do source to source conversions.
- -- See note [Api annotations] in GHC.Parser.Annotation
+ -- See note [exact print annotations] in GHC.Parser.Annotation
eof_pos :: Maybe (RealSrcSpan, RealSrcSpan), -- pos, gap to prior token
header_comments :: Maybe [LAnnotationComment],
comment_q :: [LAnnotationComment],
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs
index d6248bd107..18881dbe4c 100644
--- a/compiler/GHC/Parser/PostProcess.hs
+++ b/compiler/GHC/Parser/PostProcess.hs
@@ -713,7 +713,7 @@ mkGadtDecl loc names ty annsIn = do
= let
an' = addTrailingAnnToL (locA loc') (anns af) (comments af) an
in ( RecConGADT (L (SrcSpanAnn an' (locA loc')) rf), res_ty
- , [], apiAnnComments (ann ll))
+ , [], epAnnComments (ann ll))
| otherwise
= let (anns, cs, arg_types, res_type) = splitHsFunType body_ty
in (PrefixConGADT arg_types, res_type, anns, cs)
@@ -839,7 +839,7 @@ checkTyVars pp_what equals_or_where tc tparms
chkParens :: [AddEpAnn] -> EpAnnComments -> LHsType GhcPs
-> P (LHsTyVarBndr () GhcPs, [AddEpAnn])
chkParens acc cs (L l (HsParTy an ty))
- = chkParens (mkParensEpAnn (locA l) ++ acc) (cs Semi.<> apiAnnComments an) ty
+ = chkParens (mkParensEpAnn (locA l) ++ acc) (cs Semi.<> epAnnComments an) ty
chkParens acc cs ty = do
tv <- chk acc cs ty
return (tv, reverse acc)
@@ -1329,7 +1329,7 @@ addUnpackednessP (L lprag (UnpackednessPragma anns prag unpk)) ty = do
-- Otherwise, wrap the type in a new HsBangTy constructor.
addUnpackedness an (L _ (HsBangTy x bang t))
| HsSrcBang NoSourceText NoSrcUnpack strictness <- bang
- = HsBangTy (addAnns an (apiAnnAnns x) (apiAnnComments x)) (HsSrcBang prag unpk strictness) t
+ = HsBangTy (addAnns an (epAnnAnns x) (epAnnComments x)) (HsSrcBang prag unpk strictness) t
addUnpackedness an t
= HsBangTy an (HsSrcBang prag unpk NoSrcStrict) t