Release coccinelle-0.2.0
[bpt/coccinelle.git] / parsing_cocci / data.mli
CommitLineData
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(* types that clutter the .mly file *)
24(* for iso metavariables, true if they can only match nonmodified, unitary
25 metavariables *)
26type fresh = bool
27
951c7801
C
28type incl_iso =
29 Include of string | Iso of (string,string) Common.either
30 | Virt of string list (* virtual rules *)
978fd7e5 31
34e49164
C
32type clt =
33 line_type * int * int * int * int (* starting spaces *) *
0708f913
C
34 (string * Ast0_cocci.position_info) list (* code before *) *
35 (string * Ast0_cocci.position_info) list (* code after *) *
34e49164
C
36 Ast0_cocci.meta_pos (* position variable, minus only *)
37
38(* ---------------------------------------------------------------------- *)
39
40and line_type =
41 MINUS | OPTMINUS | UNIQUEMINUS
951c7801 42 | PLUS | PLUSPLUS
34e49164
C
43 | CONTEXT | UNIQUE | OPT
44
951c7801
C
45type iconstraints = Ast_cocci.idconstraint
46type econstraints = Ast0_cocci.constraints
34e49164
C
47type pconstraints = Ast_cocci.meta_name list
48
49val in_rule_name : bool ref (* true if parsing the rule name *)
50val in_meta : bool ref (* true if parsing the metavariable decls *)
51val in_iso : bool ref (* true if parsing the isomorphisms *)
faf9a90c 52val in_generating : bool ref(* true if generating a rule *)
7f004419 53val ignore_patch_or_match : bool ref (* skip rules not satisfying virt *)
34e49164 54val in_prolog : bool ref (* true if parsing the beginning of an SP *)
978fd7e5 55val saw_struct : bool ref (* true if saw struct/union *)
34e49164
C
56val inheritable_positions : string list ref
57
978fd7e5
C
58val call_in_meta : (unit -> 'a) -> 'a
59
34e49164
C
60val all_metadecls : (string, Ast_cocci.metavar list) Hashtbl.t
61
62val clear_meta: (unit -> unit) ref
63
64val add_id_meta:
65 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
66
b1b2de81
C
67val add_fresh_id_meta: (Ast_cocci.meta_name -> unit) ref
68
34e49164
C
69val add_type_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
70
113803cf
C
71val add_init_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
72
34e49164
C
73val add_param_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
74
75val add_paramlist_meta:
76 (Ast_cocci.meta_name -> Ast_cocci.meta_name option -> Ast0_cocci.pure ->
77 unit) ref
78
79val add_const_meta:
80 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
81 Ast0_cocci.pure -> unit) ref
82
83val add_err_meta:
84 (Ast_cocci.meta_name -> econstraints -> Ast0_cocci.pure -> unit) ref
85
86val add_exp_meta:
87 (Type_cocci.typeC list option -> Ast_cocci.meta_name -> econstraints ->
88 Ast0_cocci.pure -> unit) ref
89
90val add_idexp_meta:
91 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
92 econstraints -> Ast0_cocci.pure -> unit) ref
93
94val add_local_idexp_meta:
95 (Type_cocci.typeC list option -> Ast_cocci.meta_name ->
96 econstraints -> Ast0_cocci.pure -> unit) ref
97
98val add_explist_meta:
99 (Ast_cocci.meta_name -> Ast_cocci.meta_name option -> Ast0_cocci.pure ->
100 unit) ref
101
102val add_stm_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
103
104val add_stmlist_meta: (Ast_cocci.meta_name -> Ast0_cocci.pure -> unit) ref
105
106val add_func_meta:
107 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
108
109val add_local_func_meta:
110 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
111
112val add_declarer_meta:
113 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
114
115val add_iterator_meta:
116 (Ast_cocci.meta_name -> iconstraints -> Ast0_cocci.pure -> unit) ref
117
118val add_pos_meta:
119 (Ast_cocci.meta_name -> pconstraints -> Ast_cocci.meta_collect -> unit) ref
120
121val add_type_name: (string -> unit) ref
122
123val add_declarer_name: (string -> unit) ref
124
125val add_iterator_name: (string -> unit) ref
126
127val init_rule: (unit -> unit) ref
128
129val install_bindings: (string -> unit) ref