language-python-0.2: Parsing and pretty printing of Python code.Source codeContentsIndex
Language.Python.Common.SrcLocation
Portabilityghc
Stabilityexperimental
Maintainerbjpop@csse.unimelb.edu.au
Contents
Construction
Modification
Projection of components of a span
Description
Source location information for the Python lexer and parser. This module provides single-point locations and spans, and conversions between them.
Synopsis
data SrcLocation
= Sloc {
sloc_filename :: !String
sloc_row :: !Int
sloc_column :: !Int
}
| NoLocation
data SrcSpan
= SpanCoLinear {
span_filename :: !String
span_row :: !Int
span_start_column :: !Int
span_end_column :: !Int
}
| SpanMultiLine {
span_filename :: !String
span_start_row :: !Int
span_start_column :: !Int
span_end_row :: !Int
span_end_column :: !Int
}
| SpanPoint {
span_filename :: !String
span_row :: !Int
span_column :: !Int
}
| SpanEmpty
class Span a where
getSpan :: a -> SrcSpan
spanning :: (Span a, Span b) => a -> b -> SrcSpan
mkSrcSpan :: SrcLocation -> SrcLocation -> SrcSpan
combineSrcSpans :: SrcSpan -> SrcSpan -> SrcSpan
initialSrcLocation :: String -> SrcLocation
spanStartPoint :: SrcSpan -> SrcSpan
incColumn :: Int -> SrcLocation -> SrcLocation
decColumn :: Int -> SrcLocation -> SrcLocation
incLine :: Int -> SrcLocation -> SrcLocation
incTab :: SrcLocation -> SrcLocation
endCol :: SrcSpan -> Int
endRow :: SrcSpan -> Int
startCol :: SrcSpan -> Int
startRow :: SrcSpan -> Int
Construction
data SrcLocation Source
A location for a syntactic entity from the source code. The location is specified by its filename, and starting row and column.
Constructors
Sloc
sloc_filename :: !String
sloc_row :: !Int
sloc_column :: !Int
NoLocation
show/hide Instances
data SrcSpan Source
Source location spanning a contiguous section of a file.
Constructors
SpanCoLinearA span which starts and ends on the same line.
span_filename :: !String
span_row :: !Int
span_start_column :: !Int
span_end_column :: !Int
SpanMultiLineA span which starts and ends on different lines.
span_filename :: !String
span_start_row :: !Int
span_start_column :: !Int
span_end_row :: !Int
span_end_column :: !Int
SpanPointA span which is actually just one point in the file.
span_filename :: !String
span_row :: !Int
span_column :: !Int
SpanEmptyNo span information.
show/hide Instances
class Span a whereSource
Types which have a span.
Methods
getSpan :: a -> SrcSpanSource
show/hide Instances
spanning :: (Span a, Span b) => a -> b -> SrcSpanSource
Create a new span which encloses two spanned things.
mkSrcSpan :: SrcLocation -> SrcLocation -> SrcSpanSource
Make a span from two locations. Assumption: either the arguments are the same, or the left one preceeds the right one.
combineSrcSpans :: SrcSpan -> SrcSpan -> SrcSpanSource
Combines two SrcSpan into one that spans at least all the characters within both spans. Assumes the file part is the same in both inputs
initialSrcLocation :: String -> SrcLocationSource
Construct the initial source location for a file.
spanStartPoint :: SrcSpan -> SrcSpanSource
Make a point span from the start of a span
Modification
incColumn :: Int -> SrcLocation -> SrcLocationSource
Increment the column of a location.
decColumn :: Int -> SrcLocation -> SrcLocationSource
Decrement the column of a location, only if they are on the same row.
incLine :: Int -> SrcLocation -> SrcLocationSource
Increment the line number (row) of a location by one.
incTab :: SrcLocation -> SrcLocationSource
Increment the column of a location by one tab stop.
endCol :: SrcSpan -> IntSource
Get the column of the end of a span.
Projection of components of a span
endRow :: SrcSpan -> IntSource
Get the row of the end of a span.
startCol :: SrcSpan -> IntSource
Get the column of the start of a span.
startRow :: SrcSpan -> IntSource
Get the row of the start of a span.
Produced by Haddock version 2.4.2