From f859444fbe15812c3eb96cfc1377723c7a853aeb Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 22 Feb 2022 14:39:19 +0100 Subject: Fix columns in parser --- Parse.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Parse.hs b/Parse.hs index 0ee5004..e4eca84 100644 --- a/Parse.hs +++ b/Parse.hs @@ -12,6 +12,8 @@ import Data.ByteString (ByteString) import Data.Char import Data.List (unfoldr) +import Debug.Trace + import Prof @@ -29,6 +31,7 @@ data Columns parseProf :: ByteString -> Either String (Prof ()) parseProf input = do (cols, lns) <- maybe (Left "Did not find tree header") Right (findTree (BS.split 10 input)) + traceM (show cols) lns' <- concat <$> mapM (parseLine cols) lns case buildTree lns' of Just (tree, []) -> return (Prof tree) @@ -102,11 +105,11 @@ parseLeadingTreeLine bs = do return $ Columns { cMod = cmod , cSrc = csrc , cNo = cno - , cCnt = cno + 5 - , cIvT = centr + 6 - , cIvA = civt + 4 - , cIhT = civa + 5 - , cIhA = ciht + 4 } + , cCnt = cno + 6 + , cIvT = centr + 7 + , cIvA = civt + 5 + , cIhT = civa + 6 + , cIhA = ciht + 5 } where findCol :: String -> Int -> ByteString -> Maybe (Int, ByteString) findCol stag from = \line -> -- cgit v1.2.3-70-g09d2