Release coccinelle-0.2.4
[bpt/coccinelle.git] / parsing_cocci / visitor_ast.mli
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
34e49164
C
49type 'a combiner =
50 {combiner_ident : Ast_cocci.ident -> 'a;
51 combiner_expression : Ast_cocci.expression -> 'a;
52 combiner_fullType : Ast_cocci.fullType -> 'a;
53 combiner_typeC : Ast_cocci.typeC -> 'a;
54 combiner_declaration : Ast_cocci.declaration -> 'a;
55 combiner_initialiser : Ast_cocci.initialiser -> 'a;
56 combiner_parameter : Ast_cocci.parameterTypeDef -> 'a;
57 combiner_parameter_list : Ast_cocci.parameter_list -> 'a;
58 combiner_rule_elem : Ast_cocci.rule_elem -> 'a;
59 combiner_statement : Ast_cocci.statement -> 'a;
60 combiner_case_line : Ast_cocci.case_line -> 'a;
61 combiner_top_level : Ast_cocci.top_level -> 'a;
62 combiner_anything : Ast_cocci.anything -> 'a;
63 combiner_expression_dots :
64 Ast_cocci.expression Ast_cocci.dots -> 'a;
65 combiner_statement_dots :
66 Ast_cocci.statement Ast_cocci.dots -> 'a;
67 combiner_declaration_dots :
c491d8ee
C
68 Ast_cocci.declaration Ast_cocci.dots -> 'a;
69 combiner_initialiser_dots :
70 Ast_cocci.initialiser Ast_cocci.dots -> 'a}
34e49164
C
71
72type ('mc,'a) cmcode = 'a combiner -> 'mc Ast_cocci.mcode -> 'a
73type ('cd,'a) ccode = 'a combiner -> ('cd -> 'a) -> 'cd -> 'a
74
75val combiner :
76 ('a -> 'a -> 'a) -> 'a ->
ae4735db 77 ((Ast_cocci.meta_name,'a) cmcode) ->
34e49164
C
78 ((string,'a) cmcode) ->
79 ((Ast_cocci.constant,'a) cmcode) ->
80 ((Ast_cocci.assignOp,'a) cmcode) ->
81 ((Ast_cocci.fixOp,'a) cmcode) ->
82 ((Ast_cocci.unaryOp,'a) cmcode) ->
83 ((Ast_cocci.binaryOp,'a) cmcode) ->
84 ((Ast_cocci.const_vol,'a) cmcode) ->
34e49164
C
85 ((Ast_cocci.sign,'a) cmcode) ->
86 ((Ast_cocci.structUnion,'a) cmcode) ->
87 ((Ast_cocci.storage,'a) cmcode) ->
88 ((Ast_cocci.inc_file,'a) cmcode) ->
89 ((Ast_cocci.expression Ast_cocci.dots,'a) ccode) ->
90 ((Ast_cocci.parameterTypeDef Ast_cocci.dots,'a) ccode) ->
91 ((Ast_cocci.statement Ast_cocci.dots,'a) ccode) ->
92 ((Ast_cocci.declaration Ast_cocci.dots,'a) ccode) ->
c491d8ee 93 ((Ast_cocci.initialiser Ast_cocci.dots,'a) ccode) ->
34e49164
C
94 ((Ast_cocci.ident,'a) ccode) ->
95 ((Ast_cocci.expression,'a) ccode) ->
96 ((Ast_cocci.fullType,'a) ccode) ->
97 ((Ast_cocci.typeC,'a) ccode) ->
98 ((Ast_cocci.initialiser,'a) ccode) ->
99 ((Ast_cocci.parameterTypeDef,'a) ccode) ->
100 ((Ast_cocci.declaration,'a) ccode) ->
101 ((Ast_cocci.rule_elem,'a) ccode) ->
102 ((Ast_cocci.statement,'a) ccode) ->
103 ((Ast_cocci.case_line,'a) ccode) ->
104 ((Ast_cocci.top_level,'a) ccode) ->
105 ((Ast_cocci.anything,'a) ccode) ->
106 'a combiner
107
108type 'a inout = 'a -> 'a (* for specifying the type of rebuilder *)
109
110type rebuilder =
111 {rebuilder_ident : Ast_cocci.ident inout;
112 rebuilder_expression : Ast_cocci.expression inout;
113 rebuilder_fullType : Ast_cocci.fullType inout;
114 rebuilder_typeC : Ast_cocci.typeC inout;
115 rebuilder_declaration : Ast_cocci.declaration inout;
116 rebuilder_initialiser : Ast_cocci.initialiser inout;
117 rebuilder_parameter : Ast_cocci.parameterTypeDef inout;
118 rebuilder_parameter_list : Ast_cocci.parameter_list inout;
119 rebuilder_statement : Ast_cocci.statement inout;
120 rebuilder_case_line : Ast_cocci.case_line inout;
121 rebuilder_rule_elem : Ast_cocci.rule_elem inout;
122 rebuilder_top_level : Ast_cocci.top_level inout;
123 rebuilder_expression_dots : Ast_cocci.expression Ast_cocci.dots inout;
124 rebuilder_statement_dots : Ast_cocci.statement Ast_cocci.dots inout;
125 rebuilder_declaration_dots : Ast_cocci.declaration Ast_cocci.dots inout;
c491d8ee 126 rebuilder_initialiser_dots : Ast_cocci.initialiser Ast_cocci.dots inout;
34e49164
C
127 rebuilder_define_param_dots: Ast_cocci.define_param Ast_cocci.dots inout;
128 rebuilder_define_param : Ast_cocci.define_param inout;
129 rebuilder_define_parameters : Ast_cocci.define_parameters inout;
130 rebuilder_anything : Ast_cocci.anything inout}
131
132type 'mc rmcode = 'mc Ast_cocci.mcode inout
133type 'cd rcode = rebuilder -> ('cd inout) -> 'cd inout
134
135val rebuilder :
ae4735db 136 (Ast_cocci.meta_name rmcode) ->
34e49164
C
137 (string rmcode) ->
138 (Ast_cocci.constant rmcode) ->
139 (Ast_cocci.assignOp rmcode) ->
140 (Ast_cocci.fixOp rmcode) ->
141 (Ast_cocci.unaryOp rmcode) ->
142 (Ast_cocci.binaryOp rmcode) ->
143 (Ast_cocci.const_vol rmcode) ->
34e49164
C
144 (Ast_cocci.sign rmcode) ->
145 (Ast_cocci.structUnion rmcode) ->
146 (Ast_cocci.storage rmcode) ->
147 (Ast_cocci.inc_file rmcode) ->
148 (Ast_cocci.expression Ast_cocci.dots rcode) ->
149 (Ast_cocci.parameterTypeDef Ast_cocci.dots rcode) ->
150 (Ast_cocci.statement Ast_cocci.dots rcode) ->
151 (Ast_cocci.declaration Ast_cocci.dots rcode) ->
c491d8ee 152 (Ast_cocci.initialiser Ast_cocci.dots rcode) ->
34e49164
C
153 (Ast_cocci.ident rcode) ->
154 (Ast_cocci.expression rcode) ->
155 (Ast_cocci.fullType rcode) ->
156 (Ast_cocci.typeC rcode) ->
157 (Ast_cocci.initialiser rcode) ->
158 (Ast_cocci.parameterTypeDef rcode) ->
159 (Ast_cocci.declaration rcode) ->
160 (Ast_cocci.rule_elem rcode) ->
161 (Ast_cocci.statement rcode) ->
162 (Ast_cocci.case_line rcode) ->
163 (Ast_cocci.top_level rcode) ->
164 (Ast_cocci.anything rcode) ->
165 rebuilder