flatparse-0.5.1.0: High-performance parsing from strict bytestrings
Safe HaskellSafe-Inferred
LanguageHaskell2010

FlatParse.Common.Position

Synopsis

Documentation

newtype Pos Source #

Byte offset counted backwards from the end of the buffer. Note: the Ord instance for Pos considers the earlier positions to be smaller.

Constructors

Pos 

Fields

Instances

Instances details
Show Pos Source # 
Instance details

Defined in FlatParse.Common.Position

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

Eq Pos Source # 
Instance details

Defined in FlatParse.Common.Position

Methods

(==) :: Pos -> Pos -> Bool #

(/=) :: Pos -> Pos -> Bool #

Ord Pos Source # 
Instance details

Defined in FlatParse.Common.Position

Methods

compare :: Pos -> Pos -> Ordering #

(<) :: Pos -> Pos -> Bool #

(<=) :: Pos -> Pos -> Bool #

(>) :: Pos -> Pos -> Bool #

(>=) :: Pos -> Pos -> Bool #

max :: Pos -> Pos -> Pos #

min :: Pos -> Pos -> Pos #

endPos :: Pos Source #

The end of the input.

addrToPos# :: Addr# -> Addr# -> Pos Source #

Very unsafe conversion between a primitive address and a position. The first argument points to the end of the buffer, the second argument is being converted.

posToAddr# :: Addr# -> Pos -> Addr# Source #

Very unsafe conversion between a primitive address and a position. The first argument points to the end of the buffer.

data Span Source #

A pair of positions.

Constructors

Span !Pos !Pos 

Instances

Instances details
Show Span Source # 
Instance details

Defined in FlatParse.Common.Position

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

Eq Span Source # 
Instance details

Defined in FlatParse.Common.Position

Methods

(==) :: Span -> Span -> Bool #

(/=) :: Span -> Span -> Bool #

unsafeSlice :: ByteString -> Span -> ByteString Source #

Slice into a ByteString using a Span. The result is invalid if the Span is not a valid slice of the first argument.