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