package tezos-protocol-012-Psithaca

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type var_annot = private
  1. | Var_annot of Non_empty_string.t
type type_annot = private
  1. | Type_annot of Non_empty_string.t
type field_annot = private
  1. | Field_annot of Non_empty_string.t
module FOR_TESTS : sig ... end

Default annotations

val default_now_annot : var_annot option
val default_amount_annot : var_annot option
val default_balance_annot : var_annot option
val default_level_annot : var_annot option
val default_source_annot : var_annot option
val default_sender_annot : var_annot option
val default_self_annot : var_annot option
val default_arg_annot : var_annot option
val lambda_arg_annot : var_annot option
val default_param_annot : var_annot option
val default_storage_annot : var_annot option
val default_sapling_state_annot : var_annot option
val default_sapling_balance_annot : var_annot option
val default_car_annot : field_annot option
val default_cdr_annot : field_annot option
val default_contract_annot : field_annot option
val default_addr_annot : field_annot option
val default_pack_annot : field_annot option
val default_unpack_annot : field_annot option
val default_slice_annot : field_annot option
val default_elt_annot : field_annot option
val default_key_annot : field_annot option
val default_hd_annot : field_annot option
val default_tl_annot : field_annot option
val default_some_annot : field_annot option
val default_left_annot : field_annot option
val default_right_annot : field_annot option

Unparse annotations to their string representation

val unparse_type_annot : type_annot option -> string list
val unparse_var_annot : var_annot option -> string list
val unparse_field_annot : field_annot option -> string list

Conversion functions between different annotation kinds

val field_to_var_annot : field_annot option -> var_annot option
val type_to_var_annot : type_annot option -> var_annot option
val var_to_field_annot : var_annot option -> field_annot option
val default_annot : default:'a option -> 'a option -> 'a option

Replace an annotation by its default value if it is None

val gen_access_annot : var_annot option -> ?default:field_annot option -> field_annot option -> var_annot option

Generate annotation for field accesses, of the form var.field1.field2

val merge_type_annot : legacy:bool -> type_annot option -> type_annot option -> (type_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Merge type annotations.

  • returns

    an error Inconsistent_type_annotations if they are both present and different, unless legacy

val merge_field_annot : legacy:bool -> field_annot option -> field_annot option -> (field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Merge field annotations.

  • returns

    an error Inconsistent_type_annotations if they are both present and different, unless legacy

val merge_var_annot : var_annot option -> var_annot option -> var_annot option

Merge variable annotations, does not fail (None if different).

val error_unexpected_annot : Alpha_context.Script.location -> 'a list -> (unit, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
  • returns

    an error Unexpected_annotation in the monad the list is not empty.

val parse_type_annot : Alpha_context.Script.location -> string list -> (type_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Parse a type annotation only.

val parse_field_annot : Alpha_context.Script.location -> string list -> (field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Parse a field annotation only.

val parse_composed_type_annot : Alpha_context.Script.location -> string list -> (type_annot option * field_annot option * field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Parse an annotation for composed types, of the form :ty_name %field1 %field2 in any order.

val extract_field_annot : Alpha_context.Script.node -> (Alpha_context.Script.node * field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Extract and remove a field annotation from a node

val check_correct_field : field_annot option -> field_annot option -> (unit, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Check that field annotations match, used for field accesses.

Instruction annotations parsing

val parse_var_annot : Alpha_context.Script.location -> ?default:var_annot option -> string list -> (var_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result

Parse a variable annotation, replaced by a default value if None.

val is_allowed_char : char -> bool
val parse_constr_annot : Alpha_context.Script.location -> ?if_special_first:field_annot option -> ?if_special_second:field_annot option -> string list -> (var_annot option * type_annot option * field_annot option * field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
val parse_two_var_annot : Alpha_context.Script.location -> string list -> (var_annot option * var_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
val parse_destr_annot : Alpha_context.Script.location -> string list -> default_accessor:field_annot option -> field_name:field_annot option -> pair_annot:var_annot option -> value_annot:var_annot option -> (var_annot option * field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
val parse_unpair_annot : Alpha_context.Script.location -> string list -> field_name_car:field_annot option -> field_name_cdr:field_annot option -> pair_annot:var_annot option -> value_annot_car:var_annot option -> value_annot_cdr:var_annot option -> (var_annot option * var_annot option * field_annot option * field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
val parse_entrypoint_annot : Alpha_context.Script.location -> ?default:var_annot option -> string list -> (var_annot option * field_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
val parse_var_type_annot : Alpha_context.Script.location -> string list -> (var_annot option * type_annot option, Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.error Tezos_protocol_environment_012_Psithaca__Environment.Error_monad.trace) result
OCaml

Innovation. Community. Security.