From bd69ad83f7ffd2b14997dbd3188249b723fba93b Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Wed, 6 Nov 2013 13:05:51 +0000 Subject: [PATCH] fix the deserialization of flags from the GFO files --- src/compiler/GF/Grammar/Binary.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/compiler/GF/Grammar/Binary.hs b/src/compiler/GF/Grammar/Binary.hs index 0e897aa00..6cd3832c0 100644 --- a/src/compiler/GF/Grammar/Binary.hs +++ b/src/compiler/GF/Grammar/Binary.hs @@ -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)