Portability | ghc |
---|---|
Stability | experimental |
Maintainer | bjpop@csse.unimelb.edu.au |
Source location information for the Python parser. XXX We will probably move to source spans at some point.
- class Location a where
- location :: a -> SrcLocation
- data SrcLocation
- = Sloc {
- sloc_filename :: String
- sloc_row :: !Int
- sloc_column :: !Int
- | NoLocation
- = Sloc {
- initialSrcLocation :: String -> SrcLocation
- incColumn :: Int -> SrcLocation -> SrcLocation
- incLine :: Int -> SrcLocation -> SrcLocation
- incTab :: SrcLocation -> SrcLocation
Projection of locations from values
Types which have a source location.
location :: a -> SrcLocationSource
Project the location from a value.
Construction
data SrcLocation Source
A location for a syntactic entity from the source code. The location is specified by its filename, and starting row and column.
Sloc | |
| |
NoLocation |
initialSrcLocation :: String -> SrcLocationSource
Construct the initial source location for a file.
Modification
incColumn :: Int -> SrcLocation -> SrcLocationSource
Increment the column of a location by one.
incLine :: Int -> SrcLocation -> SrcLocationSource
Increment the line number (row) of a location by one.
incTab :: SrcLocation -> SrcLocationSource
Increment the column of a location by one tab stop.