Text.Trifecta.Delta

trifecta-1.6.2.1: A modern parser combinator library with convenient diagnostics

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

Synopsis

- data Delta
  - = Columns !Int64 !Int64
  - | Tab !Int64 !Int64 !Int64
  - | Lines !Int64 !Int64 !Int64 !Int64
  - | Directed !ByteString !Int64 !Int64 !Int64 !Int64
- class HasDelta t where
- class HasBytes t where
- nextTab :: Int64 -> Int64
- rewind :: Delta -> Delta
- near :: (HasDelta s, HasDelta t) => s -> t -> Bool
- column :: HasDelta t => t -> Int64
- columnByte :: Delta -> Int64

# Documentation

data Delta #

Constructors

Columns !Int64 !Int64 |
Tab !Int64 !Int64 !Int64 |
Lines !Int64 !Int64 !Int64 !Int64 |
Directed !ByteString !Int64 !Int64 !Int64 !Int64 |

Instances

Eq Delta # |
Methods (==) :: Delta -> Delta -> Bool # (/=) :: Delta -> Delta -> Bool #
Data 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 # toConstr :: Delta -> Constr # 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 :: (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 #
Ord Delta # |
Methods compare :: Delta -> Delta -> Ordering # (<) :: Delta -> Delta -> Bool # (<=) :: Delta -> Delta -> Bool # (>) :: Delta -> Delta -> Bool # (>=) :: Delta -> Delta -> Bool # max :: Delta -> Delta -> Delta # min :: Delta -> Delta -> Delta #
Show Delta # |
Methods showsPrec :: Int -> Delta -> ShowS # show :: Delta -> String # showList :: [Delta] -> ShowS #
Generic Delta # |
Associated Types type Rep Delta :: * -> * # Methods from :: Delta -> Rep Delta x # to :: Rep Delta x -> Delta #
Semigroup Delta # |
Methods (<>) :: Delta -> Delta -> Delta # sconcat :: NonEmpty Delta -> Delta # stimes :: Integral b => b -> Delta -> Delta #
Monoid Delta # |
Methods mempty :: Delta # mappend :: Delta -> Delta -> Delta # mconcat :: [Delta] -> Delta #
Pretty Delta # |
Methods pretty :: Delta -> Doc # prettyList :: [Delta] -> Doc #
Hashable Delta # |
Methods hashWithSalt :: Int -> Delta -> Int # hash :: Delta -> Int #
HasDelta Delta # |
Methods delta :: Delta -> Delta #
HasBytes Delta # |
Methods bytes :: Delta -> Int64 #
Measured Delta Rope # |
Methods measure :: Rope -> Delta #
Measured Delta Strand # |
Methods measure :: Strand -> Delta #
MarkParsing Delta Parser # |
Methods mark :: Parser Delta # release :: Delta -> Parser () #
type Rep Delta # |
type Rep Delta = D1 (MetaData "Delta" "Text.Trifecta.Delta" "trifecta-1.6.2.1-B5WV3kZiOBnIOaoG8Bjgia" False) ((:+:) ((:+:) (C1 (MetaCons "Columns" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)))) (C1 (MetaCons "Tab" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)))))) ((:+:) (C1 (MetaCons "Lines" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64))) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64))))) (C1 (MetaCons "Directed" PrefixI False) ((:*:) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ByteString)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64))) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Int64))))))))

class HasDelta t where #

Minimal complete definition

delta

Methods

delta :: t -> Delta #

Instances

HasDelta Char # |
Methods delta :: Char -> Delta #
HasDelta Word8 # |
Methods delta :: Word8 -> Delta #
HasDelta ByteString # |
Methods delta :: ByteString -> Delta #
HasDelta Delta # |
Methods delta :: Delta -> Delta #
HasDelta Rope # |
Methods delta :: Rope -> Delta #
HasDelta Strand # |
Methods delta :: Strand -> Delta #
HasDelta HighlightedRope # |
Methods delta :: HighlightedRope -> Delta #
HasDelta Rendering # |
Methods delta :: Rendering -> Delta #
HasDelta Caret # |
Methods delta :: Caret -> Delta #
HasDelta (Careted a) # |
Methods delta :: Careted a -> Delta #
HasDelta (Rendered a) # |
Methods delta :: Rendered a -> Delta #
(HasDelta l, HasDelta r) => HasDelta (Either l r) # |
Methods delta :: Either l r -> Delta #
(Measured v a, HasDelta v) => HasDelta (FingerTree v a) # |
Methods delta :: FingerTree v a -> Delta #

class HasBytes t where #

Minimal complete definition

bytes

Methods

bytes :: t -> Int64 #

Instances

HasBytes ByteString # |
Methods bytes :: ByteString -> Int64 #
HasBytes Delta # |
Methods bytes :: Delta -> Int64 #
HasBytes Rope # |
Methods bytes :: Rope -> Int64 #
HasBytes Strand # |
Methods bytes :: Strand -> Int64 #
HasBytes HighlightedRope # |
Methods bytes :: HighlightedRope -> Int64 #
HasBytes Caret # |
Methods bytes :: Caret -> Int64 #
HasBytes (Careted a) # |
Methods bytes :: Careted a -> Int64 #
HasBytes (Rendered a) # |
Methods bytes :: Rendered a -> Int64 #
(Measured v a, HasBytes v) => HasBytes (FingerTree v a) # |
Methods bytes :: FingerTree v a -> Int64 #

nextTab :: Int64 -> Int64 #

Increment a column number to the next tabstop.

rewind :: Delta -> Delta #

Rewind a `Delta` to the beginning of the line.

near :: (HasDelta s, HasDelta t) => s -> t -> Bool #

Should we show two things with a `Delta` on the same line?

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`.