packages feed

language-protobuf 1.0 → 1.0.1

raw patch · 3 files changed

+25/−17 lines, 3 files

Files

language-protobuf.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/  name:                language-protobuf-version:             1.0+version:             1.0.1 synopsis:            Language definition and parser for Protocol Buffers. description:         Language definition and parser for Protocol Buffers files, according to <https://developers.google.com/protocol-buffers/docs/reference/proto3-spec>. -- bug-reports:
src/Language/ProtocolBuffers/Parser.hs view
@@ -68,10 +68,15 @@ constant    =   KFloat  <$> floating   <|> KInt    <$> number-  <|> KString <$> stringLiteral+  <|> KString . T.concat <$> ((:) <$> stringLiteral' <*> many stringLiteral')   <|> KBool True  <$ reserved "true"   <|> KBool False <$ reserved "false"+  <|> KObject     <$> betweenBraces (many objectField)   <|> KIdentifier <$> fullIdentifier+  where stringLiteral' = stringLiteral <* optional spaceConsumer+        objectField = (,) <$> identifier+                          <*> (   symbol ":" *> constant+                              <|> KObject <$> betweenBraces (many objectField) )  optionName :: MonadParsec Char T.Text m => m FullIdentifier optionName = (++) <$> ((: []) <$> identifier <|> betweenParens fullIdentifier)@@ -91,18 +96,20 @@            <*> constant  wholeProtoBuf :: MonadParsec Char T.Text m => m ProtoBuf-wholeProtoBuf = declsToProtoBuf <$> many declaration+wholeProtoBuf = declsToProtoBuf <$ spaceConsumer <*> many declaration  declaration :: MonadParsec Char T.Text m => m Declaration-declaration-  =   DSyntax  <$ reserved "syntax" <* symbol "=" <*> stringLiteral <* symbol ";"-  <|> DImport  <$ reserved "import"-               <*> (Weak <$ reserved "weak" <|> Public <$ reserved "public" <|> pure Normal)-               <*> stringLiteral <* symbol ";"-  <|> DPackage <$ reserved "package" <*> fullIdentifier <* symbol ";"-  <|> DOption  <$> topOption-  <|> DType    <$> typeDeclaration-  <|> DService <$> serviceDeclaration+declaration = spaceConsumer *> declaration'+  where +    declaration'+      =   DSyntax  <$ reserved "syntax" <* symbol "=" <*> stringLiteral <* symbol ";"+      <|> DImport  <$ reserved "import"+                   <*> (Weak <$ reserved "weak" <|> Public <$ reserved "public" <|> pure Normal)+                   <*> stringLiteral <* symbol ";"+      <|> DPackage <$ reserved "package" <*> fullIdentifier <* symbol ";"+      <|> DOption  <$> topOption+      <|> DType    <$> typeDeclaration+      <|> DService <$> serviceDeclaration  typeDeclaration :: MonadParsec Char T.Text m => m TypeDeclaration typeDeclaration
src/Language/ProtocolBuffers/Types.hs view
@@ -72,11 +72,12 @@   deriving (Eq, Show)  data Constant where-  KIdentifier :: FullIdentifier -> Constant-  KInt        :: Integer        -> Constant-  KFloat      :: Float          -> Constant-  KString     :: T.Text         -> Constant-  KBool       :: Bool           -> Constant+  KIdentifier :: FullIdentifier       -> Constant+  KInt        :: Integer              -> Constant+  KFloat      :: Float                -> Constant+  KString     :: T.Text               -> Constant+  KBool       :: Bool                 -> Constant+  KObject     :: [(T.Text, Constant)] -> Constant   deriving (Eq, Show)  data EnumField where