language-c-0.3.2.1: Analysis and generation of C code

Portabilityghc
Stabilityexperimental
Maintainerbenedikt.huber@gmail.com

Language.C.Data.Position

Description

Source code position

Synopsis

Documentation

data Position Source

uniform representation of source file positions; the order of the arguments is important as it leads to the desired ordering of source positions

Constructors

Position String !Int !Int 

initPos :: FilePath -> PositionSource

initialize a Position to the start of the translation unit starting in the given file

posFile :: Position -> StringSource

get the source file of the specified position. Fails unless isSourcePos pos.

posRow :: Position -> IntSource

get the line number of the specified position. Fails unless isSourcePos pos

posColumn :: Position -> IntSource

get the column of the specified position. Fails unless isSourcePos pos

isSourcePos :: Position -> BoolSource

returns True if the given position refers to an actual source file

nopos :: PositionSource

no position (for unknown position information)

builtinPos :: PositionSource

position attached to built-in objects

isBuiltinPos :: Position -> BoolSource

returns True if the given position refers to a builtin definition

internalPos :: PositionSource

position used for internal errors

isInternalPos :: Position -> BoolSource

returns True if the given position is internal

incPos :: Position -> Int -> PositionSource

advance column

tabPos :: Position -> PositionSource

advance column to next tab positions (tabs are considered to be at every 8th column)

retPos :: Position -> PositionSource

advance to next line

adjustPos :: FilePath -> Int -> Position -> PositionSource

adjust position: change file and line number, reseting column to 1. This is usually used for #LINE pragmas.