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.
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.
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.
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/>.
18 * The authors reserve the right to distribute this or future versions of
19 * Coccinelle under other licenses.
24 * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen
25 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
26 * This file is part of Coccinelle.
28 * Coccinelle is free software: you can redistribute it and/or modify
29 * it under the terms of the GNU General Public License as published by
30 * the Free Software Foundation, according to version 2 of the License.
32 * Coccinelle is distributed in the hope that it will be useful,
33 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 * GNU General Public License for more details.
37 * You should have received a copy of the GNU General Public License
38 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
40 * The authors reserve the right to distribute this or future versions of
41 * Coccinelle under other licenses.
45 (* types that clutter the .mly file *)
46 (* for iso metavariables, true if they can only match nonmodified, unitary
51 Include
of string | Iso
of (string,string) Common.either
52 | Virt
of string list
(* virtual rules *)
55 line_type
* int * int * int * int (* starting spaces *) *
56 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code before*) *
57 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code after *) *
58 Ast0_cocci.meta_pos
(* position variable, minus only *)
60 (* ---------------------------------------------------------------------- *)
63 MINUS
| OPTMINUS
| UNIQUEMINUS
65 | CONTEXT
| UNIQUE
| OPT
67 type iconstraints
= Ast_cocci.idconstraint
68 type econstraints
= Ast0_cocci.constraints
69 type pconstraints
= Ast_cocci.meta_name list
71 val in_rule_name
: bool ref (* true if parsing the rule name *)
72 val in_meta
: bool ref (* true if parsing the metavariable decls *)
73 val in_iso
: bool ref (* true if parsing the isomorphisms *)
74 val in_generating
: bool ref(* true if generating a rule *)
75 val ignore_patch_or_match
: bool ref (* skip rules not satisfying virt *)
76 val in_prolog
: bool ref (* true if parsing the beginning of an SP *)
77 val saw_struct
: bool ref (* true if saw struct/union *)
78 val inheritable_positions
: string list
ref
80 val call_in_meta
: (unit -> 'a
) -> 'a
82 val all_metadecls
: (string, Ast_cocci.metavar list
) Hashtbl.t
84 val clear_meta
: (unit -> unit) ref
87 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
89 val add_virt_id_meta_found
: (string -> string -> unit) ref
91 val add_virt_id_meta_not_found
:
92 (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
94 val add_fresh_id_meta
: (Ast_cocci.meta_name
-> unit) ref
96 val add_type_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
98 val add_init_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
100 val add_param_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
102 val add_paramlist_meta
:
103 (Ast_cocci.meta_name
-> Ast_cocci.meta_name
option -> Ast0_cocci.pure
->
107 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
108 Ast0_cocci.pure
-> unit) ref
111 (Ast_cocci.meta_name
-> econstraints
-> Ast0_cocci.pure
-> unit) ref
114 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
115 Ast0_cocci.pure
-> unit) ref
118 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
119 econstraints
-> Ast0_cocci.pure
-> unit) ref
121 val add_local_idexp_meta
:
122 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
123 econstraints
-> Ast0_cocci.pure
-> unit) ref
125 val add_explist_meta
:
126 (Ast_cocci.meta_name
-> Ast_cocci.meta_name
option -> Ast0_cocci.pure
->
129 val add_stm_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
131 val add_stmlist_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
134 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
136 val add_local_func_meta
:
137 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
139 val add_declarer_meta
:
140 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
142 val add_iterator_meta
:
143 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
146 (Ast_cocci.meta_name
-> pconstraints
-> Ast_cocci.meta_collect
-> unit) ref
148 val add_type_name
: (string -> unit) ref
150 val add_declarer_name
: (string -> unit) ref
152 val add_iterator_name
: (string -> unit) ref
154 val init_rule
: (unit -> unit) ref
156 val install_bindings
: (string -> unit) ref