Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / parsing_cocci / data.mli
CommitLineData
f537ebc4 1(*
17ba0788
C
2 * Copyright 2012, INRIA
3 * Julia Lawall, Gilles Muller
4 * Copyright 2010-2011, INRIA, University of Copenhagen
f537ebc4
C
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
34e49164
C
27(* types that clutter the .mly file *)
28(* for iso metavariables, true if they can only match nonmodified, unitary
29 metavariables *)
30type fresh = bool
31
951c7801
C
32type incl_iso =
33 Include of string | Iso of (string,string) Common.either
34 | Virt of string list (* virtual rules *)
978fd7e5 35
34e49164
C
36type clt =
37 line_type * int * int * int * int (* starting spaces *) *
c3e37e97
C
38 (Ast_cocci.added_string * Ast0_cocci.position_info) list (*code before*) *
39 (Ast_cocci.added_string * Ast0_cocci.position_info) list (*code after *) *
17ba0788 40 Ast0_cocci.anything list (* position variable, minus only *)
34e49164
C
41
42(* ---------------------------------------------------------------------- *)
43
44and line_type =
45 MINUS | OPTMINUS | UNIQUEMINUS
951c7801 46 | PLUS | PLUSPLUS
34e49164
C
47 | CONTEXT | UNIQUE | OPT
48
951c7801
C
49type iconstraints = Ast_cocci.idconstraint
50type econstraints = Ast0_cocci.constraints
34e49164
C
51type pconstraints = Ast_cocci.meta_name list
52
53val in_rule_name : bool ref (* true if parsing the rule name *)
54val in_meta : bool ref (* true if parsing the metavariable decls *)
55val in_iso : bool ref (* true if parsing the isomorphisms *)
faf9a90c 56val in_generating : bool ref(* true if generating a rule *)
7f004419 57val ignore_patch_or_match : bool ref (* skip rules not satisfying virt *)
34e49164 58val in_prolog : bool ref (* true if parsing the beginning of an SP *)
978fd7e5 59val saw_struct : bool ref (* true if saw struct/union *)
34e49164
C
60val inheritable_positions : string list ref
61
978fd7e5
C
62val call_in_meta : (unit -> 'a) -> 'a
63
34e49164
C
64val all_metadecls : (string, Ast_cocci.metavar list) Hashtbl.t
65
66val clear_meta: (unit -> unit) ref
67
b23ff9c7
C
68val add_meta_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
69
34e49164
C
70val add_id_meta:
71 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
72
ae4735db
C
73val add_virt_id_meta_found: (string -> string -> unit) ref
74
75val add_virt_id_meta_not_found:
76 (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
77
8babbc8f 78val add_fresh_id_meta: (Ast_cocci.meta_name -> Ast_cocci.seed -> unit) ref
b1b2de81 79
34e49164
C
80val add_type_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
81
113803cf
C
82val add_init_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
83
8f657093
C
84val add_initlist_meta:
85 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
86 unit) ref
87
34e49164
C
88val add_param_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
89
90val add_paramlist_meta:
88e71198 91 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
34e49164
C
92 unit) ref
93
94val add_const_meta:
95 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
96 Ast0_cocci.pure -> unit) ref
97
98val add_err_meta:
99 (Ast_cocci.meta_name -> econstraints -> Ast0_cocci.pure -> unit) ref
100
101val add_exp_meta:
102 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
103 Ast0_cocci.pure -> unit) ref
104
105val add_idexp_meta:
106 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
107 econstraints -> Ast0_cocci.pure -> unit) ref
108
109val add_local_idexp_meta:
110 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
111 econstraints -> Ast0_cocci.pure -> unit) ref
112
113val add_explist_meta:
88e71198 114 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure ->
34e49164
C
115 unit) ref
116
413ffc02
C
117val add_decl_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
118
119val add_field_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
120
97111a47
C
121val add_symbol_meta: (string -> unit) ref
122
190f1acf
C
123val add_field_list_meta:
124 (Ast_cocci.meta_name -> Ast_cocci.list_len -> Ast0_cocci.pure -> unit) ref
125
34e49164
C
126val add_stm_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
127
128val add_stmlist_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
129
130val add_func_meta:
131 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
132
133val add_local_func_meta:
134 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
135
136val add_declarer_meta:
137 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
138
139val add_iterator_meta:
140 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
141
142val add_pos_meta:
143 (Ast_cocci.meta_name -> pconstraints -> Ast_cocci.meta_collect -> unit) ref
144
145val add_type_name: (string -> unit) ref
146
147val add_declarer_name: (string -> unit) ref
148
149val add_iterator_name: (string -> unit) ref
150
151val init_rule: (unit -> unit) ref
152
153val install_bindings: (string -> unit) ref