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.
27 (* types that clutter the .mly file *)
28 (* for iso metavariables, true if they can only match nonmodified, unitary
33 Include
of string | Iso
of (string,string) Common.either
34 | Virt
of string list
(* virtual rules *)
37 line_type
* int * int * int * int (* starting spaces *) *
38 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code before*) *
39 (Ast_cocci.added_string
* Ast0_cocci.position_info
) list
(*code after *) *
40 Ast0_cocci.anything list
(* position variable, minus only *)
42 (* ---------------------------------------------------------------------- *)
45 MINUS
| OPTMINUS
| UNIQUEMINUS
47 | CONTEXT
| UNIQUE
| OPT
49 type iconstraints
= Ast_cocci.idconstraint
50 type econstraints
= Ast0_cocci.constraints
51 type pconstraints
= Ast_cocci.meta_name list
53 val in_rule_name
: bool ref (* true if parsing the rule name *)
54 val in_meta
: bool ref (* true if parsing the metavariable decls *)
55 val in_iso
: bool ref (* true if parsing the isomorphisms *)
56 val in_generating
: bool ref(* true if generating a rule *)
57 val ignore_patch_or_match
: bool ref (* skip rules not satisfying virt *)
58 val in_prolog
: bool ref (* true if parsing the beginning of an SP *)
59 val saw_struct
: bool ref (* true if saw struct/union *)
60 val inheritable_positions
: string list
ref
62 val call_in_meta
: (unit -> 'a
) -> 'a
64 val all_metadecls
: (string, Ast_cocci.metavar list
) Hashtbl.t
66 val clear_meta
: (unit -> unit) ref
68 val add_meta_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
71 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
73 val add_virt_id_meta_found
: (string -> string -> unit) ref
75 val add_virt_id_meta_not_found
:
76 (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
78 val add_fresh_id_meta
: (Ast_cocci.meta_name
-> Ast_cocci.seed
-> unit) ref
80 val add_type_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
82 val add_init_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
84 val add_initlist_meta
:
85 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
88 val add_param_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
90 val add_paramlist_meta
:
91 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
95 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
96 Ast0_cocci.pure
-> unit) ref
99 (Ast_cocci.meta_name
-> econstraints
-> Ast0_cocci.pure
-> unit) ref
102 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
103 Ast0_cocci.pure
-> unit) ref
106 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
107 econstraints
-> Ast0_cocci.pure
-> unit) ref
109 val add_local_idexp_meta
:
110 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
111 econstraints
-> Ast0_cocci.pure
-> unit) ref
113 val add_explist_meta
:
114 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
->
117 val add_decl_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
119 val add_field_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
121 val add_symbol_meta
: (string -> unit) ref
123 val add_field_list_meta
:
124 (Ast_cocci.meta_name
-> Ast_cocci.list_len
-> Ast0_cocci.pure
-> unit) ref
126 val add_stm_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
128 val add_stmlist_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
131 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
133 val add_local_func_meta
:
134 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
136 val add_declarer_meta
:
137 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
139 val add_iterator_meta
:
140 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
143 (Ast_cocci.meta_name
-> pconstraints
-> Ast_cocci.meta_collect
-> unit) ref
145 val add_type_name
: (string -> unit) ref
147 val add_declarer_name
: (string -> unit) ref
149 val add_iterator_name
: (string -> unit) ref
151 val init_rule
: (unit -> unit) ref
153 val install_bindings
: (string -> unit) ref