.TH "Ast_iterator" 3o source: 2017-09-14 OCamldoc "OCaml library" .SH NAME Ast_iterator \- Ast_iterator.iterator allows to implement AST inspection using open recursion. .SH Module Module Ast_iterator .SH Documentation .sp Module .BI "Ast_iterator" : .B sig end .sp .B Ast_iterator\&.iterator allows to implement AST inspection using open recursion\&. A typical mapper would be based on .B Ast_iterator\&.default_iterator , a trivial iterator, and will fall back on it for handling the syntax it does not modify\&. .sp .sp .sp .PP .B === .B A generic Parsetree iterator .B === .PP .I type iterator = { attribute : .B iterator -> Parsetree.attribute -> unit ; attributes : .B iterator -> Parsetree.attribute list -> unit ; case : .B iterator -> Parsetree.case -> unit ; cases : .B iterator -> Parsetree.case list -> unit ; class_declaration : .B iterator -> Parsetree.class_declaration -> unit ; class_description : .B iterator -> Parsetree.class_description -> unit ; class_expr : .B iterator -> Parsetree.class_expr -> unit ; class_field : .B iterator -> Parsetree.class_field -> unit ; class_signature : .B iterator -> Parsetree.class_signature -> unit ; class_structure : .B iterator -> Parsetree.class_structure -> unit ; class_type : .B iterator -> Parsetree.class_type -> unit ; class_type_declaration : .B iterator -> Parsetree.class_type_declaration -> unit ; class_type_field : .B iterator -> Parsetree.class_type_field -> unit ; constructor_declaration : .B iterator -> Parsetree.constructor_declaration -> unit ; expr : .B iterator -> Parsetree.expression -> unit ; extension : .B iterator -> Parsetree.extension -> unit ; extension_constructor : .B iterator -> Parsetree.extension_constructor -> unit ; include_declaration : .B iterator -> Parsetree.include_declaration -> unit ; include_description : .B iterator -> Parsetree.include_description -> unit ; label_declaration : .B iterator -> Parsetree.label_declaration -> unit ; location : .B iterator -> Location.t -> unit ; module_binding : .B iterator -> Parsetree.module_binding -> unit ; module_declaration : .B iterator -> Parsetree.module_declaration -> unit ; module_expr : .B iterator -> Parsetree.module_expr -> unit ; module_type : .B iterator -> Parsetree.module_type -> unit ; module_type_declaration : .B iterator -> Parsetree.module_type_declaration -> unit ; open_description : .B iterator -> Parsetree.open_description -> unit ; pat : .B iterator -> Parsetree.pattern -> unit ; payload : .B iterator -> Parsetree.payload -> unit ; signature : .B iterator -> Parsetree.signature -> unit ; signature_item : .B iterator -> Parsetree.signature_item -> unit ; structure : .B iterator -> Parsetree.structure -> unit ; structure_item : .B iterator -> Parsetree.structure_item -> unit ; typ : .B iterator -> Parsetree.core_type -> unit ; type_declaration : .B iterator -> Parsetree.type_declaration -> unit ; type_extension : .B iterator -> Parsetree.type_extension -> unit ; type_kind : .B iterator -> Parsetree.type_kind -> unit ; value_binding : .B iterator -> Parsetree.value_binding -> unit ; value_description : .B iterator -> Parsetree.value_description -> unit ; with_constraint : .B iterator -> Parsetree.with_constraint -> unit ; } .sp A .B 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\&. .sp .I val default_iterator : .B iterator .sp A default iterator, which implements a "do not do anything" mapping\&. .sp