| Copyright | (C) 2011-2015 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Text.Trifecta.Delta
Description
A Delta keeps track of the cursor position of the parser, so it can be
referred to later, for example in error messages.
Documentation
Since there are multiple ways to be at a certain location, Delta captures
all these alternatives as a single type.
Constructors
| Columns !Int64 !Int64 | ( number of characters , number of bytes ) |
| Tab !Int64 !Int64 !Int64 | ( number of characters before the tab , number of characters after the tab , number of bytes ) |
| Lines !Int64 !Int64 !Int64 !Int64 | ( number of newlines contained , number of characters since the last newline , number of bytes , number of bytes since the last newline ) |
| Directed !ByteString !Int64 !Int64 !Int64 !Int64 | ( current file name , number of lines since the last line directive , number of characters since the last newline , number of bytes , number of bytes since the last newline ) |
Instances
Minimal complete definition
Instances
| HasDelta Char # | |
Defined in Text.Trifecta.Delta | |
| HasDelta Word8 # | |
Defined in Text.Trifecta.Delta | |
| HasDelta ByteString # | |
Defined in Text.Trifecta.Delta Methods delta :: ByteString -> Delta # | |
| HasDelta Delta # | |
Defined in Text.Trifecta.Delta | |
| HasDelta Rope # | |
Defined in Text.Trifecta.Rope | |
| HasDelta Strand # | |
Defined in Text.Trifecta.Rope | |
| HasDelta Rendering # | |
Defined in Text.Trifecta.Rendering | |
| HasDelta Caret # | |
Defined in Text.Trifecta.Rendering | |
| HasDelta HighlightedRope # | |
Defined in Text.Trifecta.Highlight Methods delta :: HighlightedRope -> Delta # | |
| HasDelta (Careted a) # | |
Defined in Text.Trifecta.Rendering | |
| HasDelta (Rendered a) # | |
Defined in Text.Trifecta.Rendering | |
| (HasDelta l, HasDelta r) => HasDelta (Either l r) # | |
Defined in Text.Trifecta.Delta | |
| (Measured v a, HasDelta v) => HasDelta (FingerTree v a) # | |
Defined in Text.Trifecta.Delta Methods delta :: FingerTree v a -> Delta # | |
Minimal complete definition
Instances
| HasBytes ByteString # | |
Defined in Text.Trifecta.Delta Methods bytes :: ByteString -> Int64 # | |
| HasBytes Delta # | |
Defined in Text.Trifecta.Delta | |
| HasBytes Rope # | |
Defined in Text.Trifecta.Rope | |
| HasBytes Strand # | |
Defined in Text.Trifecta.Rope | |
| HasBytes Caret # | |
Defined in Text.Trifecta.Rendering | |
| HasBytes HighlightedRope # | |
Defined in Text.Trifecta.Highlight Methods bytes :: HighlightedRope -> Int64 # | |
| HasBytes (Careted a) # | |
Defined in Text.Trifecta.Rendering | |
| HasBytes (Rendered a) # | |
Defined in Text.Trifecta.Rendering | |
| (Measured v a, HasBytes v) => HasBytes (FingerTree v a) # | |
Defined in Text.Trifecta.Delta Methods bytes :: FingerTree v a -> Int64 # | |
near :: (HasDelta s, HasDelta t) => s -> t -> Bool #
Should we show two things with a Delta on the same line?
>>>near (Columns 0 0) (Columns 5 5)True
>>>near (Lines 1 0 1 0) (Lines 2 4 4 2)False
column :: HasDelta t => t -> Int64 #
Retrieve the character offset within the current line from this Delta.
columnByte :: Delta -> Int64 #
Retrieve the byte offset within the current line from this Delta.