Release coccinelle-0.2.4
[bpt/coccinelle.git] / parsing_cocci / data.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
49(* types that clutter the .mly file *)
50(* for iso metavariables, true if they can only match nonmodified, unitary
51 metavariables *)
52type fresh = bool
53
951c7801
C
54type incl_iso =
55 Include of string | Iso of (string,string) Common.either
56 | Virt of string list (* virtual rules *)
978fd7e5 57
34e49164
C
58type clt =
59 line_type * int * int * int * int (* starting spaces *) *
c3e37e97
C
60 (Ast_cocci.added_string * Ast0_cocci.position_info) list (*code before*) *
61 (Ast_cocci.added_string * Ast0_cocci.position_info) list (*code after *) *
34e49164
C
62 Ast0_cocci.meta_pos (* position variable, minus only *)
63
64(* ---------------------------------------------------------------------- *)
65
66and line_type =
67 MINUS | OPTMINUS | UNIQUEMINUS
951c7801 68 | PLUS | PLUSPLUS
34e49164
C
69 | CONTEXT | UNIQUE | OPT
70
951c7801
C
71type iconstraints = Ast_cocci.idconstraint
72type econstraints = Ast0_cocci.constraints
34e49164
C
73type pconstraints = Ast_cocci.meta_name list
74
75val in_rule_name : bool ref (* true if parsing the rule name *)
76val in_meta : bool ref (* true if parsing the metavariable decls *)
77val in_iso : bool ref (* true if parsing the isomorphisms *)
faf9a90c 78val in_generating : bool ref(* true if generating a rule *)
7f004419 79val ignore_patch_or_match : bool ref (* skip rules not satisfying virt *)
34e49164 80val in_prolog : bool ref (* true if parsing the beginning of an SP *)
978fd7e5 81val saw_struct : bool ref (* true if saw struct/union *)
34e49164
C
82val inheritable_positions : string list ref
83
978fd7e5
C
84val call_in_meta : (unit -> 'a) -> 'a
85
34e49164
C
86val all_metadecls : (string, Ast_cocci.metavar list) Hashtbl.t
87
88val clear_meta: (unit -> unit) ref
89
90val add_id_meta:
91 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
92
ae4735db
C
93val add_virt_id_meta_found: (string -> string -> unit) ref
94
95val add_virt_id_meta_not_found:
96 (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
97
b1b2de81
C
98val add_fresh_id_meta: (Ast_cocci.meta_name -> unit) ref
99
34e49164
C
100val add_type_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
101
113803cf
C
102val add_init_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
103
34e49164
C
104val add_param_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
105
106val add_paramlist_meta:
88e71198 107 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
34e49164
C
108 unit) ref
109
110val add_const_meta:
111 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
112 Ast0_cocci.pure -> unit) ref
113
114val add_err_meta:
115 (Ast_cocci.meta_name -> econstraints -> Ast0_cocci.pure -> unit) ref
116
117val add_exp_meta:
118 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
119 Ast0_cocci.pure -> unit) ref
120
121val add_idexp_meta:
122 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
123 econstraints -> Ast0_cocci.pure -> unit) ref
124
125val add_local_idexp_meta:
126 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
127 econstraints -> Ast0_cocci.pure -> unit) ref
128
129val add_explist_meta:
88e71198 130 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
34e49164
C
131 unit) ref
132
413ffc02
C
133val add_decl_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
134
135val add_field_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
136
34e49164
C
137val add_stm_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
138
139val add_stmlist_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
140
141val add_func_meta:
142 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
143
144val add_local_func_meta:
145 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
146
147val add_declarer_meta:
148 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
149
150val add_iterator_meta:
151 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
152
153val add_pos_meta:
154 (Ast_cocci.meta_name -> pconstraints -> Ast_cocci.meta_collect -> unit) ref
155
156val add_type_name: (string -> unit) ref
157
158val add_declarer_name: (string -> unit) ref
159
160val add_iterator_name: (string -> unit) ref
161
162val init_rule: (unit -> unit) ref
163
164val install_bindings: (string -> unit) ref