mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 09:52:55 -06:00
fix the deserialization of flags from the GFO files
This commit is contained in:
@@ -17,7 +17,6 @@ import Data.Binary
|
|||||||
--import Control.Monad
|
--import Control.Monad
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.ByteString.Char8 as BS
|
import qualified Data.ByteString.Char8 as BS
|
||||||
import Text.PrettyPrint (render)
|
|
||||||
|
|
||||||
import GF.Data.Operations
|
import GF.Data.Operations
|
||||||
import GF.Infra.Ident
|
import GF.Infra.Ident
|
||||||
@@ -25,7 +24,7 @@ import GF.Infra.Option
|
|||||||
import GF.Grammar.Grammar
|
import GF.Grammar.Grammar
|
||||||
|
|
||||||
import PGF() -- Binary instances
|
import PGF() -- Binary instances
|
||||||
import PGF.Data(ppLit)
|
import PGF.Data(Literal(..))
|
||||||
|
|
||||||
-- Please change this every time when the GFO format is changed
|
-- Please change this every time when the GFO format is changed
|
||||||
gfoVersion = "GF03"
|
gfoVersion = "GF03"
|
||||||
@@ -93,9 +92,13 @@ instance Binary ModuleStatus where
|
|||||||
instance Binary Options where
|
instance Binary Options where
|
||||||
put = put . optionsGFO
|
put = put . optionsGFO
|
||||||
get = do opts <- get
|
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
|
Ok x -> return x
|
||||||
Bad msg -> fail msg
|
Bad msg -> fail msg
|
||||||
|
where
|
||||||
|
toString (LStr s) = s
|
||||||
|
toString (LInt n) = show n
|
||||||
|
toString (LFlt d) = show d
|
||||||
|
|
||||||
instance Binary Production where
|
instance Binary Production where
|
||||||
put (Production res funid args) = put (res,funid,args)
|
put (Production res funid args) = put (res,funid,args)
|
||||||
|
|||||||
Reference in New Issue
Block a user