summaryrefslogtreecommitdiff
path: root/compiler/parser/ApiAnnotation.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser/ApiAnnotation.hs')
-rw-r--r--compiler/parser/ApiAnnotation.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/compiler/parser/ApiAnnotation.hs b/compiler/parser/ApiAnnotation.hs
index 60f917222f..e8ad8ea879 100644
--- a/compiler/parser/ApiAnnotation.hs
+++ b/compiler/parser/ApiAnnotation.hs
@@ -17,9 +17,9 @@ import qualified Data.Map as Map
import Data.Data
-{- Note [Api annotations]
- ~~~~~~~~~~~~~~~~~~~~~~
-
+{-
+Note [Api annotations]
+~~~~~~~~~~~~~~~~~~~~~~
In order to do source to source conversions using the GHC API, the
locations of all elements of the original source needs to be tracked.
The includes keywords such as 'let' / 'in' / 'do' etc as well as
@@ -66,8 +66,8 @@ This is done in the lexer / parser as follows.
The PState variable in the lexer has the following variables added
-> annotations :: [(ApiAnnKey,SrcSpan)],
-> comment_q :: [Located Token],
+> annotations :: [(ApiAnnKey,[SrcSpan])],
+> comment_q :: [Located AnnotationComment],
> annotations_comments :: [(SrcSpan,[Located AnnotationComment])]
The first and last store the values that end up in the ApiAnns value
@@ -115,6 +115,9 @@ This adds an AnnLet annotation for 'let', an AnnIn for 'in', as well
as any annotations that may arise in the binds. This will include open
and closing braces if they are used to delimit the let expressions.
+The wiki page describing this feature is
+https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations
+
-}
-- ---------------------------------------------------------------------
@@ -173,6 +176,9 @@ getAndRemoveAnnotationComments (anns,canns) span =
-- Comments are only retained if @'Opt_KeepRawTokenStream'@ is set in
-- @'DynFlags.DynFlags'@ before parsing.
--
+-- The wiki page describing this feature is
+-- https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations
+--
-- 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