Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 8539b8f

Browse files
committed
Highlight raise.
1 parent 6843707 commit 8539b8f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

semantic-analysis/src/Analysis/Analysis/Exception.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ exceptionsForLine l e = Set.filter (\ ex -> IntSet.member l (exceptionLines ex))
106106

107107
printExcSet :: Source.Source -> ExcSet -> IO ()
108108
printExcSet src e = for_ (zip [0..] (Source.lines src)) $ \ (i, line) -> do
109-
Text.putStr (Text.pack "\ESC[37;1m" <> Text.dropWhileEnd (== '\n') (Source.toText line) <> Text.pack "\ESC[0m")
109+
Text.putStr (Text.pack "\ESC[37;1m" <> raise (Text.dropWhileEnd (== '\n') (Source.toText line)) <> Text.pack "\ESC[0m")
110110
let es = exceptionsForLine i e
111111
fvs = freeVariablesForLine i e
112112
unless (null es && null fvs) $ do
@@ -116,6 +116,8 @@ printExcSet src e = for_ (zip [0..] (Source.lines src)) $ \ (i, line) -> do
116116
<> formatExceptions es ) <> Text.pack "}\ESC[0m")
117117
Text.putStrLn mempty
118118
where
119+
keyword k s = Text.intercalate (Text.pack "\ESC[34;1m" <> k <> Text.pack "\ESC[0m") (Text.splitOn k s)
120+
raise = keyword (Text.pack "raise")
119121
union = Text.intercalate (Text.pack ", ")
120122
formatFreeVariables fvs = map (\ fv -> Text.pack "?" <> formatName (freeVariableName fv)) (Set.toList fvs)
121123
formatExceptions excs = map (Text.pack . show . formatName . exceptionName) (Set.toList excs)

0 commit comments

Comments
 (0)