rewrote Parser

now uses Parser a in Combination with StateT Int64 a yielding
type CParser a = StateT Int64 Parser a

So now the parser Counts how many Bytes get read. This can be
used by the get-function to get the currently read bytes.
This commit is contained in:
Stefan Dresselhaus
2014-04-15 06:43:49 +02:00
parent 6104e7349b
commit b0e78033e5
3 changed files with 111 additions and 84 deletions

View File

@ -22,6 +22,8 @@ import Control.Concurrent.STM (TQueue,
import Control.Monad.RWS.Strict (RWST, ask, asks,
evalRWST, get, liftIO,
modify, put)
import Control.Monad.Trans.Class
import Control.Monad.Trans.State (evalStateT)
import Data.Distributive (distribute, collect)
-- FFI
@ -70,8 +72,10 @@ import qualified Debug.Trace as D (trace)
--------------------------------------------------------------------------------
testParser :: IO ()
testParser = do
B.readFile "sample.iqm" >>= parseTest parseIQM
f <- B.readFile "sample.iqm"
parseTest (evalStateT parseIQM 0) f
--------------------------------------------------------------------------------