-- ** Constructing Located
noLoc,
+ mkGeneralLocated,
-- ** Deconstructing Located
getLoc, unLoc,
import Util
import Outputable
import FastString
-import System.FilePath
\end{code}
%************************************************************************
= (s1 `compare` s2) `thenCmp` (l1 `compare` l2) `thenCmp` (c1 `compare` c2)
cmpSrcLoc (SrcLoc _ _ _) _other = GT
-pprFastFilePath :: FastString -> SDoc
-pprFastFilePath path = text $ normalise $ unpackFS path
-
instance Outputable SrcLoc where
ppr (SrcLoc src_path src_line src_col)
= getPprStyle $ \ sty ->
isGoodSrcSpan _ = False
isOneLineSpan :: SrcSpan -> Bool
--- ^ True if the span is known to straddle more than one line.
+-- ^ True if the span is known to straddle only one line.
-- For "bad" 'SrcSpan', it returns False
isOneLineSpan s
| isGoodSrcSpan s = srcSpanStartLine s == srcSpanEndLine s
noLoc :: e -> Located e
noLoc e = L noSrcSpan e
+mkGeneralLocated :: String -> e -> Located e
+mkGeneralLocated s e = L (mkGeneralSrcSpan (fsLit s)) e
+
combineLocs :: Located a -> Located b -> SrcSpan
combineLocs a b = combineSrcSpans (getLoc a) (getLoc b)