cpphs

PortabilityAll
Stabilityexperimental
MaintainerMalcolm Wallace <Malcolm.Wallace@cs.york.ac.uk>
Safe HaskellSafe-Inferred

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

Eq Posn 
Show Posn 

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 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.