curry-frontend-2.0.0: Compile the functional logic language Curry to several intermediate formats
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 Source #

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

Ord Span Source # 
Instance details

Defined in Curry.Base.Span

Read Span Source # 
Instance details

Defined in Curry.Base.Span

Show Span Source # 
Instance details

Defined in Curry.Base.Span

Binary Span Source # 
Instance details

Defined in Curry.Base.Span

Pretty Span Source # 
Instance details

Defined in Curry.Base.Span

HasPosition Span Source # 
Instance details

Defined in Curry.Base.Span

ppSpan :: Span -> Doc Source #

Pretty print a Span

ppCompactSpan :: Span -> Doc Source #

Pretty print a span with it's file path and position compactly.

ppSpanPreview :: Span -> IO Doc Source #

Pretty print a source preview of a span

ppCompactPositions :: Span -> Doc Source #

Pretty print the positions compactly.

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

pos2Span :: Position -> Span Source #

Convert a position to a single character span.

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