Up

module Ast_helper

: sig

Helpers to produce Parsetree fragments

#
type lid = Longident.t Asttypes.loc
#
type str = string Asttypes.loc
#
type loc = Location.t
#
type attrs = Parsetree.attribute list

Default locations

#
val default_loc : loc Pervasives.ref

Default value for all optional location arguments.

#
val with_default_loc : loc -> (unit -> 'a) -> 'a

Set the default_loc within the scope of the execution of the provided function.

#
val rtag : ?attrs:attrs -> Asttypes.label -> bool -> Parsetree.core_type list -> Parsetree.row_field
#
val const_string : string -> Asttypes.constant

Core language

#
module Typ : sig

Type expressions

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.core_type_desc -> Parsetree.core_type
#
val any : ?loc:loc -> ?attrs:attrs -> unit -> Parsetree.core_type
#
val var : ?loc:loc -> ?attrs:attrs -> string -> Parsetree.core_type
#
val arrow : ?loc:loc -> ?attrs:attrs -> Asttypes.label -> Parsetree.core_type -> Parsetree.core_type -> Parsetree.core_type
#
val tuple : ?loc:loc -> ?attrs:attrs -> Parsetree.core_type list -> Parsetree.core_type
#
val constr : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.core_type list -> Parsetree.core_type
#
val object_ : ?loc:loc -> ?attrs:attrs -> (string * Parsetree.attributes * Parsetree.core_type) list -> Asttypes.closed_flag -> Parsetree.core_type
#
val class_ : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.core_type list -> Parsetree.core_type
#
val alias : ?loc:loc -> ?attrs:attrs -> Parsetree.core_type -> string -> Parsetree.core_type
#
val variant : ?loc:loc -> ?attrs:attrs -> Parsetree.row_field list -> Asttypes.closed_flag -> Asttypes.label list option -> Parsetree.core_type
#
val poly : ?loc:loc -> ?attrs:attrs -> string list -> Parsetree.core_type -> Parsetree.core_type
#
val package : ?loc:loc -> ?attrs:attrs -> lid -> (lid * Parsetree.core_type) list -> Parsetree.core_type
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.core_type
#
val force_poly : Parsetree.core_type -> Parsetree.core_type
end
#
module Pat : sig

Patterns

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern_desc -> Parsetree.pattern
#
val any : ?loc:loc -> ?attrs:attrs -> unit -> Parsetree.pattern
#
val var : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.pattern
#
val alias : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> str -> Parsetree.pattern
#
val constant : ?loc:loc -> ?attrs:attrs -> Asttypes.constant -> Parsetree.pattern
#
val interval : ?loc:loc -> ?attrs:attrs -> Asttypes.constant -> Asttypes.constant -> Parsetree.pattern
#
val tuple : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern list -> Parsetree.pattern
#
val construct : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.pattern option -> Parsetree.pattern
#
val variant : ?loc:loc -> ?attrs:attrs -> Asttypes.label -> Parsetree.pattern option -> Parsetree.pattern
#
val record : ?loc:loc -> ?attrs:attrs -> (lid * Parsetree.pattern) list -> Asttypes.closed_flag -> Parsetree.pattern
#
val array : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern list -> Parsetree.pattern
#
val or_ : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> Parsetree.pattern -> Parsetree.pattern
#
val constraint_ : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> Parsetree.core_type -> Parsetree.pattern
#
val type_ : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.pattern
#
val lazy_ : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> Parsetree.pattern
#
val unpack : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.pattern
#
val exception_ : ?loc:loc -> ?attrs:attrs -> Parsetree.pattern -> Parsetree.pattern
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.pattern
end
#
module Exp : sig

Expressions

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.expression_desc -> Parsetree.expression
#
val ident : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.expression
#
val constant : ?loc:loc -> ?attrs:attrs -> Asttypes.constant -> Parsetree.expression
#
val function_ : ?loc:loc -> ?attrs:attrs -> Parsetree.case list -> Parsetree.expression
#
val apply : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> (Asttypes.label * Parsetree.expression) list -> Parsetree.expression
#
val match_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.case list -> Parsetree.expression
#
val try_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.case list -> Parsetree.expression
#
val tuple : ?loc:loc -> ?attrs:attrs -> Parsetree.expression list -> Parsetree.expression
#
val construct : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.expression option -> Parsetree.expression
#
val variant : ?loc:loc -> ?attrs:attrs -> Asttypes.label -> Parsetree.expression option -> Parsetree.expression
#
val record : ?loc:loc -> ?attrs:attrs -> (lid * Parsetree.expression) list -> Parsetree.expression option -> Parsetree.expression
#
val field : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> lid -> Parsetree.expression
#
val setfield : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> lid -> Parsetree.expression -> Parsetree.expression
#
val array : ?loc:loc -> ?attrs:attrs -> Parsetree.expression list -> Parsetree.expression
#
val ifthenelse : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.expression -> Parsetree.expression option -> Parsetree.expression
#
val sequence : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.expression -> Parsetree.expression
#
val while_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.expression -> Parsetree.expression
#
val coerce : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.core_type option -> Parsetree.core_type -> Parsetree.expression
#
val constraint_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.core_type -> Parsetree.expression
#
val send : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> string -> Parsetree.expression
#
val new_ : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.expression
#
val setinstvar : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.expression -> Parsetree.expression
#
val override : ?loc:loc -> ?attrs:attrs -> (str * Parsetree.expression) list -> Parsetree.expression
#
val letmodule : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.module_expr -> Parsetree.expression -> Parsetree.expression
#
val assert_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.expression
#
val lazy_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.expression
#
val poly : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.core_type option -> Parsetree.expression
#
val object_ : ?loc:loc -> ?attrs:attrs -> Parsetree.class_structure -> Parsetree.expression
#
val newtype : ?loc:loc -> ?attrs:attrs -> string -> Parsetree.expression -> Parsetree.expression
#
val pack : ?loc:loc -> ?attrs:attrs -> Parsetree.module_expr -> Parsetree.expression
#
val open_ : ?loc:loc -> ?attrs:attrs -> Asttypes.override_flag -> lid -> Parsetree.expression -> Parsetree.expression
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.expression
end
#
module Val : sig

Value declarations

#
val mk : ?loc:loc -> ?attrs:attrs -> ?prim:string list -> str -> Parsetree.core_type -> Parsetree.value_description
end
#
module Type : sig

Type declarations

#
val mk : ?loc:loc -> ?attrs:attrs -> ?params:(Parsetree.core_type * Asttypes.variance) list -> ?cstrs:(Parsetree.core_type * Parsetree.core_type * loc) list -> ?kind:Parsetree.type_kind -> ?priv:Asttypes.private_flag -> ?manifest:Parsetree.core_type -> str -> Parsetree.type_declaration
#
val constructor : ?loc:loc -> ?attrs:attrs -> ?args:Parsetree.core_type list -> ?res:Parsetree.core_type -> str -> Parsetree.constructor_declaration
#
val field : ?loc:loc -> ?attrs:attrs -> ?mut:Asttypes.mutable_flag -> str -> Parsetree.core_type -> Parsetree.label_declaration
end
#
module Te : sig

Type extensions

#
val decl : ?loc:loc -> ?attrs:attrs -> ?args:Parsetree.core_type list -> ?res:Parsetree.core_type -> str -> Parsetree.extension_constructor
#
val rebind : ?loc:loc -> ?attrs:attrs -> str -> lid -> Parsetree.extension_constructor
end

Module language

#
module Mty : sig

Module type expressions

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.module_type_desc -> Parsetree.module_type
#
val ident : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.module_type
#
val alias : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.module_type
#
val signature : ?loc:loc -> ?attrs:attrs -> Parsetree.signature -> Parsetree.module_type
#
val functor_ : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.module_type option -> Parsetree.module_type -> Parsetree.module_type
#
val with_ : ?loc:loc -> ?attrs:attrs -> Parsetree.module_type -> Parsetree.with_constraint list -> Parsetree.module_type
#
val typeof_ : ?loc:loc -> ?attrs:attrs -> Parsetree.module_expr -> Parsetree.module_type
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.module_type
end
#
module Mod : sig

Module expressions

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.module_expr_desc -> Parsetree.module_expr
#
val ident : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.module_expr
#
val structure : ?loc:loc -> ?attrs:attrs -> Parsetree.structure -> Parsetree.module_expr
#
val functor_ : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.module_type option -> Parsetree.module_expr -> Parsetree.module_expr
#
#
val constraint_ : ?loc:loc -> ?attrs:attrs -> Parsetree.module_expr -> Parsetree.module_type -> Parsetree.module_expr
#
val unpack : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.module_expr
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.module_expr
end
#
module Sig : sig

Signature items

end
#
module Str : sig

Structure items

end
#
module Md : sig

Module declarations

#
val mk : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.module_type -> Parsetree.module_declaration
end
#
module Mtd : sig

Module type declarations

#
val mk : ?loc:loc -> ?attrs:attrs -> ?typ:Parsetree.module_type -> str -> Parsetree.module_type_declaration
end
#
module Mb : sig

Module bindings

#
val mk : ?loc:loc -> ?attrs:attrs -> str -> Parsetree.module_expr -> Parsetree.module_binding
end
#
module Opn : sig
#
val mk : ?loc:loc -> ?attrs:attrs -> ?override:Asttypes.override_flag -> lid -> Parsetree.open_description
end
#
module Incl : sig
#
val mk : ?loc:loc -> ?attrs:attrs -> 'a -> 'a Parsetree.include_infos
end

Value bindings

#
module Vb : sig
end

Class language

#
module Cty : sig

Class type expressions

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.class_type_desc -> Parsetree.class_type
#
val constr : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.core_type list -> Parsetree.class_type
#
val signature : ?loc:loc -> ?attrs:attrs -> Parsetree.class_signature -> Parsetree.class_type
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.class_type
end
#
module Ctf : sig

Class type fields

end
#
module Cl : sig

Class expressions

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.class_expr_desc -> Parsetree.class_expr
#
val constr : ?loc:loc -> ?attrs:attrs -> lid -> Parsetree.core_type list -> Parsetree.class_expr
#
val structure : ?loc:loc -> ?attrs:attrs -> Parsetree.class_structure -> Parsetree.class_expr
#
val apply : ?loc:loc -> ?attrs:attrs -> Parsetree.class_expr -> (Asttypes.label * Parsetree.expression) list -> Parsetree.class_expr
#
val constraint_ : ?loc:loc -> ?attrs:attrs -> Parsetree.class_expr -> Parsetree.class_type -> Parsetree.class_expr
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.class_expr
end
#
module Cf : sig

Class fields

#
val mk : ?loc:loc -> ?attrs:attrs -> Parsetree.class_field_desc -> Parsetree.class_field
#
val inherit_ : ?loc:loc -> ?attrs:attrs -> Asttypes.override_flag -> Parsetree.class_expr -> string option -> Parsetree.class_field
#
val method_ : ?loc:loc -> ?attrs:attrs -> str -> Asttypes.private_flag -> Parsetree.class_field_kind -> Parsetree.class_field
#
val constraint_ : ?loc:loc -> ?attrs:attrs -> Parsetree.core_type -> Parsetree.core_type -> Parsetree.class_field
#
val initializer_ : ?loc:loc -> ?attrs:attrs -> Parsetree.expression -> Parsetree.class_field
#
val extension : ?loc:loc -> ?attrs:attrs -> Parsetree.extension -> Parsetree.class_field
#
val attribute : ?loc:loc -> Parsetree.attribute -> Parsetree.class_field
end
#
module Ci : sig

Classes

#
val mk : ?loc:loc -> ?attrs:attrs -> ?virt:Asttypes.virtual_flag -> ?params:(Parsetree.core_type * Asttypes.variance) list -> str -> 'a -> 'a Parsetree.class_infos
end
#
module Csig : sig

Class signatures

end
#
module Cstr : sig

Class structures

end
end