Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains a near-direct translation of the proto3 grammar It uses String for easier compatibility with DotProto.Generator, which needs it for not very good reasons
Synopsis
- data ProtoParser a
- runProtoParser :: ProtoParser a -> Parser 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 ()
Documentation
data ProtoParser a Source #
Wrapper around Text.Parsec.String.Parser
, overriding whitespace lexing.
Instances
runProtoParser :: ProtoParser a -> Parser a Source #
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
.
Option Parsers
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
Extension Parsers
pExtendKw :: ProtoParser () Source #
Parses a single keyword token "extend".
Since: 0.5.2