[Git][ghc/ghc][wip/az/anns-1] ApiAnnotations; tweaks for ghc-exactprint update
Alan Zimmerman
gitlab at gitlab.haskell.org
Thu Aug 6 12:35:38 UTC 2020
Alan Zimmerman pushed to branch wip/az/anns-1 at Glasgow Haskell Compiler / GHC
Commits:
40d366d1 by Alan Zimmerman at 2020-08-06T13:34:01+01:00
ApiAnnotations; tweaks for ghc-exactprint update
Remove unused ApiAnns, add one for linear arrow.
Include API Annotations for trailing comma in export list.
- - - - -
4 changed files:
- compiler/GHC.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- utils/check-api-annotations/Main.hs
Changes:
=====================================
compiler/GHC.hs
=====================================
@@ -248,7 +248,7 @@ module GHC (
srcSpanStartCol, srcSpanEndCol,
-- ** Located
- GenLocated(..), Located,
+ GenLocated(..), Located, RealLocated,
-- *** Constructing Located
noLoc, mkGeneralLocated,
@@ -274,7 +274,7 @@ module GHC (
parser,
-- * API Annotations
- ApiAnns(..),AnnKeywordId(..),AnnotationComment(..),
+ ApiAnns(..),AnnKeywordId(..),AnnotationComment(..), ApiAnnKey,
getAnnotation, getAndRemoveAnnotation,
getAnnotationComments, getAndRemoveAnnotationComments,
unicodeAnn,
=====================================
compiler/GHC/Parser.y
=====================================
@@ -863,17 +863,17 @@ header_top_importdecls :: { [LImportDecl GhcPs] }
-- The Export List
maybeexports :: { (Maybe (Located [LIE GhcPs])) }
- : '(' exportlist ')' {% amsL (comb2 $1 $>) [mop $1,mcp $3] >>
- return (Just (sLL $1 $> (fromOL $2))) }
+ : '(' exportlist ')' {% amsL (comb2 $1 $>) ([mop $1,mcp $3] ++ (fst $2)) >>
+ return (Just (sLL $1 $> (fromOL $ snd $2))) }
| {- empty -} { Nothing }
-exportlist :: { OrdList (LIE GhcPs) }
- : exportlist1 { $1 }
- | {- empty -} { nilOL }
+exportlist :: { ([AddAnn], OrdList (LIE GhcPs)) }
+ : exportlist1 { ([], $1) }
+ | {- empty -} { ([], nilOL) }
-- trailing comma:
- | exportlist1 ',' { $1 }
- | ',' { nilOL }
+ | exportlist1 ',' { ([mj AnnComma $2], $1) }
+ | ',' { ([mj AnnComma $1], nilOL) }
exportlist1 :: { OrdList (LIE GhcPs) }
: exportlist1 ',' export
@@ -1019,11 +1019,11 @@ maybeimpspec :: { Located (Maybe (Bool, Located [LIE GhcPs])) }
impspec :: { Located (Bool, Located [LIE GhcPs]) }
: '(' exportlist ')' {% ams (sLL $1 $> (False,
- sLL $1 $> $ fromOL $2))
- [mop $1,mcp $3] }
+ sLL $1 $> $ fromOL (snd $2)))
+ ([mop $1,mcp $3] ++ (fst $2)) }
| 'hiding' '(' exportlist ')' {% ams (sLL $1 $> (True,
- sLL $1 $> $ fromOL $3))
- [mj AnnHiding $1,mop $2,mcp $4] }
+ sLL $1 $> $ fromOL (snd $3)))
+ ([mj AnnHiding $1,mop $2,mcp $4] ++ (fst $3)) }
-----------------------------------------------------------------------------
-- Fixity Declarations
=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -259,6 +259,8 @@ data AnnKeywordId
| AnnLarrow -- ^ '<-'
| AnnLarrowU -- ^ '<-', unicode variant
| AnnLet
+ | AnnLolly -- ^ '#->'
+ | AnnLollyU -- ^ '#->', unicode variant
| AnnMdo
| AnnMinus -- ^ '-'
| AnnModule
@@ -291,8 +293,6 @@ data AnnKeywordId
| AnnStatic -- ^ 'static'
| AnnStock
| AnnThen
- | AnnThIdSplice -- ^ '$'
- | AnnThIdTySplice -- ^ '$$'
| AnnThTyQuote -- ^ double '''
| AnnTilde -- ^ '~'
| AnnType
@@ -364,6 +364,7 @@ unicodeAnn AnnOpenB = AnnOpenBU
unicodeAnn AnnCloseB = AnnCloseBU
unicodeAnn AnnOpenEQ = AnnOpenEQU
unicodeAnn AnnCloseQ = AnnCloseQU
+unicodeAnn AnnLolly = AnnLollyU
unicodeAnn ann = ann
=====================================
utils/check-api-annotations/Main.hs
=====================================
@@ -5,7 +5,6 @@ import Data.List
import GHC
import GHC.Driver.Session
import GHC.Utils.Outputable
-import GHC.Parser.Annotation
import GHC.Types.SrcLoc
import System.Environment( getArgs )
import System.Exit
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/40d366d17d358866e3900170ac9b2e7dcc3530be
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/40d366d17d358866e3900170ac9b2e7dcc3530be
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200806/aeb3d288/attachment-0001.html>
More information about the ghc-commits
mailing list