cpphs
Copyright2000-2004 Malcolm Wallace
LicenseLGPL
MaintainerMalcolm Wallace <Malcolm.Wallace@cs.york.ac.uk>
Stabilityexperimental
PortabilityAll
Safe HaskellSafe-Inferred
LanguageHaskell98

Language.Preprocessor.Cpphs.Position

Description

Simple file position information, with recursive inclusion points.

Synopsis

Documentation

data Posn #

Source positions contain a filename, line, column, and an inclusion point, which is itself another source position, recursively.

Constructors

Pn String !Int !Int (Maybe Posn) 

Instances

Instances details
Eq Posn # 
Instance details

Defined in Language.Preprocessor.Cpphs.Position

Methods

(==) :: Posn -> Posn -> Bool

(/=) :: Posn -> Posn -> Bool

Show Posn # 
Instance details

Defined in Language.Preprocessor.Cpphs.Position

Methods

showsPrec :: Int -> Posn -> ShowS

show :: Posn -> String

showList :: [Posn] -> ShowS

newfile :: String -> Posn #

Constructor. Argument is filename.

addcol :: Int -> Posn -> Posn #

Increment column number by given quantity.

newline :: Posn -> Posn #

Increment row number, reset column to 1.

tab :: Posn -> Posn #

Increment column number, tab stops are every 8 chars.

newlines :: Int -> Posn -> Posn #

Increment row number by given quantity.

newpos :: Int -> Maybe String -> Posn -> Posn #

Update position with a new row, and possible filename.

cppline :: Posn -> String #

cpp-style printing of file position

haskline :: Posn -> String #

haskell-style printing of file position

cpp2hask :: String -> String #

Conversion from a cpp-style "#line" to haskell-style pragma.

filename :: Posn -> String #

Project the filename.

lineno :: Posn -> Int #

Project the line number.

directory :: Posn -> FilePath #

Project the directory of the filename.

cleanPath :: FilePath -> FilePath #

Sigh. Mixing Windows filepaths with unix is bad. Make sure there is a canonical path separator.