forked from GitHub/gf-core
store and propagate the exact source location for all judgements in the grammar. It may not be used accurately in the error messages yet
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user