Copyright | (c) Harvard University 2006-2011 (c) Geoffrey Mainland 2011-2015 |
---|---|
License | BSD-style |
Maintainer | Geoffrey Mainland <mainland@cs.drexel.edu> |
Safe Haskell | None |
Language | Haskell98 |
- data Pos = Pos !FilePath !Int !Int !Int
- posFile :: Pos -> FilePath
- posLine :: Pos -> Int
- posCol :: Pos -> Int
- posCoff :: Pos -> Int
- startPos :: FilePath -> Pos
- linePos :: FilePath -> Int -> Pos
- advancePos :: Pos -> Char -> Pos
- displayPos :: Pos -> String
- displaySPos :: Pos -> ShowS
- data Loc
- locStart :: Loc -> Loc
- locEnd :: Loc -> Loc
- (<-->) :: (Located a, Located b) => a -> b -> Loc
- displayLoc :: Loc -> String
- displaySLoc :: Loc -> ShowS
- newtype SrcLoc = SrcLoc Loc
- srclocOf :: Located a => a -> SrcLoc
- srcspan :: (Located a, Located b) => a -> b -> SrcLoc
- class IsLocation a where
- noLoc :: IsLocation a => a
- class Located a where
- class Relocatable a where
- data L a = L Loc a
- unLoc :: L a -> a
Documentation
Position type.
linePos :: FilePath -> Int -> Pos Source #
Position corresponding to given file and line.
Note that the associated character offset is set to 0.
advancePos :: Pos -> Char -> Pos Source #
Advance a position by a single character. Newlines increment the line number, tabs increase the position column following a tab stop width of 8, and all other characters increase the position column by one. All characters, including newlines and tabs, increase the character offset by 1.
Note that advancePos
assumes UNIX-style newlines.
displayPos :: Pos -> String Source #
Format a position in a human-readable way, returning an ordinary
String
.
displaySPos :: Pos -> ShowS Source #
Format a position in a human-readable way.
Location type, consisting of a beginning position and an end position.
(<-->) :: (Located a, Located b) => a -> b -> Loc infixl 6 Source #
Merge the locations of two Located
values.
displayLoc :: Loc -> String Source #
Format a location in a human-readable way, returning an ordinary
String
.
displaySLoc :: Loc -> ShowS Source #
Format a location in a human-readable way.
Source location type. Source location are all equal, which allows AST nodes to be compared modulo location information.
class IsLocation a where Source #
Locations
noLoc :: IsLocation a => a Source #
No location.
A value of type L a
is a value of type a
with an associated Loc
, but
this location is ignored when performing comparisons.