Scroll to navigation

Ast_iterator(3o) OCamldoc Ast_iterator(3o)

NAME

Ast_iterator - Ast_iterator.iterator allows to implement AST inspection using open recursion.

Module

Module Ast_iterator

Documentation

Module Ast_iterator
: sig end

Ast_iterator.iterator allows to implement AST inspection using open recursion. A typical mapper would be based on Ast_iterator.default_iterator , a trivial iterator, and will fall back on it for handling the syntax it does not modify.

=== A generic Parsetree iterator ===

type iterator = {
attribute : iterator -> Parsetree.attribute -> unit ;
attributes : iterator -> Parsetree.attribute list -> unit ;
case : iterator -> Parsetree.case -> unit ;
cases : iterator -> Parsetree.case list -> unit ;
class_declaration : iterator -> Parsetree.class_declaration -> unit ;
class_description : iterator -> Parsetree.class_description -> unit ;
class_expr : iterator -> Parsetree.class_expr -> unit ;
class_field : iterator -> Parsetree.class_field -> unit ;
class_signature : iterator -> Parsetree.class_signature -> unit ;
class_structure : iterator -> Parsetree.class_structure -> unit ;
class_type : iterator -> Parsetree.class_type -> unit ;
class_type_declaration : iterator -> Parsetree.class_type_declaration -> unit ;
class_type_field : iterator -> Parsetree.class_type_field -> unit ;
constructor_declaration : iterator -> Parsetree.constructor_declaration -> unit ;
expr : iterator -> Parsetree.expression -> unit ;
extension : iterator -> Parsetree.extension -> unit ;
extension_constructor : iterator -> Parsetree.extension_constructor -> unit ;
include_declaration : iterator -> Parsetree.include_declaration -> unit ;
include_description : iterator -> Parsetree.include_description -> unit ;
label_declaration : iterator -> Parsetree.label_declaration -> unit ;
location : iterator -> Location.t -> unit ;
module_binding : iterator -> Parsetree.module_binding -> unit ;
module_declaration : iterator -> Parsetree.module_declaration -> unit ;
module_expr : iterator -> Parsetree.module_expr -> unit ;
module_type : iterator -> Parsetree.module_type -> unit ;
module_type_declaration : iterator -> Parsetree.module_type_declaration -> unit ;
open_description : iterator -> Parsetree.open_description -> unit ;
pat : iterator -> Parsetree.pattern -> unit ;
payload : iterator -> Parsetree.payload -> unit ;
signature : iterator -> Parsetree.signature -> unit ;
signature_item : iterator -> Parsetree.signature_item -> unit ;
structure : iterator -> Parsetree.structure -> unit ;
structure_item : iterator -> Parsetree.structure_item -> unit ;
typ : iterator -> Parsetree.core_type -> unit ;
type_declaration : iterator -> Parsetree.type_declaration -> unit ;
type_extension : iterator -> Parsetree.type_extension -> unit ;
type_kind : iterator -> Parsetree.type_kind -> unit ;
value_binding : iterator -> Parsetree.value_binding -> unit ;
value_description : iterator -> Parsetree.value_description -> unit ;
with_constraint : iterator -> Parsetree.with_constraint -> unit ;
}

A iterator record implements one "method" per syntactic category, using an open recursion style: each method takes as its first argument the iterator to be applied to children in the syntax tree.

val default_iterator : iterator

A default iterator, which implements a "do not do anything" mapping.

source: 2017-09-14