curry-base-0.4.2: Functions for manipulating Curry programs

Copyright(c) Wolfgang Lux
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilityexperimental
Portabilitynon-portable (DeriveDataTypeable)
Safe HaskellNone
LanguageHaskell2010

Curry.Base.Position

Contents

Description

This module implements a data type for positions in a source file and respective functions to operate on them. A source file position consists of a filename, a line number, and a column number. A tab stop is assumed at every eighth column.

In addition, the type SrcRef identifies the path to an expression in the abstract syntax tree by argument positions, which is used for debugging purposes.

Synopsis

Source code position

data Position Source #

Source code positions

Constructors

Position

Normal source code position

Fields

AST

Position in the abstract syntax tree

Fields

NoPos

no position

Instances

Eq Position Source # 
Data Position Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Position -> c Position #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Position #

toConstr :: Position -> Constr #

dataTypeOf :: Position -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Position) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Position) #

gmapT :: (forall b. Data b => b -> b) -> Position -> Position #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Position -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Position -> r #

gmapQ :: (forall d. Data d => d -> u) -> Position -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Position -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Position -> m Position #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Position -> m Position #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Position -> m Position #

Ord Position Source # 
Read Position Source # 
Show Position Source # 
Pretty Position Source # 
SrcRefOf Position Source # 
HasPosition Position Source # 

(@>) :: (HasPosition a, HasPosition b) => a -> b -> a Source #

x @> y returns x with the position obtained from y

ppPosition :: Position -> Doc Source #

Pretty print a Position

ppLine :: Position -> Doc Source #

Pretty print the line and column of a Position

showLine :: Position -> String Source #

Show the line and column of a Position

first :: FilePath -> Position Source #

Absolute first position of a file

next :: Position -> Position Source #

Next position to the right

incr :: Position -> Int -> Position Source #

Increment a position by a number of columns

tab :: Position -> Position Source #

First position after the next tabulator

tabWidth :: Int Source #

Number of spaces for a tabulator

nl :: Position -> Position Source #

First position of the next line

incPosition :: Position -> Int -> Position Source #

Increment the position in the abstract syntax tree

source reference

newtype SrcRef Source #

A pointer to the origin

Constructors

SrcRef [Int] 

Instances

Eq SrcRef Source # 

Methods

(==) :: SrcRef -> SrcRef -> Bool #

(/=) :: SrcRef -> SrcRef -> Bool #

Data SrcRef Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcRef -> c SrcRef #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcRef #

toConstr :: SrcRef -> Constr #

dataTypeOf :: SrcRef -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SrcRef) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcRef) #

gmapT :: (forall b. Data b => b -> b) -> SrcRef -> SrcRef #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcRef -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcRef -> r #

gmapQ :: (forall d. Data d => d -> u) -> SrcRef -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcRef -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcRef -> m SrcRef #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcRef -> m SrcRef #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcRef -> m SrcRef #

Ord SrcRef Source # 
Read SrcRef Source # 
Show SrcRef Source # 
Pretty SrcRef Source # 

srcRef :: Int -> SrcRef Source #

Create a source code reference

noRef :: SrcRef Source #

The empty source code reference

mk :: (SrcRef -> a) -> a Source #

Provide an empty SrcRef

mk' :: ([SrcRef] -> a) -> a Source #

Provide no SrcRefs

incSrcRef :: SrcRef -> Int -> SrcRef Source #

Increment a source code reference by a given number