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.
25 (* types that clutter the .mly file *)
26 (* for iso metavariables, true if they can only match nonmodified, unitary
31 Include
of string | Iso
of (string,string) Common.either
32 | Virt
of string list
(* virtual rules *)
35 line_type
* int * int * int * int (* starting spaces *) *
36 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code before*) *
37 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code after *) *
38 Ast0_cocci.meta_pos
(* position variable, minus only *)
40 (* ---------------------------------------------------------------------- *)
43 MINUS
| OPTMINUS
| UNIQUEMINUS
45 | CONTEXT
| UNIQUE
| OPT
47 type iconstraints
= Ast_cocci.idconstraint
48 type econstraints
= Ast0_cocci.constraints
49 type pconstraints
= Ast_cocci.meta_name list
51 val in_rule_name
: bool ref (* true if parsing the rule name *)
52 val in_meta
: bool ref (* true if parsing the metavariable decls *)
53 val in_iso
: bool ref (* true if parsing the isomorphisms *)
54 val in_generating
: bool ref(* true if generating a rule *)
55 val ignore_patch_or_match
: bool ref (* skip rules not satisfying virt *)
56 val in_prolog
: bool ref (* true if parsing the beginning of an SP *)
57 val saw_struct
: bool ref (* true if saw struct/union *)
58 val inheritable_positions
: string list
ref
60 val call_in_meta
: (unit -> 'a
) -> 'a
62 val all_metadecls
: (string, Ast_cocci.metavar list
) Hashtbl.t
64 val clear_meta
: (unit -> unit) ref
67 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
69 val add_virt_id_meta_found
: (string -> string -> unit) ref
71 val add_virt_id_meta_not_found
:
72 (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
74 val add_fresh_id_meta
: (Ast_cocci.meta_name
-> unit) ref
76 val add_type_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
78 val add_init_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
80 val add_param_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
82 val add_paramlist_meta
:
83 (Ast_cocci.meta_name
-> Ast_cocci.meta_name
option -> Ast0_cocci.pure
->
87 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
88 Ast0_cocci.pure
-> unit) ref
91 (Ast_cocci.meta_name
-> econstraints
-> Ast0_cocci.pure
-> unit) ref
94 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
95 Ast0_cocci.pure
-> unit) ref
98 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
99 econstraints
-> Ast0_cocci.pure
-> unit) ref
101 val add_local_idexp_meta
:
102 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
103 econstraints
-> Ast0_cocci.pure
-> unit) ref
105 val add_explist_meta
:
106 (Ast_cocci.meta_name
-> Ast_cocci.meta_name
option -> Ast0_cocci.pure
->
109 val add_stm_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
111 val add_stmlist_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
114 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
116 val add_local_func_meta
:
117 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
119 val add_declarer_meta
:
120 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
122 val add_iterator_meta
:
123 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
126 (Ast_cocci.meta_name
-> pconstraints
-> Ast_cocci.meta_collect
-> unit) ref
128 val add_type_name
: (string -> unit) ref
130 val add_declarer_name
: (string -> unit) ref
132 val add_iterator_name
: (string -> unit) ref
134 val init_rule
: (unit -> unit) ref
136 val install_bindings
: (string -> unit) ref