From bf74f50733840b0bcec81ac265c824ae2bc3f675 Mon Sep 17 00:00:00 2001 From: krasimir Date: Mon, 22 Mar 2010 21:15:29 +0000 Subject: store and propagate the exact source location for all judgements in the grammar. It may not be used accurately in the error messages yet --- src/compiler/GF/Grammar/Binary.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/compiler/GF/Grammar/Binary.hs') diff --git a/src/compiler/GF/Grammar/Binary.hs b/src/compiler/GF/Grammar/Binary.hs index 1febdcd46..ff34ae38a 100644 --- a/src/compiler/GF/Grammar/Binary.hs +++ b/src/compiler/GF/Grammar/Binary.hs @@ -31,9 +31,9 @@ instance Binary a => Binary (MGrammar a) where get = fmap MGrammar get instance Binary a => Binary (ModInfo a) where - put mi = do put (mtype mi,mstatus mi,flags mi,extend mi,mwith mi,opens mi,mexdeps mi,jments mi,positions mi) - get = do (mtype,mstatus,flags,extend,mwith,opens,med,jments,positions) <- get - return (ModInfo mtype mstatus flags extend mwith opens med jments positions) + put mi = do put (mtype mi,mstatus mi,flags mi,extend mi,mwith mi,opens mi,mexdeps mi,jments mi) + get = do (mtype,mstatus,flags,extend,mwith,opens,med,jments) <- get + return (ModInfo mtype mstatus flags extend mwith opens med jments) instance Binary ModuleType where put MTAbstract = putWord8 0 @@ -109,6 +109,10 @@ instance Binary Info where 8 -> get >>= \(x,y) -> return (AnyInd x y) _ -> decodingError +instance Binary a => Binary (L a) where + put (L x y) = put (x,y) + get = get >>= \(x,y) -> return (L x y) + instance Binary BindType where put Explicit = putWord8 0 put Implicit = putWord8 1 @@ -258,6 +262,6 @@ instance Binary Label where decodeModHeader :: FilePath -> IO SourceModule decodeModHeader fpath = do (m,mtype,mstatus,flags,extend,mwith,opens,med) <- decodeFile fpath - return (m,ModInfo mtype mstatus flags extend mwith opens med Map.empty Map.empty) + return (m,ModInfo mtype mstatus flags extend mwith opens med Map.empty) decodingError = fail "This GFO file was compiled with different version of GF" -- cgit v1.2.3