Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / parsing_cocci / data.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 # 0 "./data.mli"
28 (*
29 * Copyright 2012, INRIA
30 * Julia Lawall, Gilles Muller
31 * Copyright 2010-2011, INRIA, University of Copenhagen
32 * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
33 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
34 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
35 * This file is part of Coccinelle.
36 *
37 * Coccinelle is free software: you can redistribute it and/or modify
38 * it under the terms of the GNU General Public License as published by
39 * the Free Software Foundation, according to version 2 of the License.
40 *
41 * Coccinelle is distributed in the hope that it will be useful,
42 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 * GNU General Public License for more details.
45 *
46 * You should have received a copy of the GNU General Public License
47 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
48 *
49 * The authors reserve the right to distribute this or future versions of
50 * Coccinelle under other licenses.
51 *)
52
53
54 # 0 "./data.mli"
55 (* types that clutter the .mly file *)
56 (* for iso metavariables, true if they can only match nonmodified, unitary
57 metavariables *)
58 type fresh = bool
59
60 type incl_iso =
61 Include of string | Iso of (string,string) Common.either
62 | Virt of string list (* virtual rules *)
63
64 type clt =
65 line_type * int * int * int * int (* starting spaces *) *
66 (Ast_cocci.added_string * Ast0_cocci.position_info) list (*code before*) *
67 (Ast_cocci.added_string * Ast0_cocci.position_info) list (*code after *) *
68 Ast0_cocci.anything list (* position variable, minus only *)
69
70 (* ---------------------------------------------------------------------- *)
71
72 and line_type =
73 MINUS | OPTMINUS | UNIQUEMINUS
74 | PLUS | PLUSPLUS
75 | CONTEXT | UNIQUE | OPT
76
77 type iconstraints = Ast_cocci.idconstraint
78 type econstraints = Ast0_cocci.constraints
79 type pconstraints = Ast_cocci.meta_name list
80
81 val in_rule_name : bool ref (* true if parsing the rule name *)
82 val in_meta : bool ref (* true if parsing the metavariable decls *)
83 val in_iso : bool ref (* true if parsing the isomorphisms *)
84 val in_generating : bool ref(* true if generating a rule *)
85 val ignore_patch_or_match : bool ref (* skip rules not satisfying virt *)
86 val in_prolog : bool ref (* true if parsing the beginning of an SP *)
87 val saw_struct : bool ref (* true if saw struct/union *)
88 val inheritable_positions : string list ref
89
90 val call_in_meta : (unit -> 'a) -> 'a
91
92 val all_metadecls : (string, Ast_cocci.metavar list) Hashtbl.t
93
94 val clear_meta: (unit -> unit) ref
95
96 val add_meta_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
97
98 val add_id_meta:
99 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
100
101 val add_virt_id_meta_found: (string -> string -> unit) ref
102
103 val add_virt_id_meta_not_found:
104 (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
105
106 val add_fresh_id_meta: (Ast_cocci.meta_name -> Ast_cocci.seed -> unit) ref
107
108 val add_type_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
109
110 val add_init_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
111
112 val add_initlist_meta:
113 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
114 unit) ref
115
116 val add_param_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
117
118 val add_paramlist_meta:
119 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
120 unit) ref
121
122 val add_const_meta:
123 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
124 Ast0_cocci.pure -> unit) ref
125
126 val add_err_meta:
127 (Ast_cocci.meta_name -> econstraints -> Ast0_cocci.pure -> unit) ref
128
129 val add_exp_meta:
130 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
131 Ast0_cocci.pure -> unit) ref
132
133 val add_idexp_meta:
134 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
135 econstraints -> Ast0_cocci.pure -> unit) ref
136
137 val add_local_idexp_meta:
138 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
139 econstraints -> Ast0_cocci.pure -> unit) ref
140
141 val add_explist_meta:
142 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
143 unit) ref
144
145 val add_decl_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
146
147 val add_field_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
148
149 val add_symbol_meta: (string -> unit) ref
150
151 val add_field_list_meta:
152 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure -> unit) ref
153
154 val add_stm_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
155
156 val add_stmlist_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
157
158 val add_func_meta:
159 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
160
161 val add_local_func_meta:
162 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
163
164 val add_declarer_meta:
165 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
166
167 val add_iterator_meta:
168 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
169
170 val add_pos_meta:
171 (Ast_cocci.meta_name -> pconstraints -> Ast_cocci.meta_collect -> unit) ref
172
173 val add_type_name: (string -> unit) ref
174
175 val add_declarer_name: (string -> unit) ref
176
177 val add_iterator_name: (string -> unit) ref
178
179 val init_rule: (unit -> unit) ref
180
181 val install_bindings: (string -> unit) ref