1Ast_iterator(3) OCaml library Ast_iterator(3)
2
3
4
6 Ast_iterator - Ast_iterator.iterator enables AST inspection using open
7 recursion.
8
10 Module Ast_iterator
11
13 Module Ast_iterator
14 : sig end
15
16
17
18 Ast_iterator.iterator enables AST inspection using open recursion. A
19 typical mapper would be based on Ast_iterator.default_iterator , a
20 trivial iterator, and will fall back on it for handling the syntax it
21 does not modify.
22
23 Warning: this module is unstable and part of Compiler_libs .
24
25
26
27
28
29
30
31 A generic Parsetree iterator
32 type iterator = {
33 attribute : iterator -> Parsetree.attribute -> unit ;
34 attributes : iterator -> Parsetree.attribute list -> unit ;
35 binding_op : iterator -> Parsetree.binding_op -> unit ;
36 case : iterator -> Parsetree.case -> unit ;
37 cases : iterator -> Parsetree.case list -> unit ;
38 class_declaration : iterator -> Parsetree.class_declaration -> unit ;
39 class_description : iterator -> Parsetree.class_description -> unit ;
40 class_expr : iterator -> Parsetree.class_expr -> unit ;
41 class_field : iterator -> Parsetree.class_field -> unit ;
42 class_signature : iterator -> Parsetree.class_signature -> unit ;
43 class_structure : iterator -> Parsetree.class_structure -> unit ;
44 class_type : iterator -> Parsetree.class_type -> unit ;
45 class_type_declaration : iterator -> Parsetree.class_type_declaration
46 -> unit ;
47 class_type_field : iterator -> Parsetree.class_type_field -> unit ;
48 constructor_declaration : iterator -> Parsetree.constructor_declara‐
49 tion -> unit ;
50 expr : iterator -> Parsetree.expression -> unit ;
51 extension : iterator -> Parsetree.extension -> unit ;
52 extension_constructor : iterator -> Parsetree.extension_constructor ->
53 unit ;
54 include_declaration : iterator -> Parsetree.include_declaration ->
55 unit ;
56 include_description : iterator -> Parsetree.include_description ->
57 unit ;
58 label_declaration : iterator -> Parsetree.label_declaration -> unit ;
59 location : iterator -> Location.t -> unit ;
60 module_binding : iterator -> Parsetree.module_binding -> unit ;
61 module_declaration : iterator -> Parsetree.module_declaration -> unit
62 ;
63 module_substitution : iterator -> Parsetree.module_substitution ->
64 unit ;
65 module_expr : iterator -> Parsetree.module_expr -> unit ;
66 module_type : iterator -> Parsetree.module_type -> unit ;
67 module_type_declaration : iterator -> Parsetree.module_type_declara‐
68 tion -> unit ;
69 open_declaration : iterator -> Parsetree.open_declaration -> unit ;
70 open_description : iterator -> Parsetree.open_description -> unit ;
71 pat : iterator -> Parsetree.pattern -> unit ;
72 payload : iterator -> Parsetree.payload -> unit ;
73 signature : iterator -> Parsetree.signature -> unit ;
74 signature_item : iterator -> Parsetree.signature_item -> unit ;
75 structure : iterator -> Parsetree.structure -> unit ;
76 structure_item : iterator -> Parsetree.structure_item -> unit ;
77 typ : iterator -> Parsetree.core_type -> unit ;
78 row_field : iterator -> Parsetree.row_field -> unit ;
79 object_field : iterator -> Parsetree.object_field -> unit ;
80 type_declaration : iterator -> Parsetree.type_declaration -> unit ;
81 type_extension : iterator -> Parsetree.type_extension -> unit ;
82 type_exception : iterator -> Parsetree.type_exception -> unit ;
83 type_kind : iterator -> Parsetree.type_kind -> unit ;
84 value_binding : iterator -> Parsetree.value_binding -> unit ;
85 value_description : iterator -> Parsetree.value_description -> unit ;
86 with_constraint : iterator -> Parsetree.with_constraint -> unit ;
87 }
88
89
90 A iterator record implements one "method" per syntactic category, using
91 an open recursion style: each method takes as its first argument the
92 iterator to be applied to children in the syntax tree.
93
94
95
96 val default_iterator : iterator
97
98 A default iterator, which implements a "do not do anything" mapping.
99
100
101
102
103
104OCamldoc 2019-07-30 Ast_iterator(3)