-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parse Google Protocol Buffer specifications -- -- Parse language defined at -- http://code.google.com/apis/protocolbuffers/docs/proto.html and -- general haskell code to implement messages. @package hprotoc @version 2.4.3 -- | This Parser module takes a filename and its contents as a -- bytestring, and uses Lexer.hs to make a stream of tokens that it -- parses. No IO is performed and the error function is not used. Since -- the Lexer should also avoid such errors this should be a reliably -- total function of the input. -- -- The internals have been updated to handle Google's protobuf version -- 2.0.3 formats, including EnumValueOptions. module Text.ProtocolBuffers.ProtoCompile.Parser parseProto :: String -> ByteString -> Either ParseError FileDescriptorProto isValidPacked :: Label -> Maybe Type -> Bool -- | This huge module handles the loading and name resolution. The -- loadProto command recursively gets all the imported proto files. The -- makeNameMaps command makes the translator from proto name to Haskell -- name. Many possible errors in the proto data are caught and reported -- by these operations. -- -- hprotoc will actually resolve more unqualified imported names than -- Google's protoc which requires more qualified names. I do not have the -- obsessive nature to fix this. module Text.ProtocolBuffers.ProtoCompile.Resolve -- | Given a list of paths to search, loads proto files by looking for them -- in the file system. loadProto :: [LocalFP] -> LocalFP -> IO (Env, [FileDescriptorProto]) loadCodeGenRequest :: CodeGeneratorRequest -> LocalFP -> (Env, [FileDescriptorProto]) makeNameMaps :: [MName String] -> [(CanonFP, [MName String])] -> Env -> Either ErrStr NameMap getTLS :: Env -> (TopLevel, [TopLevel]) getPackageID :: PackageID a -> a -- | By construction Env is 0 or more Local Entity namespaces followed by 1 -- or more Global TopLevel namespaces (self and imported files). Entities -- in first Global TopLevel namespace can refer to each other and to -- Entities in the list of directly imported TopLevel namespaces only. data Env Local :: [IName String] -> EMap -> Env -> Env Global :: TopLevel -> [TopLevel] -> Env -- | TopLevel corresponds to all items defined in a .proto file. This -- includes the FileOptions since this will be consulted when generating -- the Haskell module names, and the imported files are only known -- through their TopLevel data. data TopLevel TopLevel :: FilePath -> PackageID [IName String] -> Either ErrStr FileDescriptorProto -> EMap -> TopLevel [top'Path] :: TopLevel -> FilePath [top'Package] :: TopLevel -> PackageID [IName String] [top'FDP] :: TopLevel -> Either ErrStr FileDescriptorProto [top'mVals] :: TopLevel -> EMap type ReMap = Map (FIName Utf8) ProtoName data NameMap NameMap :: (PackageID (FIName Utf8), [MName String], [MName String]) -> ReMap -> NameMap data PackageID a PackageID :: a -> PackageID a [_getPackageID] :: PackageID a -> a NoPackageID :: a -> PackageID a [_getNoPackageID] :: PackageID a -> a newtype LocalFP LocalFP :: FilePath -> LocalFP [unLocalFP] :: LocalFP -> FilePath newtype CanonFP CanonFP :: FilePath -> CanonFP [unCanonFP] :: CanonFP -> FilePath instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.Env instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.TopLevel instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.E'Entity instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.Entity instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.NameMap instance GHC.Classes.Ord Text.ProtocolBuffers.ProtoCompile.Resolve.CanonFP instance GHC.Classes.Eq Text.ProtocolBuffers.ProtoCompile.Resolve.CanonFP instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.CanonFP instance GHC.Read.Read Text.ProtocolBuffers.ProtoCompile.Resolve.CanonFP instance GHC.Classes.Ord Text.ProtocolBuffers.ProtoCompile.Resolve.LocalFP instance GHC.Classes.Eq Text.ProtocolBuffers.ProtoCompile.Resolve.LocalFP instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.LocalFP instance GHC.Read.Read Text.ProtocolBuffers.ProtoCompile.Resolve.LocalFP instance GHC.Show.Show a => GHC.Show.Show (Text.ProtocolBuffers.ProtoCompile.Resolve.PackageID a) instance GHC.Base.Functor Text.ProtocolBuffers.ProtoCompile.Resolve.PackageID instance GHC.Show.Show Text.ProtocolBuffers.ProtoCompile.Resolve.SEnv instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.EnumDescriptorProto.EnumDescriptorProto instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.EnumValueDescriptorProto.EnumValueDescriptorProto instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.MethodDescriptorProto.MethodDescriptorProto instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.ServiceDescriptorProto.ServiceDescriptorProto instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.FieldDescriptorProto.FieldDescriptorProto instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.FileDescriptorProto.FileDescriptorProto instance Text.ProtocolBuffers.ProtoCompile.Resolve.ConsumeUNO Text.DescriptorProtos.DescriptorProto.DescriptorProto -- | The MakeReflections module takes the -- FileDescriptorProto output from Resolve and produces -- a ProtoInfo from Reflections. This also takes a -- Haskell module prefix and the proto's package namespace as input. The -- output is suitable for passing to the Gen module to produce -- the files. -- -- This acheives several things: It moves the data from a nested tree to -- flat lists and maps. It moves the group information from the parent -- Descriptor to the actual Descriptor. It moves the data out of Maybe -- types. It converts Utf8 to String. Keys known to extend a Descriptor -- are listed in that Descriptor. -- -- In building the reflection info new things are computed. It changes -- dotted names to ProtoName using the translator from -- makeNameMaps. It parses the default value from the ByteString -- to a Haskell type. For fields, the value of the tag on the wire is -- computed and so is its size on the wire. module Text.ProtocolBuffers.ProtoCompile.MakeReflections makeProtoInfo :: (Bool, Bool, Bool) -> NameMap -> FileDescriptorProto -> ProtoInfo serializeFDP :: FileDescriptorProto -> ByteString