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