diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2020-10-04 20:46:41 +0100 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2020-10-20 08:35:34 +0100 |
commit | ea736839d85594c95490dcf02d3325c2bbc68f33 (patch) | |
tree | 6f6c0335e216f67b63caf9e4a46d3e5bb6e852af /compiler/GHC/Parser | |
parent | 59b08a5d192e102f66a6d9260cc8466d7428cffe (diff) | |
download | haskell-wip/az/unicode-hsscaled.tar.gz |
API Annotations: Keep track of unicode for linear arrow notationwip/az/unicode-hsscaled
The linear arrow can be parsed as `%1 ->` or a direct single token unicode
equivalent.
Make sure that this distinction is captured in the parsed AST by using
IsUnicodeSyntax where it appears, and introduce a new API Annotation,
AnnMult to represent its location when unicode is not used.
Updated haddock submodule
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r-- | compiler/GHC/Parser/Annotation.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess/Haddock.hs | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs index 0cbf44296f..a3cbc92308 100644 --- a/compiler/GHC/Parser/Annotation.hs +++ b/compiler/GHC/Parser/Annotation.hs @@ -301,6 +301,7 @@ data AnnKeywordId | AnnMdo | AnnMinus -- ^ '-' | AnnModule + | AnnMult -- ^ '%1' | AnnNewtype | AnnName -- ^ where a name loses its location in the AST, this carries it | AnnOf diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index ed11a4df18..4812486d19 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -2617,9 +2617,9 @@ mkLHsOpTy x op y = let loc = getLoc x `combineSrcSpans` getLoc op `combineSrcSpans` getLoc y in L loc (mkHsOpTy x op y) -mkMultTy :: LHsType GhcPs -> HsArrow GhcPs -mkMultTy (L _ (HsTyLit _ (HsNumTy _ 1))) = HsLinearArrow -mkMultTy t = HsExplicitMult t +mkMultTy :: IsUnicodeSyntax -> LHsType GhcPs -> HsArrow GhcPs +mkMultTy u (L _ (HsTyLit _ (HsNumTy _ 1))) = HsLinearArrow u +mkMultTy u t = HsExplicitMult u t ----------------------------------------------------------------------------- -- Token symbols diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 849e2acdea..7959db5a7c 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -980,10 +980,10 @@ instance HasHaddock (Located (HsType GhcPs)) where pure $ L l (HsQualTy noExtField lhs rhs') -- arg -> res - HsFunTy _ mult lhs rhs -> do + HsFunTy u mult lhs rhs -> do lhs' <- addHaddock lhs rhs' <- addHaddock rhs - pure $ L l (HsFunTy noExtField mult lhs' rhs') + pure $ L l (HsFunTy u mult lhs' rhs') -- other types _ -> liftHdkA $ do |