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.
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.
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.
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/>.
20 * The authors reserve the right to distribute this or future versions of
21 * Coccinelle under other licenses.
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.
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.
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.
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/>.
44 * The authors reserve the right to distribute this or future versions of
45 * Coccinelle under other licenses.
49 (* types that clutter the .mly file *)
50 (* for iso metavariables, true if they can only match nonmodified, unitary
55 Include
of string | Iso
of (string,string) Common.either
56 | Virt
of string list
(* virtual rules *)
59 line_type
* int * int * int * int (* starting spaces *) *
60 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code before*) *
61 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code after *) *
62 Ast0_cocci.meta_pos
(* position variable, minus only *)
64 (* ---------------------------------------------------------------------- *)
67 MINUS
| OPTMINUS
| UNIQUEMINUS
69 | CONTEXT
| UNIQUE
| OPT
71 type iconstraints
= Ast_cocci.idconstraint
72 type econstraints
= Ast0_cocci.constraints
73 type pconstraints
= Ast_cocci.meta_name list
75 val in_rule_name
: bool ref (* true if parsing the rule name *)
76 val in_meta
: bool ref (* true if parsing the metavariable decls *)
77 val in_iso
: bool ref (* true if parsing the isomorphisms *)
78 val in_generating
: bool ref(* true if generating a rule *)
79 val ignore_patch_or_match
: bool ref (* skip rules not satisfying virt *)
80 val in_prolog
: bool ref (* true if parsing the beginning of an SP *)
81 val saw_struct
: bool ref (* true if saw struct/union *)
82 val inheritable_positions
: string list
ref
84 val call_in_meta
: (unit -> 'a
) -> 'a
86 val all_metadecls
: (string, Ast_cocci.metavar list
) Hashtbl.t
88 val clear_meta
: (unit -> unit) ref
91 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
93 val add_virt_id_meta_found
: (string -> string -> unit) ref
95 val add_virt_id_meta_not_found
:
96 (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
98 val add_fresh_id_meta
: (Ast_cocci.meta_name
-> unit) ref
100 val add_type_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
102 val add_init_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
104 val add_param_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
106 val add_paramlist_meta
:
107 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
111 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
112 Ast0_cocci.pure
-> unit) ref
115 (Ast_cocci.meta_name
-> econstraints
-> Ast0_cocci.pure
-> unit) ref
118 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
119 Ast0_cocci.pure
-> unit) ref
122 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
123 econstraints
-> Ast0_cocci.pure
-> unit) ref
125 val add_local_idexp_meta
:
126 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
127 econstraints
-> Ast0_cocci.pure
-> unit) ref
129 val add_explist_meta
:
130 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
133 val add_decl_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
135 val add_field_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
137 val add_stm_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
139 val add_stmlist_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
142 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
144 val add_local_func_meta
:
145 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
147 val add_declarer_meta
:
148 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
150 val add_iterator_meta
:
151 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
154 (Ast_cocci.meta_name
-> pconstraints
-> Ast_cocci.meta_collect
-> unit) ref
156 val add_type_name
: (string -> unit) ref
158 val add_declarer_name
: (string -> unit) ref
160 val add_iterator_name
: (string -> unit) ref
162 val init_rule
: (unit -> unit) ref
164 val install_bindings
: (string -> unit) ref