thrift_parser (thrift_generator v0.7.0)

View Source

Summary

Types

annotations/0

-type annotations() :: #{binary() := true | binary()}.

ast_node/0

-type ast_node() ::
          #thrift_generator_node{line :: non_neg_integer(),
                                 col :: non_neg_integer(),
                                 doc :: doc(),
                                 annotations :: erl_annotations(),
                                 payload :: term(),
                                 type_module :: module()}.

base_type/0

-type base_type() :: bool | i8 | i16 | i32 | i64 | double | string | binary | uuid.

const_value/0

-type const_value() ::
          {ref, Name :: binary()} |
          boolean() |
          integer() |
          float() |
          binary() |
          {list, [const_value()]} |
          {map, [{const_value(), const_value()}]}.

constant/0

-type constant() ::
          #thrift_generator_constant{name :: constant_name(),
                                     type :: thrift_type(),
                                     value :: const_value()}.

constant_name/0

-nominal constant_name() :: binary().

cpp_include/0

-type cpp_include() :: #thrift_generator_cpp_include{path :: include_path()}.

doc/0

-type doc() :: binary() | undefined.

document/0

-type document() :: #thrift_generator_document{headers :: [ast_node()], definitions :: [ast_node()]}.

enum_/0

-type enum_() :: #thrift_generator_enum{name :: enum_name(), values :: [enum_value()]}.

enum_name/0

-nominal enum_name() :: binary().

enum_value/0

-type enum_value() :: {Name :: binary(), Value :: integer() | undefined, annotations(), doc()}.

erl_annotations/0

-type erl_annotations() :: #{atom() := true | binary()}.

exception_/0

-type exception_() :: #thrift_generator_exception{name :: exception_name(), fields :: [ast_node()]}.

exception_name/0

-nominal exception_name() :: binary().

field_/0

-type field_() ::
          #thrift_generator_field{id :: integer() | undefined,
                                  required :: requiredness(),
                                  type :: thrift_type(),
                                  name :: field_name(),
                                  default :: const_value() | undefined}.

field_name/0

-nominal field_name() :: binary().

function_/0

-type function_() ::
          #thrift_generator_function{oneway :: boolean(),
                                     return_type :: thrift_type() | void,
                                     name :: function_name(),
                                     fields :: [ast_node()],
                                     throws :: [ast_node()]}.

function_name/0

-nominal function_name() :: binary().

include_/0

-type include_() :: #thrift_generator_include{path :: include_path()}.

include_path/0

-nominal include_path() :: binary().

namespace_/0

-type namespace_() :: #thrift_generator_namespace{scope :: namespace_scope(), name :: namespace_name()}.

namespace_name/0

-nominal namespace_name() :: binary().

namespace_scope/0

-nominal namespace_scope() :: binary().

node_payload/0

-type node_payload() ::
          document() |
          include_() |
          cpp_include() |
          namespace_() |
          constant() |
          typedef() |
          enum_() |
          struct_() |
          union_def() |
          exception_() |
          service() |
          function_() |
          field_().

requiredness/0

-type requiredness() :: required | optional | default.

service/0

-type service() ::
          #thrift_generator_service{name :: service_name(),
                                    extends :: service_parent() | undefined,
                                    functions :: [ast_node()]}.

service_name/0

-nominal service_name() :: binary().

service_parent/0

-nominal service_parent() :: binary().

struct_/0

-type struct_() :: #thrift_generator_struct{name :: struct_name(), fields :: [ast_node()]}.

struct_name/0

-nominal struct_name() :: binary().

thrift_type/0

-type thrift_type() ::
          {base, base_type(), annotations()} |
          type_ref() |
          {list, Element :: thrift_type(), annotations()} |
          {set, Element :: thrift_type(), annotations()} |
          {map, Key :: thrift_type(), Value :: thrift_type(), annotations()}.

type_ref/0

-type type_ref() :: {ref, Name :: binary(), annotations()}.

typedef/0

-type typedef() :: #thrift_generator_typedef{name :: typedef_name(), type :: thrift_type()}.

typedef_name/0

-nominal typedef_name() :: binary().

union_def/0

-type union_def() :: #thrift_generator_union{name :: union_name(), fields :: [ast_node()]}.

union_name/0

-nominal union_name() :: binary().

yecc_ret/0

-type yecc_ret() :: {error, _} | {ok, _}.

Functions

format_error(Message)

-spec format_error(any()) -> [char() | list()].

parse(Tokens)

-spec parse(Tokens :: list()) -> yecc_ret().

parse_and_scan(_)

-spec parse_and_scan({function() | {atom(), atom()}, [_]} | {atom(), atom(), [_]}) -> yecc_ret().