module FlatParse.Stateful.Addr where
import FlatParse.Stateful.Parser
import FlatParse.Stateful.Base ( takeUnsafe#, atSkipUnsafe#, lookahead )
import GHC.Exts
import qualified Data.ByteString as B
withAddr# :: (Addr# -> ParserT st r e a) -> ParserT st r e a
withAddr# :: forall (st :: ZeroBitType) r e a.
(Addr# -> ParserT st r e a) -> ParserT st r e a
withAddr# Addr# -> ParserT st r e a
p = forall (st :: ZeroBitType) r e a.
(ForeignPtrContents
-> r -> Addr# -> Addr# -> Int# -> st -> Res# st e a)
-> ParserT st r e a
ParserT \ForeignPtrContents
fp !r
r Addr#
eob Addr#
s Int#
n st
st -> forall (st :: ZeroBitType) r e a.
ParserT st r e a
-> ForeignPtrContents
-> r
-> Addr#
-> Addr#
-> Int#
-> st
-> Res# st e a
runParserT# (Addr# -> ParserT st r e a
p Addr#
s) ForeignPtrContents
fp r
r Addr#
eob Addr#
s Int#
n st
st
{-# inline withAddr# #-}
takeOffAddr# :: Addr# -> Int# -> Int# -> ParserT st r e B.ByteString
takeOffAddr# :: forall (st :: ZeroBitType) r e.
Addr# -> Int# -> Int# -> ParserT st r e ByteString
takeOffAddr# Addr#
addr# Int#
offset# Int#
len# = forall (st :: ZeroBitType) r e a.
Addr# -> Int# -> ParserT st r e a -> ParserT st r e a
withOffAddr# Addr#
addr# Int#
offset# (forall (st :: ZeroBitType) r e. Int# -> ParserT st r e ByteString
takeUnsafe# Int#
len#)
{-# inline takeOffAddr# #-}
withOffAddr# :: Addr# -> Int# -> ParserT st r e a -> ParserT st r e a
withOffAddr# :: forall (st :: ZeroBitType) r e a.
Addr# -> Int# -> ParserT st r e a -> ParserT st r e a
withOffAddr# Addr#
addr# Int#
offset# =
forall (st :: ZeroBitType) r e a.
Addr# -> ParserT st r e a -> ParserT st r e a
lookaheadFromAddr# Addr#
addr# forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (st :: ZeroBitType) r e ret.
Int# -> ParserT st r e ret -> ParserT st r e ret
atSkipUnsafe# Int#
offset#
{-# inline withOffAddr# #-}
lookaheadFromAddr# :: Addr# -> ParserT st r e a -> ParserT st r e a
lookaheadFromAddr# :: forall (st :: ZeroBitType) r e a.
Addr# -> ParserT st r e a -> ParserT st r e a
lookaheadFromAddr# Addr#
s = forall (st :: ZeroBitType) r e a.
ParserT st r e a -> ParserT st r e a
lookahead forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (st :: ZeroBitType) r e a.
Addr# -> ParserT st r e a -> ParserT st r e a
atAddr# Addr#
s
{-# inline lookaheadFromAddr# #-}
atAddr# :: Addr# -> ParserT st r e a -> ParserT st r e a
atAddr# :: forall (st :: ZeroBitType) r e a.
Addr# -> ParserT st r e a -> ParserT st r e a
atAddr# Addr#
s (ParserT ForeignPtrContents
-> r -> Addr# -> Addr# -> Int# -> st -> Res# st e a
p) = forall (st :: ZeroBitType) r e a.
(ForeignPtrContents
-> r -> Addr# -> Addr# -> Int# -> st -> Res# st e a)
-> ParserT st r e a
ParserT \ForeignPtrContents
fp !r
r Addr#
eob Addr#
_ Int#
n st
st -> ForeignPtrContents
-> r -> Addr# -> Addr# -> Int# -> st -> Res# st e a
p ForeignPtrContents
fp r
r Addr#
eob Addr#
s Int#
n st
st
{-# inline atAddr# #-}