Up

module BrowseT

: sig

BrowseT offers a uniform interface to traverse constructions from TypedTree.

Mutually recursive types from TypedTree are wrapped into different constructors of the type node. Then type t allows to build a tree of nodes.

Finally the function of_node turns a node into a t tree, which structure mimics the recursive structure of the TypedTree node.

t also tries to capture the location and environment of node and defaults to default_loc and default_env otherwise.

#
type constructor_declaration = Typedtree.constructor_declaration
#
type node =
# | Dummy
# | Pattern of Typedtree.pattern
# | Expression of Typedtree.expression
# | Case of Typedtree.case
# | Class_expr of Typedtree.class_expr
# | Class_structure of Typedtree.class_structure
# | Class_field of Typedtree.class_field
# | Class_field_kind of Typedtree.class_field_kind
# | Module_expr of Typedtree.module_expr
# | Module_type_constraint of Typedtree.module_type_constraint
# | Structure of Typedtree.structure
# | Structure_item of Typedtree.structure_item
# | Module_binding of Typedtree.module_binding
# | Value_binding of Typedtree.value_binding
# | Module_type of Typedtree.module_type
# | Signature of Typedtree.signature
# | Signature_item of Typedtree.signature_item
# | Module_declaration of Typedtree.module_declaration
# | Module_type_declaration of Typedtree.module_type_declaration
# | With_constraint of Typedtree.with_constraint
# | Core_type of Typedtree.core_type
# | Package_type of Typedtree.package_type
# | Row_field of Typedtree.row_field
# | Value_description of Typedtree.value_description
# | Type_declaration of Typedtree.type_declaration
# | Type_kind of Typedtree.type_kind
# | Type_extension of Typedtree.type_extension
# | Extension_constructor of Typedtree.extension_constructor
# | Label_declaration of Typedtree.label_declaration
# | Constructor_declaration of Typedtree.constructor_declaration
# | Class_type of Typedtree.class_type
# | Class_signature of Typedtree.class_signature
# | Class_type_field of Typedtree.class_type_field
# | Class_declaration of Typedtree.class_declaration
# | Class_description of Typedtree.class_description
# | Class_type_declaration of Typedtree.class_type_declaration
# | Method_call of Typedtree.expression * Typedtree.meth
# | Module_binding_name of Typedtree.module_binding
# | Module_declaration_name of Typedtree.module_declaration
# | Module_type_declaration_name of Typedtree.module_type_declaration
#
type t = {
# t_node
: node;
# t_loc
: Location.t;
# t_env
: Env.t;
# t_children
: t list lazy_t;
}
#
val default_loc : Location.t
#
val default_env : Env.t
#
val dummy : t

Dummy value, used as fallback when there is nothing to analyze (e.g incorrect input)

#
val of_node : ?loc:Location.t -> ?env:Env.t -> node -> t

of_node ?loc ?env node produces a tree from node, using loc and env as default annotation when nothing can be inferred from the node. loc and env default to default_loc and default_env.

#
val annot : Location.t -> Env.t -> t -> t

annot loc env t replace default_loc and default_env in t by loc and env.

Accessors for information specific to a node

#
val string_of_node : node -> string
#
val node_paths : node -> Path.t Location.loc list
#
val is_constructor : t -> [
| `Description of Types.constructor_description
] Location.loc option
end