Release coccinelle-0.2.4
[bpt/coccinelle.git] / parsing_cocci / visitor_ast0_types.ml
CommitLineData
9bc82bae
C
1(*
2 * Copyright 2010, INRIA, University of Copenhagen
3 * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
4 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
5 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
6 * This file is part of Coccinelle.
7 *
8 * Coccinelle is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, according to version 2 of the License.
11 *
12 * Coccinelle is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * The authors reserve the right to distribute this or future versions of
21 * Coccinelle under other licenses.
22 *)
23
24
c491d8ee
C
25(*
26 * Copyright 2010, INRIA, University of Copenhagen
27 * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
28 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
29 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
30 * This file is part of Coccinelle.
31 *
32 * Coccinelle is free software: you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation, according to version 2 of the License.
35 *
36 * Coccinelle is distributed in the hope that it will be useful,
37 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 * GNU General Public License for more details.
40 *
41 * You should have received a copy of the GNU General Public License
42 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
43 *
44 * The authors reserve the right to distribute this or future versions of
45 * Coccinelle under other licenses.
46 *)
47
48
b1b2de81
C
49module Ast0 = Ast0_cocci
50module Ast = Ast_cocci
51
52type ('a,'n) inout = 'a -> ('n * 'a)
53
54type 'n all_functions =
55 {ident : (Ast0.ident,'n) inout;
56 expression : (Ast0.expression,'n) inout;
57 typeC : (Ast0.typeC,'n) inout;
58 declaration : (Ast0.declaration,'n) inout;
59 initialiser : (Ast0.initialiser,'n) inout;
60 initialiser_list : (Ast0.initialiser_list,'n) inout;
61 parameter : (Ast0.parameterTypeDef,'n) inout;
62 parameter_list : (Ast0.parameter_list,'n) inout;
63 statement : (Ast0.statement,'n) inout;
64 case_line : (Ast0.case_line,'n) inout;
65 top_level : (Ast0.top_level,'n) inout;
66 expression_dots : (Ast0.expression Ast0.dots,'n) inout;
67 statement_dots : (Ast0.statement Ast0.dots,'n) inout;
68 declaration_dots : (Ast0.declaration Ast0.dots,'n) inout;
69 case_line_dots : (Ast0.case_line Ast0.dots,'n) inout;
70 anything : (Ast0.anything,'n) inout}
71
72(* ----------------------------------------------------------------------- *)
73(* combiner *)
74
75type ('a,'n) combiner_inout = 'a -> 'n
76
77type 'n combiner_rec_functions =
78 {combiner_rec_ident : (Ast0.ident,'n) combiner_inout;
79 combiner_rec_expression : (Ast0.expression,'n) combiner_inout;
80 combiner_rec_typeC : (Ast0.typeC,'n) combiner_inout;
81 combiner_rec_declaration : (Ast0.declaration,'n) combiner_inout;
82 combiner_rec_initialiser : (Ast0.initialiser,'n) combiner_inout;
83 combiner_rec_initialiser_list :
84 (Ast0.initialiser_list,'n) combiner_inout;
85 combiner_rec_parameter : (Ast0.parameterTypeDef,'n) combiner_inout;
86 combiner_rec_parameter_list : (Ast0.parameter_list,'n) combiner_inout;
87 combiner_rec_statement : (Ast0.statement,'n) combiner_inout;
88 combiner_rec_case_line : (Ast0.case_line,'n) combiner_inout;
89 combiner_rec_top_level : (Ast0.top_level,'n) combiner_inout;
90 combiner_rec_expression_dots :
91 (Ast0.expression Ast0.dots,'n) combiner_inout;
92 combiner_rec_statement_dots :
93 (Ast0.statement Ast0.dots,'n) combiner_inout;
94 combiner_rec_declaration_dots :
95 (Ast0.declaration Ast0.dots,'n) combiner_inout;
96 combiner_rec_case_line_dots :
97 (Ast0.case_line Ast0.dots,'n) combiner_inout;
98 combiner_rec_anything : (Ast0.anything,'n) combiner_inout}
99
100type ('mc,'n) cmcode = 'n -> 'mc Ast0.mcode -> 'n
101type ('mc,'n) flat_cmcode = 'mc Ast0.mcode -> 'n
102type ('cd,'n) ccode = 'n combiner_rec_functions -> ('cd -> 'n) -> 'cd -> 'n
103
104type 'n combiner_functions =
ae4735db 105 {combiner_meta_mcode : (Ast.meta_name,'n) cmcode;
b1b2de81
C
106 combiner_string_mcode : (string,'n) cmcode;
107 combiner_const_mcode : (Ast.constant,'n) cmcode;
108 combiner_assign_mcode : (Ast.assignOp,'n) cmcode;
109 combiner_fix_mcode : (Ast.fixOp,'n) cmcode;
110 combiner_unary_mcode : (Ast.unaryOp,'n) cmcode;
111 combiner_binary_mcode : (Ast.binaryOp,'n) cmcode;
112 combiner_cv_mcode : (Ast.const_vol,'n) cmcode;
113 combiner_sign_mcode : (Ast.sign,'n) cmcode;
114 combiner_struct_mcode : (Ast.structUnion,'n) cmcode;
115 combiner_storage_mcode : (Ast.storage,'n) cmcode;
116 combiner_inc_mcode : (Ast.inc_file,'n) cmcode;
117 combiner_dotsexprfn : (Ast0.expression Ast0.dots,'n) ccode;
118 combiner_dotsinitfn : (Ast0.initialiser Ast0.dots,'n) ccode;
119 combiner_dotsparamfn : (Ast0.parameterTypeDef Ast0.dots,'n) ccode;
120 combiner_dotsstmtfn : (Ast0.statement Ast0.dots,'n) ccode;
121 combiner_dotsdeclfn : (Ast0.declaration Ast0.dots,'n) ccode;
122 combiner_dotscasefn : (Ast0.case_line Ast0.dots,'n) ccode;
123 combiner_identfn : (Ast0.ident,'n) ccode;
124 combiner_exprfn : (Ast0.expression,'n) ccode;
125 combiner_tyfn : (Ast0.typeC,'n) ccode;
126 combiner_initfn : (Ast0.initialiser,'n) ccode;
127 combiner_paramfn : (Ast0.parameterTypeDef,'n) ccode;
128 combiner_declfn : (Ast0.declaration,'n) ccode;
129 combiner_stmtfn : (Ast0.statement,'n) ccode;
130 combiner_casefn : (Ast0.case_line,'n) ccode;
131 combiner_topfn : (Ast0.top_level,'n) ccode}
132
133(* ----------------------------------------------------------------------- *)
134(* rebuilder *)
135
136type 'a rebuilder_inout = 'a -> 'a
137
138type rebuilder_rec_functions =
139 {rebuilder_rec_ident : Ast0.ident rebuilder_inout;
140 rebuilder_rec_expression : Ast0.expression rebuilder_inout;
141 rebuilder_rec_typeC : Ast0.typeC rebuilder_inout;
142 rebuilder_rec_declaration : Ast0.declaration rebuilder_inout;
143 rebuilder_rec_initialiser : Ast0.initialiser rebuilder_inout;
144 rebuilder_rec_initialiser_list :
145 Ast0.initialiser_list rebuilder_inout;
146 rebuilder_rec_parameter : Ast0.parameterTypeDef rebuilder_inout;
147 rebuilder_rec_parameter_list : Ast0.parameter_list rebuilder_inout;
148 rebuilder_rec_statement : Ast0.statement rebuilder_inout;
149 rebuilder_rec_case_line : Ast0.case_line rebuilder_inout;
150 rebuilder_rec_top_level : Ast0.top_level rebuilder_inout;
151 rebuilder_rec_expression_dots :
152 Ast0.expression Ast0.dots rebuilder_inout;
153 rebuilder_rec_statement_dots :
154 Ast0.statement Ast0.dots rebuilder_inout;
155 rebuilder_rec_declaration_dots :
156 Ast0.declaration Ast0.dots rebuilder_inout;
157 rebuilder_rec_case_line_dots :
158 Ast0.case_line Ast0.dots rebuilder_inout;
159 rebuilder_rec_anything : Ast0.anything rebuilder_inout}
160
161type 'mc rmcode = 'mc Ast0.mcode rebuilder_inout
162type 'cd rcode =
163 rebuilder_rec_functions -> ('cd rebuilder_inout) -> 'cd rebuilder_inout
164
165type rebuilder_functions =
ae4735db 166 {rebuilder_meta_mcode : Ast_cocci.meta_name rmcode;
b1b2de81
C
167 rebuilder_string_mcode : string rmcode;
168 rebuilder_const_mcode : Ast.constant rmcode;
169 rebuilder_assign_mcode : Ast.assignOp rmcode;
170 rebuilder_fix_mcode : Ast.fixOp rmcode;
171 rebuilder_unary_mcode : Ast.unaryOp rmcode;
172 rebuilder_binary_mcode : Ast.binaryOp rmcode;
173 rebuilder_cv_mcode : Ast.const_vol rmcode;
174 rebuilder_sign_mcode : Ast.sign rmcode;
175 rebuilder_struct_mcode : Ast.structUnion rmcode;
176 rebuilder_storage_mcode : Ast.storage rmcode;
177 rebuilder_inc_mcode : Ast.inc_file rmcode;
178 rebuilder_dotsexprfn : Ast0.expression Ast0.dots rcode;
179 rebuilder_dotsinitfn : Ast0.initialiser Ast0.dots rcode;
180 rebuilder_dotsparamfn : Ast0.parameterTypeDef Ast0.dots rcode;
181 rebuilder_dotsstmtfn : Ast0.statement Ast0.dots rcode;
182 rebuilder_dotsdeclfn : Ast0.declaration Ast0.dots rcode;
183 rebuilder_dotscasefn : Ast0.case_line Ast0.dots rcode;
184 rebuilder_identfn : Ast0.ident rcode;
185 rebuilder_exprfn : Ast0.expression rcode;
186 rebuilder_tyfn : Ast0.typeC rcode;
187 rebuilder_initfn : Ast0.initialiser rcode;
188 rebuilder_paramfn : Ast0.parameterTypeDef rcode;
189 rebuilder_declfn : Ast0.declaration rcode;
190 rebuilder_stmtfn : Ast0.statement rcode;
191 rebuilder_casefn : Ast0.case_line rcode;
192 rebuilder_topfn : Ast0.top_level rcode}
193
194(* ----------------------------------------------------------------------- *)
195(* combiner_rebuilder *)
196
197type ('mc,'a) rcmcode = 'a -> 'mc Ast0.mcode -> ('a * 'mc Ast0.mcode)
198type ('cd,'a) rccode =
199 'a all_functions -> ('cd -> ('a * 'cd)) -> 'cd -> ('a * 'cd)
200
201type 'n combiner_rebuilder_functions =
ae4735db 202 {combiner_rebuilder_meta_mcode : (Ast_cocci.meta_name,'n) rcmcode;
b1b2de81
C
203 combiner_rebuilder_string_mcode : (string,'n) rcmcode;
204 combiner_rebuilder_const_mcode : (Ast.constant,'n) rcmcode;
205 combiner_rebuilder_assign_mcode : (Ast.assignOp,'n) rcmcode;
206 combiner_rebuilder_fix_mcode : (Ast.fixOp,'n) rcmcode;
207 combiner_rebuilder_unary_mcode : (Ast.unaryOp,'n) rcmcode;
208 combiner_rebuilder_binary_mcode : (Ast.binaryOp,'n) rcmcode;
209 combiner_rebuilder_cv_mcode : (Ast.const_vol,'n) rcmcode;
210 combiner_rebuilder_sign_mcode : (Ast.sign,'n) rcmcode;
211 combiner_rebuilder_struct_mcode : (Ast.structUnion,'n) rcmcode;
212 combiner_rebuilder_storage_mcode : (Ast.storage,'n) rcmcode;
213 combiner_rebuilder_inc_mcode : (Ast.inc_file,'n) rcmcode;
214 combiner_rebuilder_dotsexprfn : (Ast0.expression Ast0.dots,'n) rccode;
215 combiner_rebuilder_dotsinitfn : (Ast0.initialiser Ast0.dots,'n) rccode;
216 combiner_rebuilder_dotsparamfn :
217 (Ast0.parameterTypeDef Ast0.dots,'n) rccode;
218 combiner_rebuilder_dotsstmtfn : (Ast0.statement Ast0.dots,'n) rccode;
219 combiner_rebuilder_dotsdeclfn : (Ast0.declaration Ast0.dots,'n) rccode;
220 combiner_rebuilder_dotscasefn : (Ast0.case_line Ast0.dots,'n) rccode;
221 combiner_rebuilder_identfn : (Ast0.ident,'n) rccode;
222 combiner_rebuilder_exprfn : (Ast0.expression,'n) rccode;
223 combiner_rebuilder_tyfn : (Ast0.typeC,'n) rccode;
224 combiner_rebuilder_initfn : (Ast0.initialiser,'n) rccode;
225 combiner_rebuilder_paramfn : (Ast0.parameterTypeDef,'n) rccode;
226 combiner_rebuilder_declfn : (Ast0.declaration,'n) rccode;
227 combiner_rebuilder_stmtfn : (Ast0.statement,'n) rccode;
228 combiner_rebuilder_casefn : (Ast0.case_line,'n) rccode;
229 combiner_rebuilder_topfn : (Ast0.top_level,'n) rccode}