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