language-boogie-0.2: Interpreter and language infrastructure for Boogie.

Safe HaskellSafe-Inferred



Utility for attaching source code positions to AST nodes



data Pos a Source

Anything with a source position attached




position :: SourcePos
node :: a


Functor Pos 
Eq a => Eq (Pos a) 
Show a => Show (Pos a) 

data SourcePos

The abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.

sourceLine :: SourcePos -> Line

Extracts the line number from a source position.

sourceColumn :: SourcePos -> Column

Extracts the column number from a source position.

sourceName :: SourcePos -> SourceName

Extracts the name of the source from a source position.

noPos :: SourcePosSource

Dummy source position

attachPos :: SourcePos -> a -> Pos aSource

Attach position to a node

gen :: a -> Pos aSource

Attach dummy position to a node

attachPosBefore :: Parser a -> Parser (Pos a)Source

attachPosBefore p : parser that behaves like p, but also attaches the source position before the first token it parsed to the result

inheritPos :: (Pos a -> b) -> Pos a -> Pos bSource

inheritPos f a : apply f to a and attach a's position to the result

inheritPos2 :: (Pos a -> Pos b -> c) -> Pos a -> Pos b -> Pos cSource

inheritPos2 f a b : apply f to a and b and attach a's position to the result