fix the deserialization of flags from the GFO files

This commit is contained in:
kr.angelov
2013-11-06 13:05:51 +00:00
parent b8fd12e5e4
commit a710e90c0b

View File

@@ -17,7 +17,6 @@ import Data.Binary
--import Control.Monad
import qualified Data.Map as Map
import qualified Data.ByteString.Char8 as BS
import Text.PrettyPrint (render)
import GF.Data.Operations
import GF.Infra.Ident
@@ -25,7 +24,7 @@ import GF.Infra.Option
import GF.Grammar.Grammar
import PGF() -- Binary instances
import PGF.Data(ppLit)
import PGF.Data(Literal(..))
-- Please change this every time when the GFO format is changed
gfoVersion = "GF03"
@@ -93,9 +92,13 @@ instance Binary ModuleStatus where
instance Binary Options where
put = put . optionsGFO
get = do opts <- get
case parseModuleOptions ["--" ++ flag ++ "=" ++ render (ppLit value) | (flag,value) <- opts] of
case parseModuleOptions ["--" ++ flag ++ "=" ++ toString value | (flag,value) <- opts] of
Ok x -> return x
Bad msg -> fail msg
where
toString (LStr s) = s
toString (LInt n) = show n
toString (LFlt d) = show d
instance Binary Production where
put (Production res funid args) = put (res,funid,args)