Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / parsing_cocci / visitor_ast.mli
1 (*
2 * Copyright 2012, INRIA
3 * Julia Lawall, Gilles Muller
4 * Copyright 2010-2011, INRIA, University of Copenhagen
5 * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
6 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
7 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
8 * This file is part of Coccinelle.
9 *
10 * Coccinelle is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, according to version 2 of the License.
13 *
14 * Coccinelle is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * The authors reserve the right to distribute this or future versions of
23 * Coccinelle under other licenses.
24 *)
25
26
27 type 'a combiner =
28 {combiner_ident : Ast_cocci.ident -> 'a;
29 combiner_expression : Ast_cocci.expression -> 'a;
30 combiner_fullType : Ast_cocci.fullType -> 'a;
31 combiner_typeC : Ast_cocci.typeC -> 'a;
32 combiner_declaration : Ast_cocci.declaration -> 'a;
33 combiner_initialiser : Ast_cocci.initialiser -> 'a;
34 combiner_parameter : Ast_cocci.parameterTypeDef -> 'a;
35 combiner_parameter_list : Ast_cocci.parameter_list -> 'a;
36 combiner_rule_elem : Ast_cocci.rule_elem -> 'a;
37 combiner_statement : Ast_cocci.statement -> 'a;
38 combiner_case_line : Ast_cocci.case_line -> 'a;
39 combiner_top_level : Ast_cocci.top_level -> 'a;
40 combiner_anything : Ast_cocci.anything -> 'a;
41 combiner_expression_dots :
42 Ast_cocci.expression Ast_cocci.dots -> 'a;
43 combiner_statement_dots :
44 Ast_cocci.statement Ast_cocci.dots -> 'a;
45 combiner_declaration_dots :
46 Ast_cocci.declaration Ast_cocci.dots -> 'a;
47 combiner_initialiser_dots :
48 Ast_cocci.initialiser Ast_cocci.dots -> 'a}
49
50 type ('mc,'a) cmcode = 'a combiner -> 'mc Ast_cocci.mcode -> 'a
51 type ('cd,'a) ccode = 'a combiner -> ('cd -> 'a) -> 'cd -> 'a
52
53 val combiner :
54 ('a -> 'a -> 'a) -> 'a ->
55 ((Ast_cocci.meta_name,'a) cmcode) ->
56 ((string,'a) cmcode) ->
57 ((Ast_cocci.constant,'a) cmcode) ->
58 ((Ast_cocci.assignOp,'a) cmcode) ->
59 ((Ast_cocci.fixOp,'a) cmcode) ->
60 ((Ast_cocci.unaryOp,'a) cmcode) ->
61 ((Ast_cocci.binaryOp,'a) cmcode) ->
62 ((Ast_cocci.const_vol,'a) cmcode) ->
63 ((Ast_cocci.sign,'a) cmcode) ->
64 ((Ast_cocci.structUnion,'a) cmcode) ->
65 ((Ast_cocci.storage,'a) cmcode) ->
66 ((Ast_cocci.inc_file,'a) cmcode) ->
67 ((Ast_cocci.expression Ast_cocci.dots,'a) ccode) ->
68 ((Ast_cocci.parameterTypeDef Ast_cocci.dots,'a) ccode) ->
69 ((Ast_cocci.statement Ast_cocci.dots,'a) ccode) ->
70 ((Ast_cocci.declaration Ast_cocci.dots,'a) ccode) ->
71 ((Ast_cocci.initialiser Ast_cocci.dots,'a) ccode) ->
72 ((Ast_cocci.ident,'a) ccode) ->
73 ((Ast_cocci.expression,'a) ccode) ->
74 ((Ast_cocci.fullType,'a) ccode) ->
75 ((Ast_cocci.typeC,'a) ccode) ->
76 ((Ast_cocci.initialiser,'a) ccode) ->
77 ((Ast_cocci.parameterTypeDef,'a) ccode) ->
78 ((Ast_cocci.declaration,'a) ccode) ->
79 ((Ast_cocci.rule_elem,'a) ccode) ->
80 ((Ast_cocci.statement,'a) ccode) ->
81 ((Ast_cocci.case_line,'a) ccode) ->
82 ((Ast_cocci.top_level,'a) ccode) ->
83 ((Ast_cocci.anything,'a) ccode) ->
84 'a combiner
85
86 type 'a inout = 'a -> 'a (* for specifying the type of rebuilder *)
87
88 type rebuilder =
89 {rebuilder_ident : Ast_cocci.ident inout;
90 rebuilder_expression : Ast_cocci.expression inout;
91 rebuilder_fullType : Ast_cocci.fullType inout;
92 rebuilder_typeC : Ast_cocci.typeC inout;
93 rebuilder_declaration : Ast_cocci.declaration inout;
94 rebuilder_initialiser : Ast_cocci.initialiser inout;
95 rebuilder_parameter : Ast_cocci.parameterTypeDef inout;
96 rebuilder_parameter_list : Ast_cocci.parameter_list inout;
97 rebuilder_statement : Ast_cocci.statement inout;
98 rebuilder_case_line : Ast_cocci.case_line inout;
99 rebuilder_rule_elem : Ast_cocci.rule_elem inout;
100 rebuilder_top_level : Ast_cocci.top_level inout;
101 rebuilder_expression_dots : Ast_cocci.expression Ast_cocci.dots inout;
102 rebuilder_statement_dots : Ast_cocci.statement Ast_cocci.dots inout;
103 rebuilder_declaration_dots : Ast_cocci.declaration Ast_cocci.dots inout;
104 rebuilder_initialiser_dots : Ast_cocci.initialiser Ast_cocci.dots inout;
105 rebuilder_define_param_dots: Ast_cocci.define_param Ast_cocci.dots inout;
106 rebuilder_define_param : Ast_cocci.define_param inout;
107 rebuilder_define_parameters : Ast_cocci.define_parameters inout;
108 rebuilder_anything : Ast_cocci.anything inout}
109
110 type 'mc rmcode = 'mc Ast_cocci.mcode inout
111 type 'cd rcode = rebuilder -> ('cd inout) -> 'cd inout
112
113 val rebuilder :
114 (Ast_cocci.meta_name rmcode) ->
115 (string rmcode) ->
116 (Ast_cocci.constant rmcode) ->
117 (Ast_cocci.assignOp rmcode) ->
118 (Ast_cocci.fixOp rmcode) ->
119 (Ast_cocci.unaryOp rmcode) ->
120 (Ast_cocci.binaryOp rmcode) ->
121 (Ast_cocci.const_vol rmcode) ->
122 (Ast_cocci.sign rmcode) ->
123 (Ast_cocci.structUnion rmcode) ->
124 (Ast_cocci.storage rmcode) ->
125 (Ast_cocci.inc_file rmcode) ->
126 (Ast_cocci.expression Ast_cocci.dots rcode) ->
127 (Ast_cocci.parameterTypeDef Ast_cocci.dots rcode) ->
128 (Ast_cocci.statement Ast_cocci.dots rcode) ->
129 (Ast_cocci.declaration Ast_cocci.dots rcode) ->
130 (Ast_cocci.initialiser Ast_cocci.dots rcode) ->
131 (Ast_cocci.ident rcode) ->
132 (Ast_cocci.expression rcode) ->
133 (Ast_cocci.fullType rcode) ->
134 (Ast_cocci.typeC rcode) ->
135 (Ast_cocci.initialiser rcode) ->
136 (Ast_cocci.parameterTypeDef rcode) ->
137 (Ast_cocci.declaration rcode) ->
138 (Ast_cocci.rule_elem rcode) ->
139 (Ast_cocci.statement rcode) ->
140 (Ast_cocci.case_line rcode) ->
141 (Ast_cocci.top_level rcode) ->
142 (Ast_cocci.anything rcode) ->
143 rebuilder