srcLocFile, -- return the file name part
srcLocLine, -- return the line part
srcLocCol, -- return the column part
-
+ pprDefnLoc,
SrcSpan, -- Abstract
noSrcSpan,
srcLocCol other = panic "srcLocCol: unknown col"
advanceSrcLoc :: SrcLoc -> Char -> SrcLoc
-advanceSrcLoc (SrcLoc f l c) '\t' = SrcLoc f l (tab c)
advanceSrcLoc (SrcLoc f l c) '\n' = SrcLoc f (l + 1) 0
advanceSrcLoc (SrcLoc f l c) _ = SrcLoc f l (c + 1)
advanceSrcLoc loc _ = loc -- Better than nothing
-
--- Advance to the next tab stop. Tabs are at column positions 0, 8, 16, etc.
-tab :: Int -> Int
-tab c = (c `quot` 8 + 1) * 8
\end{code}
%************************************************************************
hcat [text "{-# LINE ", int src_line, space,
char '\"', ftext src_path, text " #-}"]
- ppr (ImportedLoc mod) = ptext SLIT("Imported from") <+> quotes (text mod)
+ ppr (ImportedLoc mod) = ptext SLIT("Imported from") <+> text mod
ppr (UnhelpfulLoc s) = ftext s
\end{code}
col2 = srcSpanEndCol end
file = srcSpanFile start
+pprDefnLoc :: SrcLoc -> SDoc
+-- "defined at ..." or "imported from ..."
+pprDefnLoc loc
+ | isGoodSrcLoc loc = ptext SLIT("Defined at") <+> ppr loc
+ | otherwise = ppr loc
+
instance Outputable SrcSpan where
ppr span
= getPprStyle $ \ sty ->
fmap f (L l e) = L l (f e)
instance Outputable e => Outputable (Located e) where
- ppr (L span e) = ppr e
+ ppr (L span e) = ppr e
-- do we want to dump the span in debugSty mode?
\end{code}