2 * Copyright 2012, INRIA
3 * Julia Lawall, Gilles Muller
4 * Copyright 2010-2011, INRIA, University of Copenhagen
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.
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.
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.
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/>.
22 * The authors reserve the right to distribute this or future versions of
23 * Coccinelle under other licenses.
29 * Copyright 2012, INRIA
30 * Julia Lawall, Gilles Muller
31 * Copyright 2010-2011, INRIA, University of Copenhagen
32 * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
33 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
34 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
35 * This file is part of Coccinelle.
37 * Coccinelle is free software: you can redistribute it and/or modify
38 * it under the terms of the GNU General Public License as published by
39 * the Free Software Foundation, according to version 2 of the License.
41 * Coccinelle is distributed in the hope that it will be useful,
42 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 * GNU General Public License for more details.
46 * You should have received a copy of the GNU General Public License
47 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
49 * The authors reserve the right to distribute this or future versions of
50 * Coccinelle under other licenses.
55 (* types that clutter the .mly file *)
56 (* for iso metavariables, true if they can only match nonmodified, unitary
61 Include
of string | Iso
of (string,string) Common.either
62 | Virt
of string list
(* virtual rules *)
65 line_type
* int * int * int * int (* starting spaces *) *
66 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code before*) *
67 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code after *) *
68 Ast0_cocci.anything list
(* position variable, minus only *)
70 (* ---------------------------------------------------------------------- *)
73 MINUS
| OPTMINUS
| UNIQUEMINUS
75 | CONTEXT
| UNIQUE
| OPT
77 type iconstraints
= Ast_cocci.idconstraint
78 type econstraints
= Ast0_cocci.constraints
79 type pconstraints
= Ast_cocci.meta_name list
81 val in_rule_name
: bool ref (* true if parsing the rule name *)
82 val in_meta
: bool ref (* true if parsing the metavariable decls *)
83 val in_iso
: bool ref (* true if parsing the isomorphisms *)
84 val in_generating
: bool ref(* true if generating a rule *)
85 val ignore_patch_or_match
: bool ref (* skip rules not satisfying virt *)
86 val in_prolog
: bool ref (* true if parsing the beginning of an SP *)
87 val saw_struct
: bool ref (* true if saw struct/union *)
88 val inheritable_positions
: string list
ref
90 val call_in_meta
: (unit -> 'a
) -> 'a
92 val all_metadecls
: (string, Ast_cocci.metavar list
) Hashtbl.t
94 val clear_meta
: (unit -> unit) ref
96 val add_meta_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
99 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
101 val add_virt_id_meta_found
: (string -> string -> unit) ref
103 val add_virt_id_meta_not_found
:
104 (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
106 val add_fresh_id_meta
: (Ast_cocci.meta_name
-> Ast_cocci.seed
-> unit) ref
108 val add_type_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
110 val add_init_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
112 val add_initlist_meta
:
113 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
116 val add_param_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
118 val add_paramlist_meta
:
119 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
123 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
124 Ast0_cocci.pure
-> unit) ref
127 (Ast_cocci.meta_name
-> econstraints
-> Ast0_cocci.pure
-> unit) ref
130 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
131 Ast0_cocci.pure
-> unit) ref
134 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
135 econstraints
-> Ast0_cocci.pure
-> unit) ref
137 val add_local_idexp_meta
:
138 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
139 econstraints
-> Ast0_cocci.pure
-> unit) ref
141 val add_explist_meta
:
142 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
145 val add_decl_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
147 val add_field_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
149 val add_symbol_meta
: (string -> unit) ref
151 val add_field_list_meta
:
152 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
-> unit) ref
154 val add_stm_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
156 val add_stmlist_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
159 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
161 val add_local_func_meta
:
162 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
164 val add_declarer_meta
:
165 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
167 val add_iterator_meta
:
168 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
171 (Ast_cocci.meta_name
-> pconstraints
-> Ast_cocci.meta_collect
-> unit) ref
173 val add_type_name
: (string -> unit) ref
175 val add_declarer_name
: (string -> unit) ref
177 val add_iterator_name
: (string -> unit) ref
179 val init_rule
: (unit -> unit) ref
181 val install_bindings
: (string -> unit) ref