[Git][ghc/ghc][wip/az/epa-hslet-tokens] EPA: Last EpAnn in extension points

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Thu Dec 14 20:55:03 UTC 2023



Alan Zimmerman pushed to branch wip/az/epa-hslet-tokens at Glasgow Haskell Compiler / GHC


Commits:
a8d1288a by Alan Zimmerman at 2023-12-14T20:27:48+00:00
EPA: Last EpAnn in extension points

Leaving a few that are too tricky, maybe some other time.

- - - - -


3 changed files:

- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Parser.y
- utils/check-exact/ExactPrint.hs


Changes:

=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -427,7 +427,7 @@ instance NoAnn AnnsIf where
 
 -- ---------------------------------------------------------------------
 
-type instance XSCC           (GhcPass _) = (EpAnn AnnPragma, SourceText)
+type instance XSCC           (GhcPass _) = (AnnPragma, SourceText)
 type instance XXPragE        (GhcPass _) = DataConCantHappen
 
 type instance XCDotFieldOcc (GhcPass _) = AnnFieldLabel


=====================================
compiler/GHC/Parser.y
=====================================
@@ -2752,7 +2752,7 @@ exp_prag(e) :: { ECP }
   : prag_e e  -- See Note [Pragmas and operator fixity]
       {% runPV (unECP $2) >>= \ $2 ->
          fmap ecpFromExp $
-         return $ (sLLa $1 $> $ HsPragE noExtField (unLoc $1) $2) }
+         amsA' $ (sLL $1 $> $ HsPragE noExtField (unLoc $1) $2) }
 
 exp10 :: { ECP }
         -- See Note [%shift: exp10 -> '-' fexp]
@@ -2814,16 +2814,16 @@ may sound unnecessary, but it's actually needed to support a common idiom:
 -}
 prag_e :: { Located (HsPragE GhcPs) }
       : '{-# SCC' STRING '#-}'      {% do { scc <- getSCC $2
-                                          ; acs (\cs -> (sLL $1 $>
+                                          ; return (sLL $1 $>
                                              (HsPragSCC
-                                                ((EpAnn (glEE $1 $>) (AnnPragma (mo $1) (mc $3) [mj AnnValStr $2]) cs),
+                                                (AnnPragma (mo $1) (mc $3) [mj AnnValStr $2],
                                                 (getSCC_PRAGs $1))
-                                                (StringLiteral (getSTRINGs $2) scc Nothing))))} }
-      | '{-# SCC' VARID  '#-}'      {% acs (\cs -> (sLL $1 $>
+                                                (StringLiteral (getSTRINGs $2) scc Nothing)))} }
+      | '{-# SCC' VARID  '#-}'      { sLL $1 $>
                                              (HsPragSCC
-                                               ((EpAnn (glEE $1 $>) (AnnPragma (mo $1) (mc $3) [mj AnnVal $2]) cs),
+                                               (AnnPragma (mo $1) (mc $3) [mj AnnVal $2],
                                                (getSCC_PRAGs $1))
-                                               (StringLiteral NoSourceText (getVARID $2) Nothing)))) }
+                                               (StringLiteral NoSourceText (getVARID $2) Nothing)) }
 
 fexp    :: { ECP }
         : fexp aexp                  { ECP $


=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -3241,11 +3241,11 @@ instance ExactPrint (HsPragE GhcPs) where
   setAnnotationAnchor a _ _ _ = a
 
   exact (HsPragSCC (an,st) sl) = do
-    an0 <- markAnnOpenP an st "{-# SCC"
+    an0 <- markAnnOpenP' an st "{-# SCC"
     let txt = sourceTextToString (sl_st sl) (unpackFS $ sl_fs sl)
-    an1 <- markEpAnnLMS an0 lapr_rest AnnVal    (Just txt) -- optional
-    an2 <- markEpAnnLMS an1 lapr_rest AnnValStr (Just txt) -- optional
-    an3 <- markAnnCloseP an2
+    an1 <- markEpAnnLMS'' an0 lapr_rest AnnVal    (Just txt) -- optional
+    an2 <- markEpAnnLMS'' an1 lapr_rest AnnValStr (Just txt) -- optional
+    an3 <- markAnnCloseP' an2
     return (HsPragSCC (an3,st) sl)
 
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8d1288a56e59fa7f8b7c137449b9f965996cf14

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8d1288a56e59fa7f8b7c137449b9f965996cf14
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/20231214/a3cec280/attachment-0001.html>


More information about the ghc-commits mailing list