Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Pretty a where
- pPrintPrec :: PrettyLevel -> Rational -> a -> Doc
- pPrint :: a -> Doc
- pPrintList :: PrettyLevel -> [a] -> Doc
- data DotProtoReservedField
- data DotProtoField
- data DotProtoMessagePart
- data RPCMethod = RPCMethod {}
- data DotProtoServicePart
- data Streaming
- data DotProtoEnumPart
- type DotProtoEnumValue = Int32
- data DotProtoType
- data Packing
- data DotProtoPrimType
- data DotProtoValue
- data DotProto = DotProto {}
- data DotProtoMeta = DotProtoMeta {}
- data DotProtoDefinition
- data DotProtoOption = DotProtoOption {}
- data DotProtoPackageSpec
- data DotProtoImportQualifier
- data DotProtoImport = DotProtoImport {}
- data DotProtoIdentifier
- newtype Path = Path {}
- newtype PackageName = PackageName {}
- newtype FieldName = FieldName {}
- newtype MessageName = MessageName {}
- fakePath :: Path
- data RenderingOptions = RenderingOptions {}
- defRenderingOptions :: RenderingOptions
- defSelectorName :: DotProtoIdentifier -> DotProtoIdentifier -> FieldNumber -> Doc
- defEnumMemberName :: DotProtoIdentifier -> DotProtoIdentifier -> Doc
- renderDotProto :: RenderingOptions -> DotProto -> Doc
- toProtoFile :: RenderingOptions -> DotProto -> String
- toProtoFileDef :: DotProto -> String
- packageFromDefs :: String -> [DotProtoDefinition] -> DotProto
- data ProtoParser a
- parseProto :: Path -> String -> Either ParseError DotProto
- parseProtoFile :: MonadIO m => Path -> FilePath -> m (Either ParseError DotProto)
- pOptionStmt :: ProtoParser DotProtoOption
- pFieldOptions :: ProtoParser [DotProtoOption]
- pFieldOptionStmt :: ProtoParser DotProtoOption
- pOptionId :: ProtoParser DotProtoIdentifier
- pOptionKw :: ProtoParser ()
- pExtendStmt :: ProtoParser (DotProtoIdentifier, [DotProtoMessagePart])
- pExtendKw :: ProtoParser ()
- typeLikeName :: MonadError CompileError m => String -> m String
- fieldLikeName :: String -> String
- prefixedEnumFieldName :: String -> String -> String
Documentation
Pretty printing class. The precedence level is used in a similar way as in
the Show
class. Minimal complete definition is either pPrintPrec
or
pPrint
.
pPrintPrec :: PrettyLevel -> Rational -> a -> Doc Source #
pPrintList :: PrettyLevel -> [a] -> Doc Source #
Instances
data DotProtoReservedField Source #
Instances
data DotProtoField Source #
Instances
data DotProtoMessagePart Source #
Instances
Instances
data DotProtoServicePart Source #
Instances
Instances
data DotProtoEnumPart Source #
DotProtoEnumField DotProtoIdentifier DotProtoEnumValue [DotProtoOption] | |
DotProtoEnumOption DotProtoOption | |
DotProtoEnumEmpty |
Instances
type DotProtoEnumValue = Int32 Source #
data DotProtoType Source #
This type is an almagamation of the modifiers used in types. It corresponds to a syntax role but not a semantic role, not all modifiers are meaningful in every type context.
Prim DotProtoPrimType | |
Repeated DotProtoPrimType | |
NestedRepeated DotProtoPrimType | |
Map DotProtoPrimType DotProtoPrimType |
Instances
Instances
data DotProtoPrimType Source #
Int32 | |
Int64 | |
SInt32 | |
SInt64 | |
UInt32 | |
UInt64 | |
Fixed32 | |
Fixed64 | |
SFixed32 | |
SFixed64 | |
String | |
Bytes | |
Bool | |
Float | |
Double | |
Named DotProtoIdentifier | A named type, referring to another message or enum defined in the same file |
Instances
data DotProtoValue Source #
Matches the definition of constant
in the proto3 language spec
These are only used as rvalues
Instances
This data structure represents a .proto file The actual source order of protobuf statements isn't meaningful so statements are sorted by type during parsing. A .proto file with more than one package declaration is considered invalid.
Instances
data DotProtoMeta Source #
Tracks misc metadata about the AST
DotProtoMeta | |
|
Instances
data DotProtoDefinition Source #
Top-level protocol definitions
DotProtoMessage String DotProtoIdentifier [DotProtoMessagePart] | |
DotProtoEnum String DotProtoIdentifier [DotProtoEnumPart] | |
DotProtoService String DotProtoIdentifier [DotProtoServicePart] |
Instances
data DotProtoOption Source #
An option id/value pair, can be attached to many types of statements
Instances
data DotProtoPackageSpec Source #
The namespace declaration
Instances
data DotProtoImportQualifier Source #
Instances
data DotProtoImport Source #
Top-level import declaration
Instances
data DotProtoIdentifier Source #
Instances
Instances
Eq Path Source # | |
Data Path Source # | |
Defined in Proto3.Suite.DotProto.AST gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Path -> c Path Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Path Source # toConstr :: Path -> Constr Source # dataTypeOf :: Path -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Path) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Path) Source # gmapT :: (forall b. Data b => b -> b) -> Path -> Path Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Path -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Path -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Path -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Path -> m Path Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Path -> m Path Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Path -> m Path Source # | |
Ord Path Source # | |
Show Path Source # | |
Generic Path Source # | |
type Rep Path Source # | |
Defined in Proto3.Suite.DotProto.AST |
newtype PackageName Source #
The name of the package
Instances
The name of some field
Instances
Eq FieldName Source # | |
Data FieldName Source # | |
Defined in Proto3.Suite.DotProto.AST gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FieldName -> c FieldName Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FieldName Source # toConstr :: FieldName -> Constr Source # dataTypeOf :: FieldName -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FieldName) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldName) Source # gmapT :: (forall b. Data b => b -> b) -> FieldName -> FieldName Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FieldName -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FieldName -> r Source # gmapQ :: (forall d. Data d => d -> u) -> FieldName -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> FieldName -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FieldName -> m FieldName Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldName -> m FieldName Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldName -> m FieldName Source # | |
Ord FieldName Source # | |
Defined in Proto3.Suite.DotProto.AST | |
Show FieldName Source # | |
IsString FieldName Source # | |
Defined in Proto3.Suite.DotProto.AST fromString :: String -> FieldName Source # | |
Generic FieldName Source # | |
type Rep FieldName Source # | |
Defined in Proto3.Suite.DotProto.AST |
newtype MessageName Source #
The name of a message
Instances
data RenderingOptions Source #
Options for rendering a .proto
file.
RenderingOptions | |
|
defRenderingOptions :: RenderingOptions Source #
Default rendering options.
defSelectorName :: DotProtoIdentifier -> DotProtoIdentifier -> FieldNumber -> Doc Source #
The default choice of field name for a selector.
defEnumMemberName :: DotProtoIdentifier -> DotProtoIdentifier -> Doc Source #
The default choice of enum member name for an enum
renderDotProto :: RenderingOptions -> DotProto -> Doc Source #
Traverses a DotProto AST and generates a .proto file from it
toProtoFile :: RenderingOptions -> DotProto -> String Source #
Render protobufs metadata as a .proto file stringy
toProtoFileDef :: DotProto -> String Source #
Render protobufs metadata as a .proto file string, using the default rendering options.
packageFromDefs :: String -> [DotProtoDefinition] -> DotProto Source #
data ProtoParser a Source #
Wrapper around Text.Parsec.String.Parser
, overriding whitespace lexing.
Instances
parseProto :: Path -> String -> Either ParseError DotProto Source #
parseProto mp inp
attempts to parse inp
as a DotProto
. mp
is the
module path to be injected into the AST as part of DotProtoMeta
metadata on
a successful parse.
parseProtoFile :: MonadIO m => Path -> FilePath -> m (Either ParseError DotProto) Source #
parseProtoFile mp fp
reads and parses the .proto file found at fp
. mp
is used downstream during code generation when we need to generate names
which are a function of the source .proto file's filename and its path
relative to some --includeDir
.
pOptionStmt :: ProtoParser DotProtoOption Source #
Parses a protobuf option that could appear in a service, RPC, message, enumeration, or at the top-level.
Since: 0.5.2
pFieldOptions :: ProtoParser [DotProtoOption] Source #
Parses zero or more message field options enclosed in square braces.
Since: 0.5.2
pFieldOptionStmt :: ProtoParser DotProtoOption Source #
Parses a protobuf option in the context of a message field's options.
Since: 0.5.2
pOptionId :: ProtoParser DotProtoIdentifier Source #
Parses a (qualified) identifier for a protobuf option.
Since: 0.5.2
pOptionKw :: ProtoParser () Source #
Parses a single keyword token "option".
Since: 0.5.2
pExtendKw :: ProtoParser () Source #
Parses a single keyword token "extend".
Since: 0.5.2
typeLikeName :: MonadError CompileError m => String -> m String Source #
produces either the pascal-cased version of the string typeLikeName
xsxs
if it begins with an alphabetical
character or underscore - which is replaced with X
. A CompileError
is emitted if the starting character is
non-alphabetic or if xs == ""
.
fieldLikeName :: String -> String Source #
is the casing transformation used to produce record selectors from message fields. If
fieldLikeName
fieldfield
is prefixed by a span of uppercase characters then that prefix will be lowercased while the remaining string
is left unchanged.