module Hectoparsec.State
(
State(..)
, initialState
, makeErrorAt
) where
import Hectoparsec.Error
import Hectoparsec.Pos
data State s = State
{ forall s. State s -> s
stateInput :: s
, forall s. State s -> Pos
statePos :: !Pos
, forall s. State s -> Int
stateOffset :: {-# UNPACK #-} !Int
}
initialState :: FilePath -> s -> State s
initialState :: forall s. FilePath -> s -> State s
initialState FilePath
fp s
s = s -> Pos -> Int -> State s
forall s. s -> Pos -> Int -> State s
State s
s (FilePath -> Pos
initialPos FilePath
fp) Int
0
{-# INLINE initialState #-}
makeErrorAt :: State s -> ErrorItem s e l -> ParseError s e l
makeErrorAt :: forall s e l. State s -> ErrorItem s e l -> ParseError s e l
makeErrorAt State s
st ErrorItem s e l
err = Pos -> Int -> ErrorItem s e l -> ParseError s e l
forall s e l. Pos -> Int -> ErrorItem s e l -> ParseError s e l
ParseError (State s -> Pos
forall s. State s -> Pos
statePos State s
st) (State s -> Int
forall s. State s -> Int
stateOffset State s
st) ErrorItem s e l
err
{-# INLINE makeErrorAt #-}