haskell-src-exts-1.17.0: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Copyright(c) Niklas Broberg 2009
LicenseBSD-style (see the file LICENSE.txt)
MaintainerNiklas Broberg, d00nibro@chalmers.se
Stabilitystable
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Language.Haskell.Exts.SrcLoc

Description

This module defines various data types representing source location information, of varying degree of preciseness.

Synopsis

Documentation

data SrcSpan Source

A portion of the source, spanning one or more lines and zero or more columns.

mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan Source

Combine two locations in the source to denote a span.

mergeSrcSpan :: SrcSpan -> SrcSpan -> SrcSpan Source

Merge two source spans into a single span from the start of the first to the end of the second. Assumes that the two spans relate to the same source file.

isNullSpan :: SrcSpan -> Bool Source

Test if a given span starts and ends at the same location.

data Loc a Source

An entity located in the source.

Constructors

Loc 

Fields

loc :: SrcSpan
 
unLoc :: a
 

Instances

Eq a => Eq (Loc a) Source 
Ord a => Ord (Loc a) Source 
Show a => Show (Loc a) Source 

noInfoSpan :: SrcSpan -> SrcSpanInfo Source

Generate a SrcSpanInfo with no positional information for entities.

infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfo Source

Generate a SrcSpanInfo with the supplied positional information for entities.

combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo Source

Combine two SrcSpanInfos into one that spans the combined source area of the two arguments, leaving positional information blank.

combSpanMaybe :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo Source

Like '(+?)', but it also concatenates the srcInfoPoints.

(<+?>) :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo infixl 4 Source

Optionally combine the first argument with the second, or return it unchanged if the second argument is Nothing.

(<?+>) :: Maybe SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo infixl 4 Source

Optionally combine the second argument with the first, or return it unchanged if the first argument is Nothing.

(<**) :: SrcSpanInfo -> [SrcSpan] -> SrcSpanInfo infixl 4 Source

Add more positional information for entities of a span.

(<^^>) :: SrcSpan -> SrcSpan -> SrcSpanInfo infixl 6 Source

Merge two SrcSpans and lift them to a SrcInfoSpan with no positional information for entities.

class SrcInfo si where Source

A class to work over all kinds of source location information.

Minimal complete definition

toSrcInfo, fromSrcInfo, fileName, startLine, startColumn