package ocaml-protoc

  1. Overview
  2. Docs
Protobuf compiler for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

2.4.0.tar.gz
md5=8a294e86c6202b8ec8016e71d19264cb
sha512=67020bef50b59c6590c1b25d85a75d6e19d6cd37d42b87c94aef798bff51a45f38fe7024b4c67d71c22c13d3f2776bec83acd77794a518f1c4a7eddfc30b6d0b

doc/ocaml-protoc.compiler-lib/Ocaml_protoc_compiler_lib/Pb_typing_type_tree/index.html

Module Ocaml_protoc_compiler_lib.Pb_typing_type_treeSource

Protobuf typed tree.

The typetree type is parametrized to allow for 2 phase compilation.

Sourcetype ('a, 'b) field = {
  1. field_parsed : 'b Pt.field;
  2. field_type : 'a Pb_field_type.t;
  3. field_default : Pb_option.constant option;
  4. field_options : Pb_option.set;
}

Field definition.

  • 'a is for unresolved or resolved
  • 'b is for field_label to account for both normal and one of fields.
Sourcetype 'a oneof_field = ('a, Pt.oneof_field_label) field
Sourcetype 'a message_field = ('a, Pt.message_field_label) field
Sourcetype 'a map_field = {
  1. map_name : string;
  2. map_number : int;
  3. map_key_type : Pb_field_type.map_key_type;
  4. map_value_type : 'a Pb_field_type.t;
  5. map_options : Pb_option.set;
}

Map definition

Sourcetype 'a oneof = {
  1. oneof_name : string;
  2. oneof_fields : 'a oneof_field list;
}

Oneof definition

Sourcetype type_scope = {
  1. packages : string list;
  2. message_names : string list;
}

Type scope

The scope of a type (message or enum) is defined by the package (defined in the top of the proto file as well as the messages above it since a message definition can be nested

Sourcetype 'a message_body_content =
  1. | Message_field of 'a message_field
  2. | Message_oneof_field of 'a oneof
  3. | Message_map_field of 'a map_field

item for the message body

Sourceand 'a message = {
  1. extensions : Pt.extension_range list;
  2. message_options : Pb_option.set;
  3. message_name : string;
  4. message_body : 'a message_body_content list;
}
Sourcetype enum_value = {
  1. enum_value_name : string;
  2. enum_value_int : int;
}
Sourcetype enum = {
  1. enum_name : string;
  2. enum_values : enum_value list;
  3. enum_options : Pb_option.set;
}
Sourcetype 'a proto_type_spec =
  1. | Enum of enum
  2. | Message of 'a message
Sourcetype 'a proto_type = {
  1. scope : type_scope;
  2. id : int;
  3. file_name : string;
  4. file_options : Pb_option.set;
  5. spec : 'a proto_type_spec;
}
Sourcetype 'a proto = 'a proto_type list