curry-base-1.1.1: Functions for manipulating Curry programs
Copyright(c) 2016 Jan Tikovsky
2016 Finn Teegen
LicenseBSD-3-clause
Maintainerjrt@informatik.uni-kiel.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Curry.Base.Span

Description

This module implements a data type for span information in a source file and respective functions to operate on them. A source file span consists of a filename, a start position and an end position.

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

Documentation

data Span Source #

Constructors

Span

Normal source code span

Fields

NoSpan

no span

Instances

Instances details
Eq Span Source # 
Instance details

Defined in Curry.Base.Span

Methods

(==) :: Span -> Span -> Bool

(/=) :: Span -> Span -> Bool

Ord Span Source # 
Instance details

Defined in Curry.Base.Span

Methods

compare :: Span -> Span -> Ordering

(<) :: Span -> Span -> Bool

(<=) :: Span -> Span -> Bool

(>) :: Span -> Span -> Bool

(>=) :: Span -> Span -> Bool

max :: Span -> Span -> Span

min :: Span -> Span -> Span

Read Span Source # 
Instance details

Defined in Curry.Base.Span

Methods

readsPrec :: Int -> ReadS Span

readList :: ReadS [Span]

readPrec :: ReadPrec Span

readListPrec :: ReadPrec [Span]

Show Span Source # 
Instance details

Defined in Curry.Base.Span

Methods

showsPrec :: Int -> Span -> ShowS

show :: Span -> String

showList :: [Span] -> ShowS

Pretty Span Source # 
Instance details

Defined in Curry.Base.Span

Methods

pPrint :: Span -> Doc Source #

pPrintPrec :: Int -> Span -> Doc Source #

pPrintList :: [Span] -> Doc Source #

HasPosition Span Source # 
Instance details

Defined in Curry.Base.Span

showSpan :: Span -> String Source #

Show a Span as a String

ppSpan :: Span -> Doc Source #

Pretty print a Span

ppPositions :: Span -> Doc Source #

Pretty print the start and end position of a Span

startCol :: Span -> Int Source #

Compute the column of the start position of a Span

incrSpan :: Span -> Int -> Span Source #

span2Pos :: Span -> Position Source #

Convert a span to a (start) position TODO: This function should be removed as soon as positions are completely replaced by spans in the frontend

tabSpan :: Span -> Span Source #

First position after the next tabulator

nlSpan :: Span -> Span Source #

First position of the next line

addSpan :: Span -> (a, [Span]) -> (a, [Span]) Source #

type Distance = (Int, Int) Source #

Distance of a span, i.e. the line and column distance between start and end position

setDistance :: Span -> Distance -> Span Source #

Set the distance of a span, i.e. update its end position

moveBy :: Position -> Distance -> Position Source #

Move position by given distance