summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Grammar/Binary.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-09-19 20:48:10 +0000
committerhallgren <hallgren@chalmers.se>2013-09-19 20:48:10 +0000
commit021b5f06d3900fe2b10d5d3ccf6ac286a779ef16 (patch)
treecff0a0ca9c945dcef34f58a6e09fc5042c7abd65 /src/compiler/GF/Grammar/Binary.hs
parent3d5b9bd1fd46a51651cbfbd45f03e5b878aebbac (diff)
Introduce type RawIdent; only 9 imports of Data.ByteString.Char8 remain
The fact that identifiers are represented as ByteStrings is now an internal implentation detail in module GF.Infra.Ident. Conversion between ByteString and identifiers is only needed in the lexer and the Binary instances.
Diffstat (limited to 'src/compiler/GF/Grammar/Binary.hs')
-rw-r--r--src/compiler/GF/Grammar/Binary.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/GF/Grammar/Binary.hs b/src/compiler/GF/Grammar/Binary.hs
index ae0c72809..fab63a7ba 100644
--- a/src/compiler/GF/Grammar/Binary.hs
+++ b/src/compiler/GF/Grammar/Binary.hs
@@ -34,7 +34,7 @@ instance Binary Ident where
get = do bs <- get
if bs == BS.pack "_"
then return identW
- else return (identC bs)
+ else return (identC (rawIdentC bs))
instance Binary SourceGrammar where
put = put . modules
@@ -289,6 +289,9 @@ instance Binary Label where
1 -> fmap LVar get
_ -> decodingError
+instance Binary RawIdent where
+ put = put . rawId2bs
+ get = fmap rawIdentC get
putGFOVersion = mapM_ (putWord8 . fromIntegral . ord) gfoVersion
getGFOVersion = replicateM (length gfoVersion) (fmap (chr . fromIntegral) getWord8)