2 * Copyright 2005-2009, 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.
23 (* types that clutter the .mly file *)
24 (* for iso metavariables, true if they can only match nonmodified, unitary
29 Include
of string | Iso
of (string,string) Common.either
30 | Virt
of string list
(* virtual rules *)
33 line_type
* int * int * int * int (* starting spaces *) *
34 (string * Ast0_cocci.position_info
) list
(* code before *) *
35 (string * Ast0_cocci.position_info
) list
(* code after *) *
36 Ast0_cocci.meta_pos
(* position variable, minus only *)
38 (* ---------------------------------------------------------------------- *)
41 MINUS
| OPTMINUS
| UNIQUEMINUS
43 | CONTEXT
| UNIQUE
| OPT
45 type iconstraints
= Ast_cocci.idconstraint
46 type econstraints
= Ast0_cocci.constraints
47 type pconstraints
= Ast_cocci.meta_name list
49 val in_rule_name
: bool ref (* true if parsing the rule name *)
50 val in_meta
: bool ref (* true if parsing the metavariable decls *)
51 val in_iso
: bool ref (* true if parsing the isomorphisms *)
52 val in_generating
: bool ref(* true if generating a rule *)
53 val ignore_patch_or_match
: bool ref (* skip rules not satisfying virt *)
54 val in_prolog
: bool ref (* true if parsing the beginning of an SP *)
55 val saw_struct
: bool ref (* true if saw struct/union *)
56 val inheritable_positions
: string list
ref
58 val call_in_meta
: (unit -> 'a
) -> 'a
60 val all_metadecls
: (string, Ast_cocci.metavar list
) Hashtbl.t
62 val clear_meta
: (unit -> unit) ref
65 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
67 val add_fresh_id_meta
: (Ast_cocci.meta_name
-> unit) ref
69 val add_type_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
71 val add_init_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
73 val add_param_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
75 val add_paramlist_meta
:
76 (Ast_cocci.meta_name
-> Ast_cocci.meta_name
option -> Ast0_cocci.pure
->
80 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
81 Ast0_cocci.pure
-> unit) ref
84 (Ast_cocci.meta_name
-> econstraints
-> Ast0_cocci.pure
-> unit) ref
87 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
-> econstraints
->
88 Ast0_cocci.pure
-> unit) ref
91 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
92 econstraints
-> Ast0_cocci.pure
-> unit) ref
94 val add_local_idexp_meta
:
95 (Type_cocci.typeC list
option -> Ast_cocci.meta_name
->
96 econstraints
-> Ast0_cocci.pure
-> unit) ref
99 (Ast_cocci.meta_name
-> Ast_cocci.meta_name
option -> Ast0_cocci.pure
->
102 val add_stm_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
104 val add_stmlist_meta
: (Ast_cocci.meta_name
-> Ast0_cocci.pure
-> unit) ref
107 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
109 val add_local_func_meta
:
110 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
112 val add_declarer_meta
:
113 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
115 val add_iterator_meta
:
116 (Ast_cocci.meta_name
-> iconstraints
-> Ast0_cocci.pure
-> unit) ref
119 (Ast_cocci.meta_name
-> pconstraints
-> Ast_cocci.meta_collect
-> unit) ref
121 val add_type_name
: (string -> unit) ref
123 val add_declarer_name
: (string -> unit) ref
125 val add_iterator_name
: (string -> unit) ref
127 val init_rule
: (unit -> unit) ref
129 val install_bindings
: (string -> unit) ref