| Copyright | (C) 2011-2019 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| 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
| Monoid Delta Source # | |||||
| Semigroup Delta Source # | |||||
| Data Delta Source # | |||||
Defined in Text.Trifecta.Delta Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Delta -> c Delta gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Delta dataTypeOf :: Delta -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Delta) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Delta) gmapT :: (forall b. Data b => b -> b) -> Delta -> Delta gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Delta -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Delta -> r gmapQ :: (forall d. Data d => d -> u) -> Delta -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Delta -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Delta -> m Delta gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Delta -> m Delta gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Delta -> m Delta | |||||
| Generic Delta Source # | |||||
Defined in Text.Trifecta.Delta Associated Types
| |||||
| Show Delta Source # | |||||
| Eq Delta Source # | |||||
| Ord Delta Source # | |||||
| Hashable Delta Source # | |||||
| HasBytes Delta Source # | |||||
| HasDelta Delta Source # | |||||
| Measured Delta Rope Source # | |||||
| Measured Delta Strand Source # | |||||
| MarkParsing Delta Parser Source # | |||||
| type Rep Delta Source # | |||||
Defined in Text.Trifecta.Delta type Rep Delta = D1 ('MetaData "Delta" "Text.Trifecta.Delta" "trifecta-2.1.4-2SYQdBIWV6KTgQcAl4jnc" 'False) ((C1 ('MetaCons "Columns" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64)) :+: C1 ('MetaCons "Tab" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64)))) :+: (C1 ('MetaCons "Lines" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64))) :+: C1 ('MetaCons "Directed" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int64)))))) | |||||
class HasDelta t where Source #
Instances
| HasDelta ByteString Source # | |
Defined in Text.Trifecta.Delta Methods delta :: ByteString -> Delta Source # | |
| HasDelta Word8 Source # | |
| HasDelta Delta Source # | |
| HasDelta HighlightedRope Source # | |
Defined in Text.Trifecta.Highlight Methods delta :: HighlightedRope -> Delta Source # | |
| HasDelta Caret Source # | |
| HasDelta Rendering Source # | |
| HasDelta Rope Source # | |
| HasDelta Strand Source # | |
| HasDelta Char Source # | |
Defined in Text.Trifecta.Delta | |
| HasDelta (Careted a) Source # | |
| HasDelta (Rendered a) Source # | |
| (Measured v a, HasDelta v) => HasDelta (FingerTree v a) Source # | |
Defined in Text.Trifecta.Delta Methods delta :: FingerTree v a -> Delta Source # | |
| (HasDelta l, HasDelta r) => HasDelta (Either l r) Source # | |
Defined in Text.Trifecta.Delta | |
class HasBytes t where Source #
Instances
| HasBytes ByteString Source # | |
Defined in Text.Trifecta.Delta Methods bytes :: ByteString -> Int64 Source # | |
| HasBytes Delta Source # | |
| HasBytes HighlightedRope Source # | |
Defined in Text.Trifecta.Highlight Methods bytes :: HighlightedRope -> Int64 Source # | |
| HasBytes Caret Source # | |
| HasBytes Rope Source # | |
| HasBytes Strand Source # | |
| HasBytes (Careted a) Source # | |
| HasBytes (Rendered a) Source # | |
| (Measured v a, HasBytes v) => HasBytes (FingerTree v a) Source # | |
Defined in Text.Trifecta.Delta Methods bytes :: FingerTree v a -> Int64 Source # | |
near :: (HasDelta s, HasDelta t) => s -> t -> Bool Source #
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