Copyright | ©2020 James Alexander Feldman-Crough |
---|---|
License | MPL-2.0 |
Maintainer | alex@fldcr.com |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data Source = Source {}
- data Location
- data SparseLocation = SparseLocation {}
- data LineMap
- newtype Offset = Offset Word
- newtype Line = Line Word
- newtype Column = Column Word
- locationSource :: Location -> Source
- locationColumn :: Location -> Column
- locationLine :: Location -> Line
- locationOffset :: Location -> Offset
- makeSource :: String -> Text -> Source
- getSourceLine :: Line -> Source -> Maybe Text
- getLocation :: Offset -> Source -> Maybe Location
- enrichLocation :: SparseLocation -> Location
- stripLocation :: Location -> SparseLocation
- lineOffsets :: LineMap -> [Offset]
- lineToOffset :: Line -> LineMap -> Maybe Offset
- offsetToLine :: Offset -> LineMap -> Line
Documentation
Information about Prosidy source file.
The Show
instance for ths class does not include the LineMap
or Text
fields, as those are rather noisy.
Source | |
|
Instances
Eq Source Source # | |
Show Source Source # | |
Generic Source Source # | |
Hashable Source Source # | |
Defined in Prosidy.Source | |
Binary Source Source # | |
NFData Source Source # | |
Defined in Prosidy.Source | |
type Rep Source Source # | |
Defined in Prosidy.Source type Rep Source = D1 ('MetaData "Source" "Prosidy.Source" "prosidy-1.6.0.0-inplace" 'False) (C1 ('MetaCons "Source" 'PrefixI 'True) (S1 ('MetaSel ('Just "sourceName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 String) :*: (S1 ('MetaSel ('Just "sourceText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "sourceLineMap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 LineMap)))) |
A location in a Source
, with the line and column number computed lazily.
Instances
Eq Location Source # | |
Show Location Source # | |
Generic Location Source # | |
Hashable Location Source # | |
Defined in Prosidy.Source | |
Binary Location Source # | |
NFData Location Source # | |
Defined in Prosidy.Source | |
HasLocation Location Source # | |
type Rep Location Source # | |
Defined in Prosidy.Source type Rep Location = D1 ('MetaData "Location" "Prosidy.Source" "prosidy-1.6.0.0-inplace" 'False) (C1 ('MetaCons "Location" 'PrefixI 'True) ((S1 ('MetaSel ('Just "locationSource") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Source) :*: S1 ('MetaSel ('Just "locationOffset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Offset)) :*: (S1 ('MetaSel ('Just "locationLine") 'NoSourceUnpackedness 'SourceLazy 'DecidedLazy) (Rec0 Line) :*: S1 ('MetaSel ('Just "locationColumn") 'NoSourceUnpackedness 'SourceLazy 'DecidedLazy) (Rec0 Column)))) |
data SparseLocation Source #
A location in a Source
. The line and column numbers of this type are not
attached to this type; convert to a Location
to access those values.
SparseLocation | |
|
Instances
A dense vector containing offsets poiting to the start of each line. That is, the starting position of the third line of a file can be found at position 2.
An offset into a Source
, counted by UTF-8 codepoint.
Instances
A line number.
The Show
instance for Line
counts from one, while the internal
implementation counts from zero.
Instances
Enum Line Source # | |
Eq Line Source # | |
Ord Line Source # | |
Show Line Source # | |
Generic Line Source # | |
Hashable Line Source # | |
Defined in Prosidy.Source | |
ToJSON Line Source # | |
Defined in Prosidy.Source | |
FromJSON Line Source # | |
Binary Line Source # | |
NFData Line Source # | |
Defined in Prosidy.Source | |
type Rep Line Source # | |
Defined in Prosidy.Source |
A column number.
Instances
Enum Column Source # | |
Defined in Prosidy.Source | |
Eq Column Source # | |
Ord Column Source # | |
Show Column Source # | |
Generic Column Source # | |
Hashable Column Source # | |
Defined in Prosidy.Source | |
ToJSON Column Source # | |
Defined in Prosidy.Source | |
FromJSON Column Source # | |
Binary Column Source # | |
NFData Column Source # | |
Defined in Prosidy.Source | |
type Rep Column Source # | |
Defined in Prosidy.Source |
locationOffset :: Location -> Offset Source #
The position in the Source
, counted by Unicode codepoints.
enrichLocation :: SparseLocation -> Location Source #
Add lazily computed line and column number information to a
SparseLocation
.
stripLocation :: Location -> SparseLocation Source #
Remove line and column number information from a Location
.
lineOffsets :: LineMap -> [Offset] Source #