Release coccinelle-0.1.6
[bpt/coccinelle.git] / parsing_cocci / .#data.ml.1.37
1 (*
2 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
3 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
4 * This file is part of Coccinelle.
5 *
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.
9 *
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.
14 *
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/>.
17 *
18 * The authors reserve the right to distribute this or future versions of
19 * Coccinelle under other licenses.
20 *)
21
22
23 module Ast0 = Ast0_cocci
24 module Ast = Ast_cocci
25
26 (* types that clutter the .mly file *)
27 (* for iso metavariables, true if they can only match nonmodified, unitary
28 metavariables *)
29 type fresh = bool
30
31 type clt =
32 line_type * int * int * int * int (* starting spaces *) *
33 string list (* code before *) * string list (* code after *) *
34 Ast0.meta_pos (* position variable, minus only *)
35
36 (* ---------------------------------------------------------------------- *)
37
38 (* Things that need to be seen by the lexer and parser. *)
39
40 and line_type =
41 MINUS | OPTMINUS | UNIQUEMINUS
42 | PLUS
43 | CONTEXT | UNIQUE | OPT
44
45 type iconstraints = Ast0.ident list
46 type econstraints = Ast0.expression list
47 type pconstraints = Ast.meta_name list
48
49 let in_rule_name = ref false
50 let in_meta = ref false
51 let in_iso = ref false
52 let in_generating = ref false
53 let in_prolog = ref false
54 let inheritable_positions =
55 ref ([] : string list) (* rules from which posns can be inherited *)
56
57 let all_metadecls =
58 (Hashtbl.create(100) : (string, Ast.metavar list) Hashtbl.t)
59
60 let clear_meta: (unit -> unit) ref =
61 ref (fun _ -> failwith "uninitialized add_meta")
62
63 let add_id_meta:
64 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
65 ref (fun _ -> failwith "uninitialized add_meta")
66
67 let add_type_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
68 ref (fun _ -> failwith "uninitialized add_meta")
69
70 let add_param_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
71 ref (fun _ -> failwith "uninitialized add_meta")
72
73 let add_paramlist_meta:
74 (Ast.meta_name -> Ast.meta_name option -> Ast0.pure -> unit) ref =
75 ref (fun _ -> failwith "uninitialized add_meta")
76
77 let add_const_meta:
78 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
79 Ast0.pure -> unit)
80 ref =
81 ref (fun _ -> failwith "uninitialized add_meta")
82
83 let add_err_meta:
84 (Ast.meta_name -> econstraints -> Ast0.pure -> unit) ref =
85 ref (fun _ -> failwith "uninitialized add_meta")
86
87 let add_exp_meta:
88 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
89 Ast0.pure -> unit)
90 ref =
91 ref (fun _ -> failwith "uninitialized add_meta")
92
93 let add_idexp_meta:
94 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
95 Ast0.pure -> unit)
96 ref =
97 ref (fun _ -> failwith "uninitialized add_meta")
98
99 let add_local_idexp_meta:
100 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
101 Ast0.pure -> unit)
102 ref =
103 ref (fun _ -> failwith "uninitialized add_meta")
104
105 let add_explist_meta:
106 (Ast.meta_name -> Ast.meta_name option -> Ast0.pure -> unit) ref =
107 ref (fun _ -> failwith "uninitialized add_meta")
108
109 let add_stm_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
110 ref (fun _ -> failwith "uninitialized add_meta")
111
112 let add_stmlist_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
113 ref (fun _ -> failwith "uninitialized add_meta")
114
115 let add_func_meta:
116 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
117 ref (fun _ -> failwith "uninitialized add_meta")
118
119 let add_local_func_meta:
120 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
121 ref (fun _ -> failwith "uninitialized add_meta")
122
123 let add_declarer_meta:
124 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
125 ref (fun _ -> failwith "uninitialized add_decl")
126
127 let add_iterator_meta:
128 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
129 ref (fun _ -> failwith "uninitialized add_iter")
130
131 let add_pos_meta:
132 (Ast.meta_name -> pconstraints -> Ast.meta_collect -> unit) ref =
133 ref (fun _ -> failwith "uninitialized add_meta")
134
135 let add_type_name: (string -> unit) ref =
136 ref (fun _ -> failwith "uninitialized add_type")
137
138 let add_declarer_name: (string -> unit) ref =
139 ref (fun _ -> failwith "uninitialized add_decl")
140
141 let add_iterator_name: (string -> unit) ref =
142 ref (fun _ -> failwith "uninitialized add_iter")
143
144 let init_rule: (unit -> unit) ref =
145 ref (fun _ -> failwith "uninitialized install_bindings")
146
147 let install_bindings: (string -> unit) ref =
148 ref (fun _ -> failwith "uninitialized install_bindings")