summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r--compiler/GHC/Parser.y19
1 files changed, 12 insertions, 7 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index 483fb06e97..f9a4d10a4d 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -2679,9 +2679,9 @@ exp10 :: { ECP }
-- See Note [%shift: exp10 -> fexp]
| fexp %shift { $1 }
-optSemi :: { ([Located Token],Bool) }
- : ';' { ([$1],True) }
- | {- empty -} { ([],False) }
+optSemi :: { (Maybe EpaLocation,Bool) }
+ : ';' { (msemim $1,True) }
+ | {- empty -} { (Nothing,False) }
{- Note [Pragmas and operator fixity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2801,10 +2801,12 @@ aexp :: { ECP }
unECP $5 >>= \ $5 ->
unECP $8 >>= \ $8 ->
mkHsIfPV (comb2A $1 $>) $2 (snd $3) $5 (snd $6) $8
- (mj AnnIf $1:mj AnnThen $4
- :mj AnnElse $7
- :(concatMap (\l -> mz AnnSemi l) (fst $3))
- ++(concatMap (\l -> mz AnnSemi l) (fst $6))) }
+ (AnnsIf
+ { aiIf = glAA $1
+ , aiThen = glAA $4
+ , aiElse = glAA $7
+ , aiThenSemi = fst $3
+ , aiElseSemi = fst $6})}
| 'if' ifgdpats {% hintMultiWayIf (getLoc $1) >>= \_ ->
fmap ecpFromExp $
@@ -4161,6 +4163,9 @@ mz a l = if isZeroWidthSpan (gl l) then [] else [AddEpAnn a (EpaSpan $ rs $ gl l
msemi :: Located e -> [TrailingAnn]
msemi l = if isZeroWidthSpan (gl l) then [] else [AddSemiAnn (EpaSpan $ rs $ gl l)]
+msemim :: Located e -> Maybe EpaLocation
+msemim l = if isZeroWidthSpan (gl l) then Nothing else Just (EpaSpan $ rs $ gl l)
+
-- |Construct an AddEpAnn from the annotation keyword and the Located Token. If
-- the token has a unicode equivalent and this has been used, provide the
-- unicode variant of the annotation.