Release coccinelle-0.1.6
[bpt/coccinelle.git] / parsing_cocci / .#data.ml.1.38
CommitLineData
0708f913
C
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
23module Ast0 = Ast0_cocci
24module 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 *)
29type fresh = bool
30
31type 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
40and line_type =
41 MINUS | OPTMINUS | UNIQUEMINUS
42 | PLUS
43 | CONTEXT | UNIQUE | OPT
44
45type iconstraints = Ast0.ident list
46type econstraints = Ast0.expression list
47type pconstraints = Ast.meta_name list
48
49let in_rule_name = ref false
50let in_meta = ref false
51let in_iso = ref false
52let in_generating = ref false
53let in_prolog = ref false
54let inheritable_positions =
55 ref ([] : string list) (* rules from which posns can be inherited *)
56
57let all_metadecls =
58 (Hashtbl.create(100) : (string, Ast.metavar list) Hashtbl.t)
59
60let clear_meta: (unit -> unit) ref =
61 ref (fun _ -> failwith "uninitialized add_meta")
62
63let add_id_meta:
64 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
65 ref (fun _ -> failwith "uninitialized add_meta")
66
67let add_type_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
68 ref (fun _ -> failwith "uninitialized add_meta")
69
70let add_init_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
71 ref (fun _ -> failwith "uninitialized add_meta")
72
73let add_param_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
74 ref (fun _ -> failwith "uninitialized add_meta")
75
76let add_paramlist_meta:
77 (Ast.meta_name -> Ast.meta_name option -> Ast0.pure -> unit) ref =
78 ref (fun _ -> failwith "uninitialized add_meta")
79
80let add_const_meta:
81 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
82 Ast0.pure -> unit)
83 ref =
84 ref (fun _ -> failwith "uninitialized add_meta")
85
86let add_err_meta:
87 (Ast.meta_name -> econstraints -> Ast0.pure -> unit) ref =
88 ref (fun _ -> failwith "uninitialized add_meta")
89
90let add_exp_meta:
91 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
92 Ast0.pure -> unit)
93 ref =
94 ref (fun _ -> failwith "uninitialized add_meta")
95
96let add_idexp_meta:
97 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
98 Ast0.pure -> unit)
99 ref =
100 ref (fun _ -> failwith "uninitialized add_meta")
101
102let add_local_idexp_meta:
103 (Type_cocci.typeC list option -> Ast.meta_name -> econstraints ->
104 Ast0.pure -> unit)
105 ref =
106 ref (fun _ -> failwith "uninitialized add_meta")
107
108let add_explist_meta:
109 (Ast.meta_name -> Ast.meta_name option -> Ast0.pure -> unit) ref =
110 ref (fun _ -> failwith "uninitialized add_meta")
111
112let add_stm_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
113 ref (fun _ -> failwith "uninitialized add_meta")
114
115let add_stmlist_meta: (Ast.meta_name -> Ast0.pure -> unit) ref =
116 ref (fun _ -> failwith "uninitialized add_meta")
117
118let add_func_meta:
119 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
120 ref (fun _ -> failwith "uninitialized add_meta")
121
122let add_local_func_meta:
123 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
124 ref (fun _ -> failwith "uninitialized add_meta")
125
126let add_declarer_meta:
127 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
128 ref (fun _ -> failwith "uninitialized add_decl")
129
130let add_iterator_meta:
131 (Ast.meta_name -> iconstraints -> Ast0.pure -> unit) ref =
132 ref (fun _ -> failwith "uninitialized add_iter")
133
134let add_pos_meta:
135 (Ast.meta_name -> pconstraints -> Ast.meta_collect -> unit) ref =
136 ref (fun _ -> failwith "uninitialized add_meta")
137
138let add_type_name: (string -> unit) ref =
139 ref (fun _ -> failwith "uninitialized add_type")
140
141let add_declarer_name: (string -> unit) ref =
142 ref (fun _ -> failwith "uninitialized add_decl")
143
144let add_iterator_name: (string -> unit) ref =
145 ref (fun _ -> failwith "uninitialized add_iter")
146
147let init_rule: (unit -> unit) ref =
148 ref (fun _ -> failwith "uninitialized install_bindings")
149
150let install_bindings: (string -> unit) ref =
151 ref (fun _ -> failwith "uninitialized install_bindings")