packages feed

hprotoc 1.7.1 → 1.7.9

raw patch · 3 files changed

+27/−25 lines, 3 filesdep ~protocol-buffersdep ~protocol-buffers-descriptor

Dependency ranges changed: protocol-buffers, protocol-buffers-descriptor

Files

Text/ProtocolBuffers/ProtoCompile/MakeReflections.hs view
@@ -43,7 +43,6 @@ import Text.ProtocolBuffers.ProtoCompile.Resolve(ReMap,NameMap(..))  import qualified Data.Foldable as F(foldr,toList)-import qualified Data.ByteString.Lazy.UTF8 as U(fromString,toString) import qualified Data.Sequence as Seq(fromList,empty,singleton,null) import Numeric(readHex,readOct,readDec) import Data.Monoid(mconcat,mappend)@@ -221,21 +220,24 @@                    TYPE_FLOAT   -> Just parseDefFloat                    TYPE_STRING  -> Just parseDefString                    _            -> Just parseDefInteger-         case todo (utf8 bs) of+         case todo bs of            Nothing -> error $ "Could not parse as type "++ show t ++" the default value (raw) is "++ show mayRawDef ++" for field "++show f            Just value -> return value  --- From here down is code used to parse the format of the default values in the .proto files -parseDefEnum :: ByteString -> Maybe HsDefault-parseDefEnum = Just . HsDef'Enum . U.toString+-- On 25 August 2010 20:12, George van den Driessche <georgevdd@google.com> sent Chris Kuklewicz a+-- patch to MakeReflections.parseDefEnum to ensure that HsDef'Enum holds the mangled form of the+-- name.+parseDefEnum :: Utf8 -> Maybe HsDefault+parseDefEnum = Just . HsDef'Enum . mName . mangle . IName . uToString  {-# INLINE mayRead #-} mayRead :: ReadS a -> String -> Maybe a mayRead f s = case f s of [(a,"")] -> Just a; _ -> Nothing -parseDefDouble :: ByteString -> Maybe HsDefault-parseDefDouble bs = case (U.toString bs) of+parseDefDouble :: Utf8 -> Maybe HsDefault+parseDefDouble bs = case (uToString bs) of                       "nan" -> Just (HsDef'RealFloat SRF'nan)                       "-inf" -> Just (HsDef'RealFloat SRF'ninf)                       "inf" -> Just (HsDef'RealFloat SRF'inf)@@ -244,15 +246,15 @@         reads' = readSigned' reads  {--parseDefDouble :: ByteString -> Maybe HsDefault+parseDefDouble :: Utf8 -> Maybe HsDefault parseDefDouble bs |                    | otherwise = fmap (HsDef'Rational . toRational) -                                . mayRead reads' . U.toString $ bs+                                . mayRead reads' . uToString $ bs -}  -parseDefFloat :: ByteString -> Maybe HsDefault-parseDefFloat bs = case (U.toString bs) of+parseDefFloat :: Utf8 -> Maybe HsDefault+parseDefFloat bs = case (uToString bs) of                       "nan" -> Just (HsDef'RealFloat SRF'nan)                       "-inf" -> Just (HsDef'RealFloat SRF'ninf)                       "inf" -> Just (HsDef'RealFloat SRF'inf)@@ -261,29 +263,29 @@         reads' = readSigned' reads  {--parseDefFloat :: ByteString -> Maybe HsDefault+parseDefFloat :: Utf8 -> Maybe HsDefault parseDefFloat bs = fmap  (HsDef'Rational . toRational) -                   . mayRead reads' . U.toString $ bs+                   . mayRead reads' . uToString $ bs   where reads' :: ReadS Float         reads' = readSigned' reads -} -parseDefString :: ByteString -> Maybe HsDefault-parseDefString bs = Just (HsDef'ByteString bs)+parseDefString :: Utf8 -> Maybe HsDefault+parseDefString bs = Just (HsDef'ByteString (utf8 bs)) -parseDefBytes :: ByteString -> Maybe HsDefault-parseDefBytes bs = Just (HsDef'ByteString bs)+parseDefBytes :: Utf8 -> Maybe HsDefault+parseDefBytes bs = Just (HsDef'ByteString (utf8 bs)) -parseDefInteger :: ByteString -> Maybe HsDefault-parseDefInteger bs = fmap HsDef'Integer . mayRead checkSign . U.toString $ bs+parseDefInteger :: Utf8 -> Maybe HsDefault+parseDefInteger bs = fmap HsDef'Integer . mayRead checkSign . uToString $ bs     where checkSign = readSigned' checkBase           checkBase ('0':'x':xs@(_:_)) = readHex xs           checkBase ('0':xs@(_:_)) = readOct xs           checkBase xs = readDec xs -parseDefBool :: ByteString -> Maybe HsDefault-parseDefBool bs | bs == U.fromString "true" = Just (HsDef'Bool True)-                | bs == U.fromString "false" = Just (HsDef'Bool False)+parseDefBool :: Utf8 -> Maybe HsDefault+parseDefBool bs | bs == uFromString "true" = Just (HsDef'Bool True)+                | bs == uFromString "false" = Just (HsDef'Bool False)                 | otherwise = Nothing  -- The Numeric.readSigned does not handle '+' for some odd reason
Text/ProtocolBuffers/ProtoCompile/Resolve.hs view
@@ -625,7 +625,7 @@   return (self,entity)  -- Among other things, this is where ambiguous type names in the proto file are resolved into a--- Message or a Group or an Error.+-- Message or a Group or an Enum. {- old: Tracking error flow: if the expectMGE fails then the 'mVal' in the E'Field is a (Just (Left _)).  This triggers a thrown error if accessed in 'fqField'. -} entityField :: Bool -> D.FieldDescriptorProto -> SE (IName String,Entity) entityField isKey fdp = annErr ("entityField FieldDescriptorProto name is "++show (D.FieldDescriptorProto.name fdp)) $ do
hprotoc.cabal view
@@ -1,5 +1,5 @@ name:           hprotoc-version:        1.7.1+version:        1.7.9 cabal-version:  >= 1.6 build-type:     Simple license:        BSD3@@ -9,7 +9,7 @@ maintainer:     Chris Kuklewicz <protobuf@personal.mightyreason.com> stability:      Experimental homepage:       http://hackage.haskell.org/cgi-bin/hackage-scripts/package/protocol-buffers-package-url:    http://darcs.haskell.org/packages/protocol-buffers2/+package-url:    http://code.haskell.org/protocol-buffers/ synopsis:       Parse Google Protocol Buffer specifications description:    Parse http://code.google.com/apis/protocolbuffers/docs/proto.html   and perhaps general haskell code to use them@@ -25,7 +25,7 @@   Hs-Source-Dirs:  .,protoc-gen-haskell   build-tools:     alex   ghc-options:     -O2 -Wall-  build-depends:   protocol-buffers == 1.6.0, protocol-buffers-descriptor == 1.6.0+  build-depends:   protocol-buffers == 1.7.9, protocol-buffers-descriptor == 1.7.9   build-depends:   binary, utf8-string   build-depends:   parsec < 3, haskell-src-exts >= 1.7.0,                    containers,bytestring,array,