ivory-0.1.0.3: Safe embedded C programming.

Safe HaskellSafe
LanguageHaskell2010

Ivory.Language.Syntax.Concrete.Location

Synopsis

Documentation

data Located a Source

Things that carry a range in the source syntax.

Constructors

Located 

Fields

locRange :: !SrcLoc
 
locValue :: a
 

noLoc :: a -> Located a Source

Attach no location information to a value.

at :: HasLocation loc => a -> loc -> Located a Source

Attach location information to a value.

atBin :: (HasLocation loc0, HasLocation loc1) => a -> loc0 -> loc1 -> Located a Source

at helper for binary operators.

atList :: a -> [SrcLoc] -> Located a Source

at helper for list args.

unLoc :: Located a -> a Source

Strip off location information.

extendLoc :: SrcLoc -> Located a -> Located a Source

Extend the range of a located thing.

type Source = Maybe String Source

Source locations.

srcLoclinePragma :: SrcLoc -> Maybe (Int, String) Source

Get info to build a line pragma from a SrcLoc. Returns a value only if there is a valid range. Returns the starting line number.

srcStart :: SrcLoc -> Position Source

Starting Position of a SrcLoc.

srcEnd :: SrcLoc -> Position Source

Ending Position of a SrcLoc.

data Range Source

The region between to source positions.

Constructors

Range 

data Position Source

Position information within a source.

Constructors

Position 

Fields

posOff :: !Int
 
posLine :: !Int
 
posCol :: !Int
 

Instances

Eq Position Source 
Ord Position Source

This only compares offset, assuming that the positions come from the same source.

Read Position Source 
Show Position Source 
Pretty Position Source 

zeroPosition :: Position Source

Starting position.

smallerOf :: Position -> Position -> Position Source

Return smaller of the two positions, taking care to not allow the zero position to dominate.

largerOf :: Position -> Position -> Position Source

Return the larger of the two positions.

movePos :: Position -> Char -> Position Source

Given a character, increment a position.

movesPos :: Position -> String -> Position Source

Move many characters at once.