Parsetree

`sig
type constant =
Pconst_integer of string * char option
| Pconst_char of char
| Pconst_string of string * string option
| Pconst_float of string * char option
type attribute = string Asttypes.loc * Parsetree.payload
and extension = string Asttypes.loc * Parsetree.payload
and attributes = Parsetree.attribute list
and payload =
PStr of Parsetree.structure
| PSig of Parsetree.signature
| PTyp of Parsetree.core_type
| PPat of Parsetree.pattern * Parsetree.expression option
and core_type = {
ptyp_desc : Parsetree.core_type_desc;
ptyp_loc : Location.t;
ptyp_attributes : Parsetree.attributes;
}
and core_type_desc =
Ptyp_any
| Ptyp_var of string
| Ptyp_arrow of Asttypes.arg_label * Parsetree.core_type *
Parsetree.core_type
| Ptyp_tuple of Parsetree.core_type list
| Ptyp_constr of Longident.t Asttypes.loc * Parsetree.core_type list
| Ptyp_object of Parsetree.object_field list * Asttypes.closed_flag
| Ptyp_class of Longident.t Asttypes.loc * Parsetree.core_type list
| Ptyp_alias of Parsetree.core_type * string
| Ptyp_variant of Parsetree.row_field list * Asttypes.closed_flag *
Asttypes.label list option
| Ptyp_poly of string Asttypes.loc list * Parsetree.core_type
| Ptyp_package of Parsetree.package_type
| Ptyp_extension of Parsetree.extension
and package_type =
Longident.t Asttypes.loc *
(Longident.t Asttypes.loc * Parsetree.core_type) list
and row_field =
Rtag of Asttypes.label Asttypes.loc * Parsetree.attributes * bool *
Parsetree.core_type list
| Rinherit of Parsetree.core_type
and object_field =
Otag of Asttypes.label Asttypes.loc * Parsetree.attributes *
Parsetree.core_type
| Oinherit of Parsetree.core_type
and pattern = {
ppat_desc : Parsetree.pattern_desc;
ppat_loc : Location.t;
ppat_attributes : Parsetree.attributes;
}
and pattern_desc =
Ppat_any
| Ppat_var of string Asttypes.loc
| Ppat_alias of Parsetree.pattern * string Asttypes.loc
| Ppat_constant of Parsetree.constant
| Ppat_interval of Parsetree.constant * Parsetree.constant
| Ppat_tuple of Parsetree.pattern list
| Ppat_construct of Longident.t Asttypes.loc * Parsetree.pattern option
| Ppat_variant of Asttypes.label * Parsetree.pattern option
| Ppat_record of (Longident.t Asttypes.loc * Parsetree.pattern) list *
Asttypes.closed_flag
| Ppat_array of Parsetree.pattern list
| Ppat_or of Parsetree.pattern * Parsetree.pattern
| Ppat_constraint of Parsetree.pattern * Parsetree.core_type
| Ppat_type of Longident.t Asttypes.loc
| Ppat_lazy of Parsetree.pattern
| Ppat_unpack of string Asttypes.loc
| Ppat_exception of Parsetree.pattern
| Ppat_extension of Parsetree.extension
| Ppat_open of Longident.t Asttypes.loc * Parsetree.pattern
and expression = {
pexp_desc : Parsetree.expression_desc;
pexp_loc : Location.t;
pexp_attributes : Parsetree.attributes;
}
and expression_desc =
Pexp_ident of Longident.t Asttypes.loc
| Pexp_constant of Parsetree.constant
| Pexp_let of Asttypes.rec_flag * Parsetree.value_binding list *
Parsetree.expression
| Pexp_function of Parsetree.case list
| Pexp_fun of Asttypes.arg_label * Parsetree.expression option *
Parsetree.pattern * Parsetree.expression
| Pexp_apply of Parsetree.expression *
(Asttypes.arg_label * Parsetree.expression) list
| Pexp_match of Parsetree.expression * Parsetree.case list
| Pexp_try of Parsetree.expression * Parsetree.case list
| Pexp_tuple of Parsetree.expression list
| Pexp_construct of Longident.t Asttypes.loc *
Parsetree.expression option
| Pexp_variant of Asttypes.label * Parsetree.expression option
| Pexp_record of (Longident.t Asttypes.loc * Parsetree.expression) list *
Parsetree.expression option
| Pexp_field of Parsetree.expression * Longident.t Asttypes.loc
| Pexp_setfield of Parsetree.expression * Longident.t Asttypes.loc *
Parsetree.expression
| Pexp_array of Parsetree.expression list
| Pexp_ifthenelse of Parsetree.expression * Parsetree.expression *
Parsetree.expression option
| Pexp_sequence of Parsetree.expression * Parsetree.expression
| Pexp_while of Parsetree.expression * Parsetree.expression
| Pexp_for of Parsetree.pattern * Parsetree.expression *
Parsetree.expression * Asttypes.direction_flag * Parsetree.expression
| Pexp_constraint of Parsetree.expression * Parsetree.core_type
| Pexp_coerce of Parsetree.expression * Parsetree.core_type option *
Parsetree.core_type
| Pexp_send of Parsetree.expression * Asttypes.label Asttypes.loc
| Pexp_new of Longident.t Asttypes.loc
| Pexp_setinstvar of Asttypes.label Asttypes.loc * Parsetree.expression
| Pexp_override of
(Asttypes.label Asttypes.loc * Parsetree.expression) list
| Pexp_letmodule of string Asttypes.loc * Parsetree.module_expr *
Parsetree.expression
| Pexp_letexception of Parsetree.extension_constructor *
Parsetree.expression
| Pexp_assert of Parsetree.expression
| Pexp_lazy of Parsetree.expression
| Pexp_poly of Parsetree.expression * Parsetree.core_type option
| Pexp_object of Parsetree.class_structure
| Pexp_newtype of string Asttypes.loc * Parsetree.expression
| Pexp_pack of Parsetree.module_expr
| Pexp_open of Asttypes.override_flag * Longident.t Asttypes.loc *
Parsetree.expression
| Pexp_extension of Parsetree.extension
| Pexp_unreachable
and case = {
pc_lhs : Parsetree.pattern;
pc_guard : Parsetree.expression option;
pc_rhs : Parsetree.expression;
}
and value_description = {
pval_name : string Asttypes.loc;
pval_type : Parsetree.core_type;
pval_prim : string list;
pval_attributes : Parsetree.attributes;
pval_loc : Location.t;
}
and type_declaration = {
ptype_name : string Asttypes.loc;
ptype_params : (Parsetree.core_type * Asttypes.variance) list;
ptype_cstrs :
(Parsetree.core_type * Parsetree.core_type * Location.t) list;
ptype_kind : Parsetree.type_kind;
ptype_private : Asttypes.private_flag;
ptype_manifest : Parsetree.core_type option;
ptype_attributes : Parsetree.attributes;
ptype_loc : Location.t;
}
and type_kind =
Ptype_abstract
| Ptype_variant of Parsetree.constructor_declaration list
| Ptype_record of Parsetree.label_declaration list
| Ptype_open
and label_declaration = {
pld_name : string Asttypes.loc;
pld_mutable : Asttypes.mutable_flag;
pld_type : Parsetree.core_type;
pld_loc : Location.t;
pld_attributes : Parsetree.attributes;
}
and constructor_declaration = {
pcd_name : string Asttypes.loc;
pcd_args : Parsetree.constructor_arguments;
pcd_res : Parsetree.core_type option;
pcd_loc : Location.t;
pcd_attributes : Parsetree.attributes;
}
and constructor_arguments =
Pcstr_tuple of Parsetree.core_type list
| Pcstr_record of Parsetree.label_declaration list
and type_extension = {
ptyext_path : Longident.t Asttypes.loc;
ptyext_params : (Parsetree.core_type * Asttypes.variance) list;
ptyext_constructors : Parsetree.extension_constructor list;
ptyext_private : Asttypes.private_flag;
ptyext_attributes : Parsetree.attributes;
}
and extension_constructor = {
pext_name : string Asttypes.loc;
pext_kind : Parsetree.extension_constructor_kind;
pext_loc : Location.t;
pext_attributes : Parsetree.attributes;
}
and extension_constructor_kind =
Pext_decl of Parsetree.constructor_arguments *
Parsetree.core_type option
| Pext_rebind of Longident.t Asttypes.loc
and class_type = {
pcty_desc : Parsetree.class_type_desc;
pcty_loc : Location.t;
pcty_attributes : Parsetree.attributes;
}
and class_type_desc =
Pcty_constr of Longident.t Asttypes.loc * Parsetree.core_type list
| Pcty_signature of Parsetree.class_signature
| Pcty_arrow of Asttypes.arg_label * Parsetree.core_type *
Parsetree.class_type
| Pcty_extension of Parsetree.extension
| Pcty_open of Asttypes.override_flag * Longident.t Asttypes.loc *
Parsetree.class_type
and class_signature = {
pcsig_self : Parsetree.core_type;
pcsig_fields : Parsetree.class_type_field list;
}
and class_type_field = {
pctf_desc : Parsetree.class_type_field_desc;
pctf_loc : Location.t;
pctf_attributes : Parsetree.attributes;
}
and class_type_field_desc =
Pctf_inherit of Parsetree.class_type
| Pctf_val of
(Asttypes.label Asttypes.loc * Asttypes.mutable_flag *
Asttypes.virtual_flag * Parsetree.core_type)
| Pctf_method of
(Asttypes.label Asttypes.loc * Asttypes.private_flag *
Asttypes.virtual_flag * Parsetree.core_type)
| Pctf_constraint of (Parsetree.core_type * Parsetree.core_type)
| Pctf_attribute of Parsetree.attribute
| Pctf_extension of Parsetree.extension
and 'a class_infos = {
pci_virt : Asttypes.virtual_flag;
pci_params : (Parsetree.core_type * Asttypes.variance) list;
pci_name : string Asttypes.loc;
pci_expr : 'a;
pci_loc : Location.t;
pci_attributes : Parsetree.attributes;
}
and class_description = Parsetree.class_type Parsetree.class_infos
and class_type_declaration = Parsetree.class_type Parsetree.class_infos
and class_expr = {
pcl_desc : Parsetree.class_expr_desc;
pcl_loc : Location.t;
pcl_attributes : Parsetree.attributes;
}
and class_expr_desc =
Pcl_constr of Longident.t Asttypes.loc * Parsetree.core_type list
| Pcl_structure of Parsetree.class_structure
| Pcl_fun of Asttypes.arg_label * Parsetree.expression option *
Parsetree.pattern * Parsetree.class_expr
| Pcl_apply of Parsetree.class_expr *
(Asttypes.arg_label * Parsetree.expression) list
| Pcl_let of Asttypes.rec_flag * Parsetree.value_binding list *
Parsetree.class_expr
| Pcl_constraint of Parsetree.class_expr * Parsetree.class_type
| Pcl_extension of Parsetree.extension
| Pcl_open of Asttypes.override_flag * Longident.t Asttypes.loc *
Parsetree.class_expr
and class_structure = {
pcstr_self : Parsetree.pattern;
pcstr_fields : Parsetree.class_field list;
}
and class_field = {
pcf_desc : Parsetree.class_field_desc;
pcf_loc : Location.t;
pcf_attributes : Parsetree.attributes;
}
and class_field_desc =
Pcf_inherit of Asttypes.override_flag * Parsetree.class_expr *
string Asttypes.loc option
| Pcf_val of
(Asttypes.label Asttypes.loc * Asttypes.mutable_flag *
Parsetree.class_field_kind)
| Pcf_method of
(Asttypes.label Asttypes.loc * Asttypes.private_flag *
Parsetree.class_field_kind)
| Pcf_constraint of (Parsetree.core_type * Parsetree.core_type)
| Pcf_initializer of Parsetree.expression
| Pcf_attribute of Parsetree.attribute
| Pcf_extension of Parsetree.extension
and class_field_kind =
Cfk_virtual of Parsetree.core_type
| Cfk_concrete of Asttypes.override_flag * Parsetree.expression
and class_declaration = Parsetree.class_expr Parsetree.class_infos
and module_type = {
pmty_desc : Parsetree.module_type_desc;
pmty_loc : Location.t;
pmty_attributes : Parsetree.attributes;
}
and module_type_desc =
Pmty_ident of Longident.t Asttypes.loc
| Pmty_signature of Parsetree.signature
| Pmty_functor of string Asttypes.loc * Parsetree.module_type option *
Parsetree.module_type
| Pmty_with of Parsetree.module_type * Parsetree.with_constraint list
| Pmty_typeof of Parsetree.module_expr
| Pmty_extension of Parsetree.extension
| Pmty_alias of Longident.t Asttypes.loc
and signature = Parsetree.signature_item list
and signature_item = {
psig_desc : Parsetree.signature_item_desc;
psig_loc : Location.t;
}
and signature_item_desc =
Psig_value of Parsetree.value_description
| Psig_type of Asttypes.rec_flag * Parsetree.type_declaration list
| Psig_typext of Parsetree.type_extension
| Psig_exception of Parsetree.extension_constructor
| Psig_module of Parsetree.module_declaration
| Psig_recmodule of Parsetree.module_declaration list
| Psig_modtype of Parsetree.module_type_declaration
| Psig_open of Parsetree.open_description
| Psig_include of Parsetree.include_description
| Psig_class of Parsetree.class_description list
| Psig_class_type of Parsetree.class_type_declaration list
| Psig_attribute of Parsetree.attribute
| Psig_extension of Parsetree.extension * Parsetree.attributes
and module_declaration = {
pmd_name : string Asttypes.loc;
pmd_type : Parsetree.module_type;
pmd_attributes : Parsetree.attributes;
pmd_loc : Location.t;
}
and module_type_declaration = {
pmtd_name : string Asttypes.loc;
pmtd_type : Parsetree.module_type option;
pmtd_attributes : Parsetree.attributes;
pmtd_loc : Location.t;
}
and open_description = {
popen_lid : Longident.t Asttypes.loc;
popen_override : Asttypes.override_flag;
popen_loc : Location.t;
popen_attributes : Parsetree.attributes;
}
and 'a include_infos = {
pincl_mod : 'a;
pincl_loc : Location.t;
pincl_attributes : Parsetree.attributes;
}
and include_description = Parsetree.module_type Parsetree.include_infos
and include_declaration = Parsetree.module_expr Parsetree.include_infos
and with_constraint =
Pwith_type of Longident.t Asttypes.loc * Parsetree.type_declaration
| Pwith_module of Longident.t Asttypes.loc * Longident.t Asttypes.loc
| Pwith_typesubst of Longident.t Asttypes.loc *
Parsetree.type_declaration
| Pwith_modsubst of Longident.t Asttypes.loc * Longident.t Asttypes.loc
and module_expr = {
pmod_desc : Parsetree.module_expr_desc;
pmod_loc : Location.t;
pmod_attributes : Parsetree.attributes;
}
and module_expr_desc =
Pmod_ident of Longident.t Asttypes.loc
| Pmod_structure of Parsetree.structure
| Pmod_functor of string Asttypes.loc * Parsetree.module_type option *
Parsetree.module_expr
| Pmod_apply of Parsetree.module_expr * Parsetree.module_expr
| Pmod_constraint of Parsetree.module_expr * Parsetree.module_type
| Pmod_unpack of Parsetree.expression
| Pmod_extension of Parsetree.extension
and structure = Parsetree.structure_item list
and structure_item = {
pstr_desc : Parsetree.structure_item_desc;
pstr_loc : Location.t;
}
and structure_item_desc =
Pstr_eval of Parsetree.expression * Parsetree.attributes
| Pstr_value of Asttypes.rec_flag * Parsetree.value_binding list
| Pstr_primitive of Parsetree.value_description
| Pstr_type of Asttypes.rec_flag * Parsetree.type_declaration list
| Pstr_typext of Parsetree.type_extension
| Pstr_exception of Parsetree.extension_constructor
| Pstr_module of Parsetree.module_binding
| Pstr_recmodule of Parsetree.module_binding list
| Pstr_modtype of Parsetree.module_type_declaration
| Pstr_open of Parsetree.open_description
| Pstr_class of Parsetree.class_declaration list
| Pstr_class_type of Parsetree.class_type_declaration list
| Pstr_include of Parsetree.include_declaration
| Pstr_attribute of Parsetree.attribute
| Pstr_extension of Parsetree.extension * Parsetree.attributes
and value_binding = {
pvb_pat : Parsetree.pattern;
pvb_expr : Parsetree.expression;
pvb_attributes : Parsetree.attributes;
pvb_loc : Location.t;
}
and module_binding = {
pmb_name : string Asttypes.loc;
pmb_expr : Parsetree.module_expr;
pmb_attributes : Parsetree.attributes;
pmb_loc : Location.t;
}
type toplevel_phrase =
Ptop_def of Parsetree.structure
| Ptop_dir of string * Parsetree.directive_argument
and directive_argument =
Pdir_none
| Pdir_string of string
| Pdir_int of string * char option
| Pdir_ident of Longident.t
| Pdir_bool of bool
end`