Ast_builder.Make
Build Ast helpers with the location argument factorized.
module Located : sig ... end
include sig ... end
val loc : Location.t
val attribute :
name:string Astlib.Location.loc ->
payload:Astlib.Ast_500.Parsetree.payload ->
Astlib.Ast_500.Parsetree.attribute
val binding_op :
op:string Astlib.Location.loc ->
pat:Astlib.Ast_500.Parsetree.pattern ->
exp:Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.binding_op
val case :
lhs:Astlib.Ast_500.Parsetree.pattern ->
guard:Astlib.Ast_500.Parsetree.expression option ->
rhs:Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.case
val pcl_constr :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.core_type list ->
Astlib.Ast_500.Parsetree.class_expr
val pcl_structure :
Astlib.Ast_500.Parsetree.class_structure ->
Astlib.Ast_500.Parsetree.class_expr
val pcl_constraint :
Astlib.Ast_500.Parsetree.class_expr ->
Astlib.Ast_500.Parsetree.class_type ->
Astlib.Ast_500.Parsetree.class_expr
val pcl_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.class_expr
val pcf_inherit :
Astlib.Ast_500.Asttypes.override_flag ->
Astlib.Ast_500.Parsetree.class_expr ->
string Astlib.Location.loc option ->
Astlib.Ast_500.Parsetree.class_field
val pcf_val :
(string Astlib.Location.loc
* Astlib.Ast_500.Asttypes.mutable_flag
* Astlib.Ast_500.Parsetree.class_field_kind) ->
Astlib.Ast_500.Parsetree.class_field
val pcf_method :
(string Astlib.Location.loc
* Astlib.Ast_500.Asttypes.private_flag
* Astlib.Ast_500.Parsetree.class_field_kind) ->
Astlib.Ast_500.Parsetree.class_field
val pcf_constraint :
(Astlib.Ast_500.Parsetree.core_type * Astlib.Ast_500.Parsetree.core_type) ->
Astlib.Ast_500.Parsetree.class_field
val pcf_initializer :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.class_field
val pcf_attribute :
Astlib.Ast_500.Parsetree.attribute ->
Astlib.Ast_500.Parsetree.class_field
val pcf_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.class_field
val class_infos :
virt:Astlib.Ast_500.Asttypes.virtual_flag ->
params:
(Astlib.Ast_500.Parsetree.core_type
* (Astlib.Ast_500.Asttypes.variance * Astlib.Ast_500.Asttypes.injectivity))
list ->
name:string Astlib.Location.loc ->
expr:'a ->
'a Astlib.Ast_500.Parsetree.class_infos
val class_signature :
self:Astlib.Ast_500.Parsetree.core_type ->
fields:Astlib.Ast_500.Parsetree.class_type_field list ->
Astlib.Ast_500.Parsetree.class_signature
val class_structure :
self:Astlib.Ast_500.Parsetree.pattern ->
fields:Astlib.Ast_500.Parsetree.class_field list ->
Astlib.Ast_500.Parsetree.class_structure
val pcty_constr :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.core_type list ->
Astlib.Ast_500.Parsetree.class_type
val pcty_signature :
Astlib.Ast_500.Parsetree.class_signature ->
Astlib.Ast_500.Parsetree.class_type
val pcty_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.class_type
val pctf_inherit :
Astlib.Ast_500.Parsetree.class_type ->
Astlib.Ast_500.Parsetree.class_type_field
val pctf_constraint :
(Astlib.Ast_500.Parsetree.core_type * Astlib.Ast_500.Parsetree.core_type) ->
Astlib.Ast_500.Parsetree.class_type_field
val pctf_attribute :
Astlib.Ast_500.Parsetree.attribute ->
Astlib.Ast_500.Parsetree.class_type_field
val pctf_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.class_type_field
val ptyp_any : Astlib.Ast_500.Parsetree.core_type
val ptyp_var : string -> Astlib.Ast_500.Parsetree.core_type
val ptyp_tuple :
Astlib.Ast_500.Parsetree.core_type list ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_constr :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.core_type list ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_object :
Astlib.Ast_500.Parsetree.object_field list ->
Astlib.Ast_500.Asttypes.closed_flag ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_class :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.core_type list ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_alias :
Astlib.Ast_500.Parsetree.core_type ->
string ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_variant :
Astlib.Ast_500.Parsetree.row_field list ->
Astlib.Ast_500.Asttypes.closed_flag ->
string list option ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_poly :
string Astlib.Location.loc list ->
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_package :
(Astlib.Longident.t Astlib.Location.loc
* (Astlib.Longident.t Astlib.Location.loc
* Astlib.Ast_500.Parsetree.core_type)
list) ->
Astlib.Ast_500.Parsetree.core_type
val ptyp_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.core_type
val pdir_string : string -> Astlib.Ast_500.Parsetree.directive_argument
val pdir_int :
string ->
char option ->
Astlib.Ast_500.Parsetree.directive_argument
val pdir_ident :
Astlib.Longident.t ->
Astlib.Ast_500.Parsetree.directive_argument
val pdir_bool : bool -> Astlib.Ast_500.Parsetree.directive_argument
val pexp_ident :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.expression
val pexp_constant :
Astlib.Ast_500.Parsetree.constant ->
Astlib.Ast_500.Parsetree.expression
val pexp_function :
Astlib.Ast_500.Parsetree.case list ->
Astlib.Ast_500.Parsetree.expression
val pexp_apply :
Astlib.Ast_500.Parsetree.expression ->
(Astlib.Ast_500.Asttypes.arg_label * Astlib.Ast_500.Parsetree.expression)
list ->
Astlib.Ast_500.Parsetree.expression
val pexp_match :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.case list ->
Astlib.Ast_500.Parsetree.expression
val pexp_try :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.case list ->
Astlib.Ast_500.Parsetree.expression
val pexp_tuple :
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression
val pexp_construct :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.expression option ->
Astlib.Ast_500.Parsetree.expression
val pexp_variant :
string ->
Astlib.Ast_500.Parsetree.expression option ->
Astlib.Ast_500.Parsetree.expression
val pexp_record :
(Astlib.Longident.t Astlib.Location.loc * Astlib.Ast_500.Parsetree.expression)
list ->
Astlib.Ast_500.Parsetree.expression option ->
Astlib.Ast_500.Parsetree.expression
val pexp_array :
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression
val pexp_ifthenelse :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression option ->
Astlib.Ast_500.Parsetree.expression
val pexp_sequence :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_constraint :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.expression
val pexp_coerce :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.core_type option ->
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.expression
val pexp_send :
Astlib.Ast_500.Parsetree.expression ->
string Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.expression
val pexp_new :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.expression
val pexp_setinstvar :
string Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_override :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.expression) list ->
Astlib.Ast_500.Parsetree.expression
val pexp_letmodule :
string option Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.module_expr ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_letexception :
Astlib.Ast_500.Parsetree.extension_constructor ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_assert :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_lazy :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_poly :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.core_type option ->
Astlib.Ast_500.Parsetree.expression
val pexp_object :
Astlib.Ast_500.Parsetree.class_structure ->
Astlib.Ast_500.Parsetree.expression
val pexp_newtype :
string Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val pexp_pack :
Astlib.Ast_500.Parsetree.module_expr ->
Astlib.Ast_500.Parsetree.expression
val pexp_letop :
Astlib.Ast_500.Parsetree.letop ->
Astlib.Ast_500.Parsetree.expression
val pexp_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.expression
val pexp_unreachable : Astlib.Ast_500.Parsetree.expression
val extension_constructor :
name:string Astlib.Location.loc ->
kind:Astlib.Ast_500.Parsetree.extension_constructor_kind ->
Astlib.Ast_500.Parsetree.extension_constructor
val include_infos : 'a -> 'a Astlib.Ast_500.Parsetree.include_infos
val label_declaration :
name:string Astlib.Location.loc ->
mutable_:Astlib.Ast_500.Asttypes.mutable_flag ->
type_:Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.label_declaration
val letop :
let_:Astlib.Ast_500.Parsetree.binding_op ->
ands:Astlib.Ast_500.Parsetree.binding_op list ->
body:Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.letop
val location :
start:Lexing.position ->
end_:Lexing.position ->
ghost:bool ->
Astlib.Location.t
val module_binding :
name:string option Astlib.Location.loc ->
expr:Astlib.Ast_500.Parsetree.module_expr ->
Astlib.Ast_500.Parsetree.module_binding
val module_declaration :
name:string option Astlib.Location.loc ->
type_:Astlib.Ast_500.Parsetree.module_type ->
Astlib.Ast_500.Parsetree.module_declaration
val pmod_ident :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.module_expr
val pmod_structure :
Astlib.Ast_500.Parsetree.structure_item list ->
Astlib.Ast_500.Parsetree.module_expr
val pmod_constraint :
Astlib.Ast_500.Parsetree.module_expr ->
Astlib.Ast_500.Parsetree.module_type ->
Astlib.Ast_500.Parsetree.module_expr
val pmod_unpack :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.module_expr
val pmod_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.module_expr
val module_substitution :
name:string Astlib.Location.loc ->
manifest:Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.module_substitution
val pmty_ident :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.module_type
val pmty_signature :
Astlib.Ast_500.Parsetree.signature_item list ->
Astlib.Ast_500.Parsetree.module_type
val pmty_with :
Astlib.Ast_500.Parsetree.module_type ->
Astlib.Ast_500.Parsetree.with_constraint list ->
Astlib.Ast_500.Parsetree.module_type
val pmty_typeof :
Astlib.Ast_500.Parsetree.module_expr ->
Astlib.Ast_500.Parsetree.module_type
val pmty_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.module_type
val pmty_alias :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.module_type
val module_type_declaration :
name:string Astlib.Location.loc ->
type_:Astlib.Ast_500.Parsetree.module_type option ->
Astlib.Ast_500.Parsetree.module_type_declaration
val otag :
string Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.object_field
val oinherit :
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.object_field
val open_infos :
expr:'a ->
override:Astlib.Ast_500.Asttypes.override_flag ->
'a Astlib.Ast_500.Parsetree.open_infos
val ppat_any : Astlib.Ast_500.Parsetree.pattern
val ppat_var : string Astlib.Location.loc -> Astlib.Ast_500.Parsetree.pattern
val ppat_alias :
Astlib.Ast_500.Parsetree.pattern ->
string Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.pattern
val ppat_constant :
Astlib.Ast_500.Parsetree.constant ->
Astlib.Ast_500.Parsetree.pattern
val ppat_interval :
Astlib.Ast_500.Parsetree.constant ->
Astlib.Ast_500.Parsetree.constant ->
Astlib.Ast_500.Parsetree.pattern
val ppat_tuple :
Astlib.Ast_500.Parsetree.pattern list ->
Astlib.Ast_500.Parsetree.pattern
val ppat_variant :
string ->
Astlib.Ast_500.Parsetree.pattern option ->
Astlib.Ast_500.Parsetree.pattern
val ppat_record :
(Astlib.Longident.t Astlib.Location.loc * Astlib.Ast_500.Parsetree.pattern)
list ->
Astlib.Ast_500.Asttypes.closed_flag ->
Astlib.Ast_500.Parsetree.pattern
val ppat_array :
Astlib.Ast_500.Parsetree.pattern list ->
Astlib.Ast_500.Parsetree.pattern
val ppat_constraint :
Astlib.Ast_500.Parsetree.pattern ->
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.pattern
val ppat_type :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.pattern
val ppat_lazy :
Astlib.Ast_500.Parsetree.pattern ->
Astlib.Ast_500.Parsetree.pattern
val ppat_unpack :
string option Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.pattern
val ppat_exception :
Astlib.Ast_500.Parsetree.pattern ->
Astlib.Ast_500.Parsetree.pattern
val ppat_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.pattern
val position :
fname:string ->
lnum:int ->
bol:int ->
cnum:int ->
Lexing.position
val rtag :
string Astlib.Location.loc ->
bool ->
Astlib.Ast_500.Parsetree.core_type list ->
Astlib.Ast_500.Parsetree.row_field
val rinherit :
Astlib.Ast_500.Parsetree.core_type ->
Astlib.Ast_500.Parsetree.row_field
val psig_value :
Astlib.Ast_500.Parsetree.value_description ->
Astlib.Ast_500.Parsetree.signature_item
val psig_type :
Astlib.Ast_500.Asttypes.rec_flag ->
Astlib.Ast_500.Parsetree.type_declaration list ->
Astlib.Ast_500.Parsetree.signature_item
val psig_typesubst :
Astlib.Ast_500.Parsetree.type_declaration list ->
Astlib.Ast_500.Parsetree.signature_item
val psig_typext :
Astlib.Ast_500.Parsetree.type_extension ->
Astlib.Ast_500.Parsetree.signature_item
val psig_exception :
Astlib.Ast_500.Parsetree.type_exception ->
Astlib.Ast_500.Parsetree.signature_item
val psig_module :
Astlib.Ast_500.Parsetree.module_declaration ->
Astlib.Ast_500.Parsetree.signature_item
val psig_modsubst :
Astlib.Ast_500.Parsetree.module_substitution ->
Astlib.Ast_500.Parsetree.signature_item
val psig_recmodule :
Astlib.Ast_500.Parsetree.module_declaration list ->
Astlib.Ast_500.Parsetree.signature_item
val psig_modtype :
Astlib.Ast_500.Parsetree.module_type_declaration ->
Astlib.Ast_500.Parsetree.signature_item
val psig_modtypesubst :
Astlib.Ast_500.Parsetree.module_type_declaration ->
Astlib.Ast_500.Parsetree.signature_item
val psig_class_type :
Astlib.Ast_500.Parsetree.class_type Astlib.Ast_500.Parsetree.class_infos list ->
Astlib.Ast_500.Parsetree.signature_item
val psig_attribute :
Astlib.Ast_500.Parsetree.attribute ->
Astlib.Ast_500.Parsetree.signature_item
val psig_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.attribute list ->
Astlib.Ast_500.Parsetree.signature_item
val pstr_eval :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.attribute list ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_value :
Astlib.Ast_500.Asttypes.rec_flag ->
Astlib.Ast_500.Parsetree.value_binding list ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_primitive :
Astlib.Ast_500.Parsetree.value_description ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_type :
Astlib.Ast_500.Asttypes.rec_flag ->
Astlib.Ast_500.Parsetree.type_declaration list ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_typext :
Astlib.Ast_500.Parsetree.type_extension ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_exception :
Astlib.Ast_500.Parsetree.type_exception ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_module :
Astlib.Ast_500.Parsetree.module_binding ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_recmodule :
Astlib.Ast_500.Parsetree.module_binding list ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_modtype :
Astlib.Ast_500.Parsetree.module_type_declaration ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_class_type :
Astlib.Ast_500.Parsetree.class_type Astlib.Ast_500.Parsetree.class_infos list ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_attribute :
Astlib.Ast_500.Parsetree.attribute ->
Astlib.Ast_500.Parsetree.structure_item
val pstr_extension :
(string Astlib.Location.loc * Astlib.Ast_500.Parsetree.payload) ->
Astlib.Ast_500.Parsetree.attribute list ->
Astlib.Ast_500.Parsetree.structure_item
val toplevel_directive :
name:string Astlib.Location.loc ->
arg:Astlib.Ast_500.Parsetree.directive_argument option ->
Astlib.Ast_500.Parsetree.toplevel_directive
val type_declaration :
name:string Astlib.Location.loc ->
params:
(Astlib.Ast_500.Parsetree.core_type
* (Astlib.Ast_500.Asttypes.variance * Astlib.Ast_500.Asttypes.injectivity))
list ->
cstrs:
(Astlib.Ast_500.Parsetree.core_type
* Astlib.Ast_500.Parsetree.core_type
* Astlib.Location.t)
list ->
kind:Astlib.Ast_500.Parsetree.type_kind ->
private_:Astlib.Ast_500.Asttypes.private_flag ->
manifest:Astlib.Ast_500.Parsetree.core_type option ->
Astlib.Ast_500.Parsetree.type_declaration
val type_exception :
Astlib.Ast_500.Parsetree.extension_constructor ->
Astlib.Ast_500.Parsetree.type_exception
val type_extension :
path:Astlib.Longident.t Astlib.Location.loc ->
params:
(Astlib.Ast_500.Parsetree.core_type
* (Astlib.Ast_500.Asttypes.variance * Astlib.Ast_500.Asttypes.injectivity))
list ->
constructors:Astlib.Ast_500.Parsetree.extension_constructor list ->
private_:Astlib.Ast_500.Asttypes.private_flag ->
Astlib.Ast_500.Parsetree.type_extension
val value_binding :
pat:Astlib.Ast_500.Parsetree.pattern ->
expr:Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.value_binding
val value_description :
name:string Astlib.Location.loc ->
type_:Astlib.Ast_500.Parsetree.core_type ->
prim:string list ->
Astlib.Ast_500.Parsetree.value_description
val eint : int -> Astlib.Ast_500.Parsetree.expression
val echar : char -> Astlib.Ast_500.Parsetree.expression
val estring : string -> Astlib.Ast_500.Parsetree.expression
val efloat : string -> Astlib.Ast_500.Parsetree.expression
val eint32 : int32 -> Astlib.Ast_500.Parsetree.expression
val eint64 : int64 -> Astlib.Ast_500.Parsetree.expression
val enativeint : nativeint -> Astlib.Ast_500.Parsetree.expression
val ebool : bool -> Astlib.Ast_500.Parsetree.expression
val pint : int -> Astlib.Ast_500.Parsetree.pattern
val pchar : char -> Astlib.Ast_500.Parsetree.pattern
val pstring : string -> Astlib.Ast_500.Parsetree.pattern
val pfloat : string -> Astlib.Ast_500.Parsetree.pattern
val pint32 : int32 -> Astlib.Ast_500.Parsetree.pattern
val pint64 : int64 -> Astlib.Ast_500.Parsetree.pattern
val pnativeint : nativeint -> Astlib.Ast_500.Parsetree.pattern
val pbool : bool -> Astlib.Ast_500.Parsetree.pattern
val eunit : Astlib.Ast_500.Parsetree.expression
val punit : Astlib.Ast_500.Parsetree.pattern
val evar : string -> Astlib.Ast_500.Parsetree.expression
evar id
produces a Pexp_ident _
expression, it parses its input so you can pass any dot-separated identifier, for instance: evar ~loc "Foo.bar"
.
val pvar : string -> Astlib.Ast_500.Parsetree.pattern
val eapply :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression
Same as pexp_apply but without labels
val eabstract :
Astlib.Ast_500.Parsetree.pattern list ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val esequence :
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression
val ppat_tuple_opt :
Astlib.Ast_500.Parsetree.pattern list ->
Astlib.Ast_500.Parsetree.pattern option
val pexp_tuple_opt :
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression option
val pconstruct :
Astlib.Ast_500.Parsetree.constructor_declaration ->
Astlib.Ast_500.Parsetree.pattern option ->
Astlib.Ast_500.Parsetree.pattern
val econstruct :
Astlib.Ast_500.Parsetree.constructor_declaration ->
Astlib.Ast_500.Parsetree.expression option ->
Astlib.Ast_500.Parsetree.expression
val elist_tail :
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
elist_tail ~loc [expr1; expr2; expr3] expr_tail
produces the expression expr1::expr2::expr3::expr_tail
.
val elist :
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression
elist ~loc [expr1; expr2; expr3]
produces the list litteral expression [expr1; expr2; expr3]
.
val plist_tail :
Astlib.Ast_500.Parsetree.pattern list ->
Astlib.Ast_500.Parsetree.pattern ->
Astlib.Ast_500.Parsetree.pattern
plist_tail ~loc [pat1; pat2; pat3] pat_tail
produces the pattern pat1::pat2::pat3::pat_tail
.
val plist :
Astlib.Ast_500.Parsetree.pattern list ->
Astlib.Ast_500.Parsetree.pattern
plist ~loc [pat1; pat2; pat3]
produces the list pattern [pat1; pat2; pat3]
.
val pstr_value_list :
loc:Location.t ->
Ppxlib_ast.Asttypes.rec_flag ->
Astlib.Ast_500.Parsetree.value_binding list ->
Astlib.Ast_500.Parsetree.structure_item list
pstr_value_list ~loc rf vbs
= pstr_value ~loc rf vbs
if vbs <> []
, []
otherwise.
val nonrec_type_declaration :
name:string Loc.t ->
params:
(Astlib.Ast_500.Parsetree.core_type * Ppxlib_ast.Asttypes.variance) list ->
cstrs:
(Astlib.Ast_500.Parsetree.core_type
* Astlib.Ast_500.Parsetree.core_type
* Location.t)
list ->
kind:Astlib.Ast_500.Parsetree.type_kind ->
private_:Ppxlib_ast.Asttypes.private_flag ->
manifest:Astlib.Ast_500.Parsetree.core_type option ->
Astlib.Ast_500.Parsetree.type_declaration
val unapplied_type_constr_conv :
Longident.t Loc.t ->
f:(string -> string) ->
Astlib.Ast_500.Parsetree.expression
unapplied_type_constr_conv
is the standard way to map identifiers to conversion fonctions, for preprocessor that creates values that follow the structure of types. More precisely, path_conv path (sprintf "sexp_of_%s")
is:
type_constr_conv
also applies it to a list of expression, which both prevents the compiler from allocating useless closures, and almost always what is needed, since type constructors are always applied.val type_constr_conv :
Longident.t Loc.t ->
f:(string -> string) ->
Astlib.Ast_500.Parsetree.expression list ->
Astlib.Ast_500.Parsetree.expression
val eta_reduce :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression option
Tries to simplify fun v1 v2 .. -> f v1 v2 ..
into f
. Only works when f
is a path, not an arbitrary expression as that would change the meaning of the code. This can be used either for cleaning up the generated code, or to reduce allocation if f
is a local variable (the compiler won't optimize the allocation of the closure).
Eta-reduction can change the types/behavior in some corner cases that are unlikely to show up in generated code:
f
has optional arguments, eta-expanding f
can drop themf
does side effects before receiving all its arguments, and if the eta-expansion is partially applied, eta-reducing could change behavior.eta_reduce_if_possible_and_nonrec
is meant for the case where the resulting expression is going to be bound in a potentially recursive let-binding, where we have to keep the eta-expansion when rec_flag
is Recursive
to avoid a compile error.
val eta_reduce_if_possible :
Astlib.Ast_500.Parsetree.expression ->
Astlib.Ast_500.Parsetree.expression
val eta_reduce_if_possible_and_nonrec :
Astlib.Ast_500.Parsetree.expression ->
rec_flag:Astlib.Ast_500.Asttypes.rec_flag ->
Astlib.Ast_500.Parsetree.expression
module Latest : sig ... end
This module contains updated versions of node constructors that were kept stable when the node changed. For every function in this module, there's an equally-named function outside this module. The function outside this module will stay stable, whereas the function inside this module will adapt potential upcoming new compiler features. Only use a function in this module, if the equally-named one outside this module is missing a feature you need.
val ppat_construct :
Astlib.Longident.t Astlib.Location.loc ->
Astlib.Ast_500.Parsetree.pattern option ->
Astlib.Ast_500.Parsetree.pattern
val constructor_declaration :
name:string Astlib.Location.loc ->
args:Astlib.Ast_500.Parsetree.constructor_arguments ->
res:Astlib.Ast_500.Parsetree.core_type option ->
Astlib.Ast_500.Parsetree.constructor_declaration