1 | |
---|
2 | /* A Bison parser, made from ./parser.y |
---|
3 | by GNU Bison version 1.28 */ |
---|
4 | |
---|
5 | #define YYBISON 1 /* Identify Bison output. */ |
---|
6 | |
---|
7 | #define TOK_ANY 257 |
---|
8 | #define TOK_ATTRIBUTE 258 |
---|
9 | #define TOK_BOOLEAN 259 |
---|
10 | #define TOK_CASE 260 |
---|
11 | #define TOK_CHAR 261 |
---|
12 | #define TOK_CONST 262 |
---|
13 | #define TOK_CONTEXT 263 |
---|
14 | #define TOK_DEFAULT 264 |
---|
15 | #define TOK_DOUBLE 265 |
---|
16 | #define TOK_ENUM 266 |
---|
17 | #define TOK_EXCEPTION 267 |
---|
18 | #define TOK_FALSE 268 |
---|
19 | #define TOK_FIXED 269 |
---|
20 | #define TOK_FLOAT 270 |
---|
21 | #define TOK_IN 271 |
---|
22 | #define TOK_INOUT 272 |
---|
23 | #define TOK_INTERFACE 273 |
---|
24 | #define TOK_LONG 274 |
---|
25 | #define TOK_MODULE 275 |
---|
26 | #define TOK_NATIVE 276 |
---|
27 | #define TOK_OBJECT 277 |
---|
28 | #define TOK_OCTET 278 |
---|
29 | #define TOK_ONEWAY 279 |
---|
30 | #define TOK_OP_SCOPE 280 |
---|
31 | #define TOK_OP_SHL 281 |
---|
32 | #define TOK_OP_SHR 282 |
---|
33 | #define TOK_OUT 283 |
---|
34 | #define TOK_RAISES 284 |
---|
35 | #define TOK_READONLY 285 |
---|
36 | #define TOK_SEQUENCE 286 |
---|
37 | #define TOK_SHORT 287 |
---|
38 | #define TOK_STRING 288 |
---|
39 | #define TOK_STRUCT 289 |
---|
40 | #define TOK_SWITCH 290 |
---|
41 | #define TOK_TRUE 291 |
---|
42 | #define TOK_TYPECODE 292 |
---|
43 | #define TOK_TYPEDEF 293 |
---|
44 | #define TOK_UNION 294 |
---|
45 | #define TOK_UNSIGNED 295 |
---|
46 | #define TOK_VARARGS 296 |
---|
47 | #define TOK_VOID 297 |
---|
48 | #define TOK_WCHAR 298 |
---|
49 | #define TOK_WSTRING 299 |
---|
50 | #define TOK_FLOATP 300 |
---|
51 | #define TOK_INTEGER 301 |
---|
52 | #define TOK_DECLSPEC 302 |
---|
53 | #define TOK_PROP_KEY 303 |
---|
54 | #define TOK_PROP_VALUE 304 |
---|
55 | #define TOK_NATIVE_TYPE 305 |
---|
56 | #define TOK_IDENT 306 |
---|
57 | #define TOK_SQSTRING 307 |
---|
58 | #define TOK_DQSTRING 308 |
---|
59 | #define TOK_FIXEDP 309 |
---|
60 | #define TOK_CODEFRAG 310 |
---|
61 | #define TOK_SRCFILE 311 |
---|
62 | |
---|
63 | #line 24 "./parser.y" |
---|
64 | |
---|
65 | #include <assert.h> |
---|
66 | #include <stdarg.h> |
---|
67 | #include <stdio.h> |
---|
68 | #include <stdlib.h> |
---|
69 | #include <ctype.h> |
---|
70 | #include <string.h> |
---|
71 | #include <errno.h> |
---|
72 | #include "rename.h" |
---|
73 | #include "util.h" |
---|
74 | |
---|
75 | #define REF_IDENTS |
---|
76 | |
---|
77 | #define do_binop(rv,op,a,b) do { \ |
---|
78 | if (IDL_binop_chktypes (op, a, b)) \ |
---|
79 | YYABORT; \ |
---|
80 | if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) { \ |
---|
81 | rv = IDL_binop_eval (op, a, b); \ |
---|
82 | IDL_tree_free (a); \ |
---|
83 | IDL_tree_free (b); \ |
---|
84 | if (!rv) YYABORT; \ |
---|
85 | } else { \ |
---|
86 | rv = IDL_binop_new (op, a, b); \ |
---|
87 | } \ |
---|
88 | } while (0) |
---|
89 | |
---|
90 | #define do_unaryop(rv,op,a) do { \ |
---|
91 | if (IDL_unaryop_chktypes (op, a)) \ |
---|
92 | YYABORT; \ |
---|
93 | if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) { \ |
---|
94 | rv = IDL_unaryop_eval (op, a); \ |
---|
95 | IDL_tree_free (a); \ |
---|
96 | if (!rv) YYABORT; \ |
---|
97 | } else { \ |
---|
98 | rv = IDL_unaryop_new (op, a); \ |
---|
99 | } \ |
---|
100 | } while (0) |
---|
101 | |
---|
102 | #define IS_INHIBIT_STATE() \ |
---|
103 | (__IDL_inhibits > 0 || \ |
---|
104 | ((__IDL_flags & IDLF_INHIBIT_INCLUDES) && \ |
---|
105 | (__IDL_flagsi & IDLFP_IN_INCLUDES) ) ) |
---|
106 | |
---|
107 | |
---|
108 | #define assign_declspec(tree,declspec) do { \ |
---|
109 | IDL_NODE_DECLSPEC (tree) = declspec; \ |
---|
110 | if ( IS_INHIBIT_STATE() ) { \ |
---|
111 | IDL_NODE_DECLSPEC (tree) |= \ |
---|
112 | IDLF_DECLSPEC_EXIST | \ |
---|
113 | IDLF_DECLSPEC_INHIBIT; \ |
---|
114 | } \ |
---|
115 | if ( __IDL_pidl > 0 ) { \ |
---|
116 | IDL_NODE_DECLSPEC (tree) |= \ |
---|
117 | IDLF_DECLSPEC_PIDL; \ |
---|
118 | } \ |
---|
119 | } while (0) |
---|
120 | |
---|
121 | #define assign_props(tree,props) do { \ |
---|
122 | if (__IDL_flags & IDLF_PROPERTIES) \ |
---|
123 | IDL_NODE_PROPERTIES (tree) = (props); \ |
---|
124 | else \ |
---|
125 | __IDL_free_properties (props); \ |
---|
126 | } while (0) |
---|
127 | |
---|
128 | extern int yylex (void); |
---|
129 | static IDL_declspec_t IDL_parse_declspec (const char *strspec); |
---|
130 | static int IDL_binop_chktypes (enum IDL_binop op, |
---|
131 | IDL_tree a, |
---|
132 | IDL_tree b); |
---|
133 | static int IDL_unaryop_chktypes (enum IDL_unaryop op, |
---|
134 | IDL_tree a); |
---|
135 | static IDL_tree IDL_binop_eval (enum IDL_binop op, |
---|
136 | IDL_tree a, |
---|
137 | IDL_tree b); |
---|
138 | static IDL_tree IDL_unaryop_eval (enum IDL_unaryop op, |
---|
139 | IDL_tree a); |
---|
140 | static IDL_tree list_start (IDL_tree a, |
---|
141 | gboolean filter_null); |
---|
142 | static IDL_tree list_chain (IDL_tree a, |
---|
143 | IDL_tree b, |
---|
144 | gboolean filter_null); |
---|
145 | static IDL_tree zlist_chain (IDL_tree a, |
---|
146 | IDL_tree b, |
---|
147 | gboolean filter_null); |
---|
148 | static int do_token_error (IDL_tree p, |
---|
149 | const char *message, |
---|
150 | gboolean prev); |
---|
151 | static void illegal_context_type_error (IDL_tree p, |
---|
152 | const char *what); |
---|
153 | static void illegal_type_error (IDL_tree p, |
---|
154 | const char *message); |
---|
155 | |
---|
156 | #line 117 "./parser.y" |
---|
157 | typedef union { |
---|
158 | IDL_tree tree; |
---|
159 | struct { |
---|
160 | IDL_tree tree; |
---|
161 | gpointer data; |
---|
162 | } treedata; |
---|
163 | GHashTable *hash_table; |
---|
164 | char *str; |
---|
165 | gboolean boolean; |
---|
166 | IDL_declspec_t declspec; |
---|
167 | IDL_longlong_t integer; |
---|
168 | double floatp; |
---|
169 | enum IDL_unaryop unaryop; |
---|
170 | enum IDL_param_attr paramattr; |
---|
171 | } YYSTYPE; |
---|
172 | #include <stdio.h> |
---|
173 | |
---|
174 | #ifndef __cplusplus |
---|
175 | #ifndef __STDC__ |
---|
176 | #define const |
---|
177 | #endif |
---|
178 | #endif |
---|
179 | |
---|
180 | |
---|
181 | |
---|
182 | #define YYFINAL 396 |
---|
183 | #define YYFLAG -32768 |
---|
184 | #define YYNTBASE 79 |
---|
185 | |
---|
186 | #define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 226) |
---|
187 | |
---|
188 | static const char yytranslate[] = { 0, |
---|
189 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
190 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
191 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
192 | 2, 2, 2, 2, 2, 2, 73, 68, 2, 63, |
---|
193 | 64, 71, 69, 59, 70, 2, 72, 2, 2, 2, |
---|
194 | 2, 2, 2, 2, 2, 2, 2, 62, 58, 75, |
---|
195 | 65, 76, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
196 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
197 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
198 | 77, 2, 78, 67, 2, 2, 2, 2, 2, 2, |
---|
199 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
200 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
201 | 2, 2, 60, 66, 61, 74, 2, 2, 2, 2, |
---|
202 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
203 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
204 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
205 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
206 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
207 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
208 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
209 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
210 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
211 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
212 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
213 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
214 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, |
---|
215 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
---|
216 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
---|
217 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, |
---|
218 | 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, |
---|
219 | 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
---|
220 | 57 |
---|
221 | }; |
---|
222 | |
---|
223 | #if YYDEBUG != 0 |
---|
224 | static const short yyprhs[] = { 0, |
---|
225 | 0, 1, 3, 4, 6, 8, 11, 13, 14, 16, |
---|
226 | 18, 19, 21, 24, 27, 30, 33, 36, 38, 40, |
---|
227 | 42, 44, 47, 48, 56, 58, 60, 62, 63, 64, |
---|
228 | 77, 83, 84, 87, 89, 93, 95, 96, 99, 102, |
---|
229 | 105, 108, 111, 114, 116, 118, 121, 125, 127, 129, |
---|
230 | 131, 135, 136, 143, 146, 148, 150, 152, 154, 156, |
---|
231 | 158, 160, 162, 163, 165, 166, 168, 169, 170, 180, |
---|
232 | 181, 182, 196, 198, 200, 202, 204, 206, 208, 210, |
---|
233 | 213, 217, 220, 222, 225, 229, 232, 235, 241, 244, |
---|
234 | 251, 252, 255, 256, 258, 261, 262, 269, 271, 273, |
---|
235 | 275, 277, 279, 281, 283, 285, 287, 289, 290, 292, |
---|
236 | 295, 304, 305, 308, 310, 311, 313, 314, 317, 322, |
---|
237 | 326, 328, 332, 333, 339, 341, 343, 345, 347, 348, |
---|
238 | 350, 351, 353, 358, 363, 365, 367, 369, 371, 373, |
---|
239 | 375, 377, 379, 381, 383, 385, 389, 391, 395, 397, |
---|
240 | 401, 403, 407, 411, 413, 417, 421, 423, 427, 431, |
---|
241 | 435, 438, 440, 442, 444, 446, 448, 450, 454, 456, |
---|
242 | 458, 460, 462, 464, 466, 467, 475, 477, 479, 482, |
---|
243 | 486, 488, 492, 494, 497, 501, 503, 505, 507, 509, |
---|
244 | 511, 513, 515, 517, 519, 521, 523, 525, 527, 534, |
---|
245 | 539, 541, 543, 546, 553, 555, 557, 559, 561, 563, |
---|
246 | 565, 567, 569, 572, 574, 576, 578, 581, 584, 588, |
---|
247 | 590, 592, 594, 596, 598, 600, 602, 607, 609, 614, |
---|
248 | 616, 618, 622, 624, 626, 628, 630, 632, 636, 639, |
---|
249 | 641, 644, 648, 651, 654, 659, 661, 665, 667, 669, |
---|
250 | 671, 673, 674, 676, 678, 680, 682, 684, 688, 690, |
---|
251 | 691, 693, 694, 695, 700, 702, 704, 706, 708, 710, |
---|
252 | 712, 714, 717, 719, 721, 724, 726 |
---|
253 | }; |
---|
254 | |
---|
255 | static const short yyrhs[] = { -1, |
---|
256 | 81, 0, 0, 81, 0, 86, 0, 81, 86, 0, |
---|
257 | 58, 0, 0, 58, 0, 59, 0, 0, 163, 0, |
---|
258 | 99, 82, 0, 121, 82, 0, 123, 82, 0, 91, |
---|
259 | 82, 0, 88, 82, 0, 221, 0, 222, 0, 85, |
---|
260 | 0, 83, 0, 212, 21, 0, 0, 87, 204, 89, |
---|
261 | 60, 80, 61, 205, 0, 204, 0, 23, 0, 38, |
---|
262 | 0, 0, 0, 212, 213, 19, 90, 92, 205, 94, |
---|
263 | 93, 60, 96, 61, 205, 0, 212, 213, 19, 90, |
---|
264 | 205, 0, 0, 62, 95, 0, 163, 0, 95, 84, |
---|
265 | 163, 0, 97, 0, 0, 97, 98, 0, 99, 82, |
---|
266 | 0, 123, 82, 0, 134, 82, 0, 127, 82, 0, |
---|
267 | 121, 82, 0, 221, 0, 83, 0, 212, 100, 0, |
---|
268 | 213, 39, 102, 0, 108, 0, 111, 0, 161, 0, |
---|
269 | 213, 22, 194, 0, 0, 213, 22, 194, 63, 101, |
---|
270 | 51, 0, 103, 192, 0, 104, 0, 105, 0, 168, |
---|
271 | 0, 169, 0, 163, 0, 108, 0, 111, 0, 161, |
---|
272 | 0, 0, 202, 0, 0, 203, 0, 0, 0, 213, |
---|
273 | 35, 109, 107, 60, 110, 166, 61, 205, 0, 0, |
---|
274 | 0, 213, 40, 112, 107, 36, 63, 114, 64, 60, |
---|
275 | 113, 115, 61, 205, 0, 174, 0, 183, 0, 185, |
---|
276 | 0, 161, 0, 163, 0, 116, 0, 117, 0, 116, |
---|
277 | 117, 0, 119, 118, 82, 0, 103, 193, 0, 120, |
---|
278 | 0, 119, 120, 0, 6, 150, 62, 0, 10, 62, |
---|
279 | 0, 212, 122, 0, 8, 149, 202, 65, 150, 0, |
---|
280 | 212, 124, 0, 13, 203, 60, 125, 61, 205, 0, |
---|
281 | 0, 125, 167, 0, 0, 31, 0, 212, 128, 0, |
---|
282 | 0, 213, 126, 4, 129, 130, 196, 0, 132, 0, |
---|
283 | 43, 0, 170, 0, 105, 0, 168, 0, 190, 0, |
---|
284 | 191, 0, 172, 0, 163, 0, 131, 0, 0, 25, |
---|
285 | 0, 212, 135, 0, 213, 133, 136, 203, 140, 205, |
---|
286 | 145, 146, 0, 0, 137, 132, 0, 43, 0, 0, |
---|
287 | 42, 0, 0, 59, 42, 0, 63, 141, 139, 64, |
---|
288 | 0, 63, 138, 64, 0, 142, 0, 141, 84, 142, |
---|
289 | 0, 0, 213, 144, 143, 130, 194, 0, 17, 0, |
---|
290 | 29, 0, 18, 0, 130, 0, 0, 147, 0, 0, |
---|
291 | 148, 0, 30, 63, 95, 64, 0, 9, 63, 210, |
---|
292 | 64, 0, 174, 0, 183, 0, 184, 0, 185, 0, |
---|
293 | 171, 0, 190, 0, 191, 0, 173, 0, 163, 0, |
---|
294 | 151, 0, 152, 0, 151, 66, 152, 0, 153, 0, |
---|
295 | 152, 67, 153, 0, 154, 0, 153, 68, 154, 0, |
---|
296 | 155, 0, 154, 28, 155, 0, 154, 27, 155, 0, |
---|
297 | 156, 0, 155, 69, 156, 0, 155, 70, 156, 0, |
---|
298 | 157, 0, 156, 71, 157, 0, 156, 72, 157, 0, |
---|
299 | 156, 73, 157, 0, 158, 159, 0, 159, 0, 70, |
---|
300 | 0, 69, 0, 74, 0, 163, 0, 160, 0, 63, |
---|
301 | 150, 64, 0, 215, 0, 216, 0, 217, 0, 218, |
---|
302 | 0, 219, 0, 220, 0, 0, 213, 12, 162, 106, |
---|
303 | 60, 165, 61, 0, 164, 0, 207, 0, 26, 209, |
---|
304 | 0, 164, 26, 201, 0, 202, 0, 165, 84, 202, |
---|
305 | 0, 167, 0, 166, 167, 0, 103, 192, 82, 0, |
---|
306 | 171, 0, 174, 0, 183, 0, 184, 0, 185, 0, |
---|
307 | 186, 0, 187, 0, 188, 0, 189, 0, 170, 0, |
---|
308 | 190, 0, 191, 0, 172, 0, 32, 75, 104, 59, |
---|
309 | 211, 76, 0, 32, 75, 104, 76, 0, 16, 0, |
---|
310 | 11, 0, 20, 11, 0, 15, 75, 211, 59, 215, |
---|
311 | 76, 0, 15, 0, 175, 0, 179, 0, 176, 0, |
---|
312 | 177, 0, 178, 0, 33, 0, 20, 0, 20, 20, |
---|
313 | 0, 180, 0, 181, 0, 182, 0, 41, 33, 0, |
---|
314 | 41, 20, 0, 41, 20, 20, 0, 7, 0, 44, |
---|
315 | 0, 5, 0, 24, 0, 3, 0, 23, 0, 38, |
---|
316 | 0, 34, 75, 211, 76, 0, 34, 0, 45, 75, |
---|
317 | 211, 76, 0, 45, 0, 193, 0, 192, 84, 193, |
---|
318 | 0, 194, 0, 195, 0, 202, 0, 197, 0, 194, |
---|
319 | 0, 196, 84, 194, 0, 202, 198, 0, 199, 0, |
---|
320 | 198, 199, 0, 77, 211, 78, 0, 77, 78, 0, |
---|
321 | 49, 50, 0, 200, 59, 49, 50, 0, 49, 0, |
---|
322 | 200, 59, 49, 0, 52, 0, 206, 0, 206, 0, |
---|
323 | 208, 0, 0, 201, 0, 201, 0, 201, 0, 201, |
---|
324 | 0, 216, 0, 210, 84, 216, 0, 150, 0, 0, |
---|
325 | 48, 0, 0, 0, 77, 214, 200, 78, 0, 47, |
---|
326 | 0, 223, 0, 225, 0, 55, 0, 46, 0, 37, |
---|
327 | 0, 14, 0, 212, 56, 0, 57, 0, 224, 0, |
---|
328 | 223, 224, 0, 54, 0, 53, 0 |
---|
329 | }; |
---|
330 | |
---|
331 | #endif |
---|
332 | |
---|
333 | #if YYDEBUG != 0 |
---|
334 | static const short yyrline[] = { 0, |
---|
335 | 309, 310, 313, 314, 317, 318, 321, 322, 328, 334, |
---|
336 | 335, 341, 350, 351, 352, 353, 354, 355, 356, 357, |
---|
337 | 358, 361, 364, 373, 402, 403, 407, 413, 439, 445, |
---|
338 | 451, 464, 465, 511, 512, 516, 519, 520, 523, 524, |
---|
339 | 525, 526, 527, 528, 529, 532, 538, 551, 552, 553, |
---|
340 | 554, 559, 568, 575, 578, 579, 582, 583, 584, 587, |
---|
341 | 588, 589, 592, 596, 599, 603, 606, 608, 612, 621, |
---|
342 | 623, 629, 638, 639, 640, 641, 642, 645, 648, 649, |
---|
343 | 652, 656, 670, 671, 674, 675, 678, 684, 691, 697, |
---|
344 | 702, 703, 706, 707, 710, 716, 721, 735, 736, 742, |
---|
345 | 744, 747, 748, 749, 750, 751, 752, 758, 759, 762, |
---|
346 | 768, 780, 781, 782, 785, 786, 789, 790, 793, 800, |
---|
347 | 806, 807, 811, 815, 821, 822, 823, 824, 830, 831, |
---|
348 | 834, 835, 838, 843, 848, 849, 850, 851, 852, 853, |
---|
349 | 854, 855, 856, 859, 862, 863, 866, 867, 870, 871, |
---|
350 | 874, 875, 876, 879, 880, 881, 884, 885, 886, 887, |
---|
351 | 890, 891, 894, 895, 896, 899, 913, 914, 917, 918, |
---|
352 | 919, 920, 921, 922, 925, 927, 935, 943, 944, 945, |
---|
353 | 971, 972, 976, 977, 980, 995, 996, 997, 998, 999, |
---|
354 | 1000, 1001, 1002, 1003, 1006, 1007, 1008, 1009, 1012, 1015, |
---|
355 | 1020, 1021, 1022, 1025, 1030, 1033, 1034, 1037, 1038, 1039, |
---|
356 | 1042, 1045, 1048, 1051, 1052, 1053, 1056, 1059, 1062, 1065, |
---|
357 | 1068, 1071, 1074, 1077, 1080, 1083, 1086, 1089, 1092, 1095, |
---|
358 | 1098, 1099, 1103, 1104, 1107, 1110, 1113, 1114, 1118, 1133, |
---|
359 | 1134, 1138, 1139, 1142, 1147, 1153, 1157, 1164, 1167, 1175, |
---|
360 | 1188, 1205, 1217, 1255, 1273, 1304, 1323, 1324, 1328, 1367, |
---|
361 | 1368, 1374, 1375, 1384, 1387, 1390, 1393, 1396, 1399, 1402, |
---|
362 | 1403, 1406, 1412, 1417, 1418, 1426, 1433 |
---|
363 | }; |
---|
364 | #endif |
---|
365 | |
---|
366 | |
---|
367 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
---|
368 | |
---|
369 | static const char * const yytname[] = { "$","error","$undefined.","TOK_ANY", |
---|
370 | "TOK_ATTRIBUTE","TOK_BOOLEAN","TOK_CASE","TOK_CHAR","TOK_CONST","TOK_CONTEXT", |
---|
371 | "TOK_DEFAULT","TOK_DOUBLE","TOK_ENUM","TOK_EXCEPTION","TOK_FALSE","TOK_FIXED", |
---|
372 | "TOK_FLOAT","TOK_IN","TOK_INOUT","TOK_INTERFACE","TOK_LONG","TOK_MODULE","TOK_NATIVE", |
---|
373 | "TOK_OBJECT","TOK_OCTET","TOK_ONEWAY","TOK_OP_SCOPE","TOK_OP_SHL","TOK_OP_SHR", |
---|
374 | "TOK_OUT","TOK_RAISES","TOK_READONLY","TOK_SEQUENCE","TOK_SHORT","TOK_STRING", |
---|
375 | "TOK_STRUCT","TOK_SWITCH","TOK_TRUE","TOK_TYPECODE","TOK_TYPEDEF","TOK_UNION", |
---|
376 | "TOK_UNSIGNED","TOK_VARARGS","TOK_VOID","TOK_WCHAR","TOK_WSTRING","TOK_FLOATP", |
---|
377 | "TOK_INTEGER","TOK_DECLSPEC","TOK_PROP_KEY","TOK_PROP_VALUE","TOK_NATIVE_TYPE", |
---|
378 | "TOK_IDENT","TOK_SQSTRING","TOK_DQSTRING","TOK_FIXEDP","TOK_CODEFRAG","TOK_SRCFILE", |
---|
379 | "';'","','","'{'","'}'","':'","'('","')'","'='","'|'","'^'","'&'","'+'","'-'", |
---|
380 | "'*'","'/'","'%'","'~'","'<'","'>'","'['","']'","specification","z_definition_list", |
---|
381 | "definition_list","check_semicolon","useless_semicolon","check_comma","illegal_ident", |
---|
382 | "definition","module_declspec","module","@1","interface_catch_ident","interface", |
---|
383 | "@2","@3","z_inheritance","scoped_name_list","interface_body","export_list", |
---|
384 | "export","type_dcl","type_dcl_def","@4","type_declarator","type_spec","simple_type_spec", |
---|
385 | "constr_type_spec","z_new_ident_catch","z_new_scope_catch","struct_type","@5", |
---|
386 | "@6","union_type","@7","@8","switch_type_spec","switch_body","case_stmt_list", |
---|
387 | "case_stmt","element_spec","case_label_list","case_label","const_dcl","const_dcl_def", |
---|
388 | "except_dcl","except_dcl_def","member_zlist","is_readonly","attr_dcl","attr_dcl_def", |
---|
389 | "@9","param_type_spec","op_param_type_spec_illegal","op_param_type_spec","is_oneway", |
---|
390 | "op_dcl","op_dcl_def","op_type_spec","@10","is_varargs","is_cvarargs","parameter_dcls", |
---|
391 | "param_dcl_list","param_dcl","@11","param_attribute","is_raises_expr","is_context_expr", |
---|
392 | "raises_expr","context_expr","const_type","const_exp","or_expr","xor_expr","and_expr", |
---|
393 | "shift_expr","add_expr","mult_expr","unary_expr","unary_op","primary_expr","literal", |
---|
394 | "enum_type","@12","scoped_name","ns_scoped_name","enumerator_list","member_list", |
---|
395 | "member","base_type_spec","template_type_spec","sequence_type","floating_pt_type", |
---|
396 | "fixed_pt_type","fixed_pt_const_type","integer_type","signed_int","signed_short_int", |
---|
397 | "signed_long_int","signed_longlong_int","unsigned_int","unsigned_short_int", |
---|
398 | "unsigned_long_int","unsigned_longlong_int","char_type","wide_char_type","boolean_type", |
---|
399 | "octet_type","any_type","object_type","typecode_type","string_type","wide_string_type", |
---|
400 | "declarator_list","declarator","simple_declarator","complex_declarator","simple_declarator_list", |
---|
401 | "array_declarator","fixed_array_size_list","fixed_array_size","prop_hash","ident", |
---|
402 | "new_ident","new_scope","new_or_prev_scope","pop_scope","ns_new_ident","ns_prev_ident", |
---|
403 | "cur_ns_new_or_prev_ident","ns_global_ident","string_lit_list","positive_int_const", |
---|
404 | "z_declspec","z_props","@13","integer_lit","string_lit","char_lit","fixed_pt_lit", |
---|
405 | "floating_pt_lit","boolean_lit","codefrag","srcfile","dqstring_cat","dqstring", |
---|
406 | "sqstring", NULL |
---|
407 | }; |
---|
408 | #endif |
---|
409 | |
---|
410 | static const short yyr1[] = { 0, |
---|
411 | 79, 79, 80, 80, 81, 81, 82, 82, 83, 84, |
---|
412 | 84, 85, 86, 86, 86, 86, 86, 86, 86, 86, |
---|
413 | 86, 87, 89, 88, 90, 90, 90, 92, 93, 91, |
---|
414 | 91, 94, 94, 95, 95, 96, 97, 97, 98, 98, |
---|
415 | 98, 98, 98, 98, 98, 99, 100, 100, 100, 100, |
---|
416 | 100, 101, 100, 102, 103, 103, 104, 104, 104, 105, |
---|
417 | 105, 105, 106, 106, 107, 107, 109, 110, 108, 112, |
---|
418 | 113, 111, 114, 114, 114, 114, 114, 115, 116, 116, |
---|
419 | 117, 118, 119, 119, 120, 120, 121, 122, 123, 124, |
---|
420 | 125, 125, 126, 126, 127, 129, 128, 130, 130, 131, |
---|
421 | 131, 132, 132, 132, 132, 132, 132, 133, 133, 134, |
---|
422 | 135, 137, 136, 136, 138, 138, 139, 139, 140, 140, |
---|
423 | 141, 141, 143, 142, 144, 144, 144, 144, 145, 145, |
---|
424 | 146, 146, 147, 148, 149, 149, 149, 149, 149, 149, |
---|
425 | 149, 149, 149, 150, 151, 151, 152, 152, 153, 153, |
---|
426 | 154, 154, 154, 155, 155, 155, 156, 156, 156, 156, |
---|
427 | 157, 157, 158, 158, 158, 159, 159, 159, 160, 160, |
---|
428 | 160, 160, 160, 160, 162, 161, 163, 164, 164, 164, |
---|
429 | 165, 165, 166, 166, 167, 168, 168, 168, 168, 168, |
---|
430 | 168, 168, 168, 168, 169, 169, 169, 169, 170, 170, |
---|
431 | 171, 171, 171, 172, 173, 174, 174, 175, 175, 175, |
---|
432 | 176, 177, 178, 179, 179, 179, 180, 181, 182, 183, |
---|
433 | 184, 185, 186, 187, 188, 189, 190, 190, 191, 191, |
---|
434 | 192, 192, 193, 193, 194, 195, 196, 196, 197, 198, |
---|
435 | 198, 199, 199, 200, 200, 200, 200, 201, 202, 203, |
---|
436 | 204, 205, 206, 207, 208, 209, 210, 210, 211, 212, |
---|
437 | 212, 213, 214, 213, 215, 216, 217, 218, 219, 220, |
---|
438 | 220, 221, 222, 223, 223, 224, 225 |
---|
439 | }; |
---|
440 | |
---|
441 | static const short yyr2[] = { 0, |
---|
442 | 0, 1, 0, 1, 1, 2, 1, 0, 1, 1, |
---|
443 | 0, 1, 2, 2, 2, 2, 2, 1, 1, 1, |
---|
444 | 1, 2, 0, 7, 1, 1, 1, 0, 0, 12, |
---|
445 | 5, 0, 2, 1, 3, 1, 0, 2, 2, 2, |
---|
446 | 2, 2, 2, 1, 1, 2, 3, 1, 1, 1, |
---|
447 | 3, 0, 6, 2, 1, 1, 1, 1, 1, 1, |
---|
448 | 1, 1, 0, 1, 0, 1, 0, 0, 9, 0, |
---|
449 | 0, 13, 1, 1, 1, 1, 1, 1, 1, 2, |
---|
450 | 3, 2, 1, 2, 3, 2, 2, 5, 2, 6, |
---|
451 | 0, 2, 0, 1, 2, 0, 6, 1, 1, 1, |
---|
452 | 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, |
---|
453 | 8, 0, 2, 1, 0, 1, 0, 2, 4, 3, |
---|
454 | 1, 3, 0, 5, 1, 1, 1, 1, 0, 1, |
---|
455 | 0, 1, 4, 4, 1, 1, 1, 1, 1, 1, |
---|
456 | 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, |
---|
457 | 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, |
---|
458 | 2, 1, 1, 1, 1, 1, 1, 3, 1, 1, |
---|
459 | 1, 1, 1, 1, 0, 7, 1, 1, 2, 3, |
---|
460 | 1, 3, 1, 2, 3, 1, 1, 1, 1, 1, |
---|
461 | 1, 1, 1, 1, 1, 1, 1, 1, 6, 4, |
---|
462 | 1, 1, 2, 6, 1, 1, 1, 1, 1, 1, |
---|
463 | 1, 1, 2, 1, 1, 1, 2, 2, 3, 1, |
---|
464 | 1, 1, 1, 1, 1, 1, 4, 1, 4, 1, |
---|
465 | 1, 3, 1, 1, 1, 1, 1, 3, 2, 1, |
---|
466 | 2, 3, 2, 2, 4, 1, 3, 1, 1, 1, |
---|
467 | 1, 0, 1, 1, 1, 1, 1, 3, 1, 0, |
---|
468 | 1, 0, 0, 4, 1, 1, 1, 1, 1, 1, |
---|
469 | 1, 2, 1, 1, 2, 1, 1 |
---|
470 | }; |
---|
471 | |
---|
472 | static const short yydefact[] = { 260, |
---|
473 | 0, 261, 248, 273, 9, 260, 21, 20, 5, 0, |
---|
474 | 8, 8, 8, 8, 8, 12, 177, 254, 178, 262, |
---|
475 | 18, 19, 256, 179, 6, 255, 23, 251, 7, 17, |
---|
476 | 16, 13, 14, 15, 0, 0, 0, 22, 272, 263, |
---|
477 | 46, 48, 49, 87, 89, 50, 0, 0, 180, 222, |
---|
478 | 220, 202, 205, 201, 212, 211, 228, 0, 221, 230, |
---|
479 | 0, 143, 139, 142, 135, 206, 208, 209, 210, 207, |
---|
480 | 214, 215, 216, 136, 137, 138, 140, 141, 253, 0, |
---|
481 | 250, 0, 175, 0, 0, 67, 262, 70, 260, 203, |
---|
482 | 213, 0, 218, 217, 0, 0, 249, 91, 246, 0, |
---|
483 | 63, 26, 27, 252, 25, 51, 235, 65, 224, 0, |
---|
484 | 225, 223, 0, 226, 47, 0, 55, 56, 60, 61, |
---|
485 | 62, 59, 57, 58, 195, 186, 198, 187, 188, 189, |
---|
486 | 190, 191, 192, 193, 194, 196, 197, 0, 65, 0, |
---|
487 | 260, 271, 270, 269, 265, 277, 276, 268, 0, 164, |
---|
488 | 163, 165, 259, 144, 145, 147, 149, 151, 154, 157, |
---|
489 | 0, 162, 167, 166, 0, 169, 170, 171, 172, 173, |
---|
490 | 174, 266, 274, 267, 219, 0, 0, 262, 244, 0, |
---|
491 | 264, 0, 64, 252, 31, 52, 0, 66, 0, 0, |
---|
492 | 54, 231, 233, 234, 236, 235, 0, 252, 0, 0, |
---|
493 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, |
---|
494 | 227, 275, 229, 88, 252, 0, 92, 247, 0, 32, |
---|
495 | 0, 68, 0, 0, 10, 0, 0, 239, 240, 0, |
---|
496 | 24, 168, 146, 148, 150, 153, 152, 155, 156, 158, |
---|
497 | 159, 160, 90, 8, 245, 11, 181, 0, 29, 53, |
---|
498 | 262, 0, 0, 200, 232, 243, 0, 241, 262, 185, |
---|
499 | 176, 0, 11, 34, 0, 262, 183, 0, 0, 242, |
---|
500 | 212, 0, 76, 77, 73, 74, 75, 0, 182, 0, |
---|
501 | 37, 252, 184, 204, 199, 0, 35, 0, 260, 69, |
---|
502 | 71, 252, 45, 38, 8, 8, 8, 8, 8, 262, |
---|
503 | 44, 0, 30, 39, 43, 40, 42, 41, 95, 110, |
---|
504 | 108, 0, 0, 0, 78, 79, 262, 83, 109, 94, |
---|
505 | 0, 112, 0, 86, 252, 80, 0, 8, 84, 96, |
---|
506 | 114, 0, 262, 85, 72, 82, 81, 262, 0, 101, |
---|
507 | 107, 113, 106, 102, 100, 105, 103, 104, 99, 0, |
---|
508 | 98, 262, 252, 237, 97, 116, 0, 11, 121, 262, |
---|
509 | 129, 0, 120, 10, 262, 0, 125, 127, 126, 128, |
---|
510 | 123, 0, 131, 130, 238, 118, 122, 119, 262, 0, |
---|
511 | 0, 111, 132, 0, 11, 0, 124, 133, 11, 257, |
---|
512 | 134, 0, 258, 0, 0, 0 |
---|
513 | }; |
---|
514 | |
---|
515 | static const short yydefgoto[] = { 394, |
---|
516 | 140, 6, 30, 7, 226, 8, 9, 10, 11, 48, |
---|
517 | 104, 12, 184, 265, 249, 263, 288, 289, 294, 13, |
---|
518 | 41, 221, 115, 216, 117, 118, 182, 187, 119, 108, |
---|
519 | 251, 120, 139, 302, 272, 314, 315, 316, 328, 317, |
---|
520 | 318, 14, 44, 15, 45, 178, 321, 298, 309, 338, |
---|
521 | 350, 341, 351, 322, 299, 310, 332, 333, 357, 366, |
---|
522 | 353, 358, 359, 379, 371, 373, 382, 374, 383, 61, |
---|
523 | 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, |
---|
524 | 163, 121, 101, 164, 17, 246, 266, 217, 123, 124, |
---|
525 | 125, 126, 127, 64, 128, 66, 67, 68, 69, 70, |
---|
526 | 71, 72, 73, 129, 130, 131, 132, 133, 134, 135, |
---|
527 | 136, 137, 191, 192, 193, 194, 355, 195, 228, 229, |
---|
528 | 100, 18, 107, 188, 27, 185, 97, 19, 28, 24, |
---|
529 | 389, 165, 20, 138, 82, 166, 167, 168, 169, 170, |
---|
530 | 171, 21, 22, 172, 173, 174 |
---|
531 | }; |
---|
532 | |
---|
533 | static const short yypact[] = { 56, |
---|
534 | -21,-32768,-32768,-32768,-32768, 145,-32768,-32768,-32768, -21, |
---|
535 | 37, 37, 37, 37, 37,-32768, 84,-32768,-32768, 34, |
---|
536 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
537 | -32768,-32768,-32768,-32768, -21, 640, -21,-32768,-32768,-32768, |
---|
538 | -32768,-32768,-32768,-32768,-32768,-32768, 301, 87,-32768,-32768, |
---|
539 | -32768,-32768,-32768,-32768, 106,-32768, 81, 73,-32768, 88, |
---|
540 | -21,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
541 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 131, |
---|
542 | -32768, 147,-32768, 15, -21,-32768, 559,-32768, 172,-32768, |
---|
543 | -32768, 220, 181,-32768, 220, 139,-32768,-32768, 164, 9, |
---|
544 | -21,-32768,-32768, 97,-32768, 154,-32768, -21,-32768, 144, |
---|
545 | -32768,-32768, 146,-32768,-32768, -21,-32768,-32768,-32768,-32768, |
---|
546 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
547 | -32768,-32768,-32768,-32768,-32768,-32768,-32768, 45, -21, 165, |
---|
548 | 202,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 220,-32768, |
---|
549 | -32768,-32768,-32768, 166, 168, 169, 125, 107, 101,-32768, |
---|
550 | 316,-32768,-32768,-32768, 160,-32768,-32768,-32768,-32768,-32768, |
---|
551 | -32768, 184,-32768,-32768,-32768, 163, 220, 117,-32768, 198, |
---|
552 | -32768, 189,-32768,-32768,-32768,-32768, 191,-32768, 220, 605, |
---|
553 | 66,-32768,-32768,-32768,-32768, 175, 219,-32768, 194, 220, |
---|
554 | 220, 220, 220, 220, 220, 220, 220, 220, 220,-32768, |
---|
555 | -32768,-32768,-32768,-32768,-32768, -21,-32768, 212, -21, 203, |
---|
556 | 218,-32768, 211, -30,-32768, -21, 153, 175,-32768, 214, |
---|
557 | -32768,-32768, 168, 169, 125, 107, 107, 101, 101,-32768, |
---|
558 | -32768,-32768,-32768, 123,-32768, 10,-32768, 23,-32768,-32768, |
---|
559 | 559, 231, 220,-32768,-32768,-32768, 201,-32768, 25,-32768, |
---|
560 | -32768, -21, 129,-32768, 224, 465,-32768, 215, 216,-32768, |
---|
561 | 268, 229,-32768,-32768,-32768,-32768,-32768, 283,-32768, 23, |
---|
562 | -32768,-32768,-32768,-32768,-32768, 243,-32768, 247, 51,-32768, |
---|
563 | -32768,-32768,-32768,-32768, 37, 37, 37, 37, 37, 20, |
---|
564 | -32768, 138,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
565 | 415, 220, 242, 248, 138,-32768, 419,-32768,-32768,-32768, |
---|
566 | 307, 271, 253,-32768,-32768,-32768, -21, 37,-32768,-32768, |
---|
567 | -32768, -21, 559,-32768,-32768,-32768,-32768, 513, 254,-32768, |
---|
568 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -21, |
---|
569 | -32768, -3,-32768,-32768, 66,-32768, 252, 39,-32768, 371, |
---|
570 | 288, -21,-32768, 277, 244, 260,-32768,-32768,-32768,-32768, |
---|
571 | -32768, 262, 318,-32768,-32768,-32768,-32768,-32768, 513, 23, |
---|
572 | 272,-32768,-32768, -21, 70, 184,-32768,-32768, 71,-32768, |
---|
573 | -32768, 184,-32768, 334, 337,-32768 |
---|
574 | }; |
---|
575 | |
---|
576 | static const short yypgoto[] = {-32768, |
---|
577 | -32768, 250, 1, 55, -219,-32768, 19,-32768,-32768,-32768, |
---|
578 | -32768,-32768,-32768,-32768,-32768, -35,-32768,-32768,-32768, 59, |
---|
579 | -32768,-32768,-32768, -69, 162, -298,-32768, 217, -14,-32768, |
---|
580 | -32768, -13,-32768,-32768,-32768,-32768,-32768, 35,-32768,-32768, |
---|
581 | 38, 65,-32768, 68,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
582 | -288,-32768, 26,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
583 | -32768,-32768, -7,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
584 | -125,-32768, 167, 159, 170, 6, 7, -23,-32768, 205, |
---|
585 | -32768, -18,-32768, 5,-32768,-32768,-32768, -188, -290,-32768, |
---|
586 | -274, 328, -237,-32768, -17,-32768,-32768,-32768,-32768,-32768, |
---|
587 | -32768,-32768,-32768, -16, 339, -15,-32768,-32768,-32768,-32768, |
---|
588 | -32, -28, 157, -200, -82,-32768,-32768,-32768,-32768, 149, |
---|
589 | -32768, -1, -51, -25, 296, -161, -20,-32768,-32768,-32768, |
---|
590 | -32768, -73, 92, -19,-32768, 140, -313,-32768,-32768,-32768, |
---|
591 | -32768, 104,-32768,-32768, 226,-32768 |
---|
592 | }; |
---|
593 | |
---|
594 | |
---|
595 | #define YYLAST 692 |
---|
596 | |
---|
597 | |
---|
598 | static const short yytable[] = { 23, |
---|
599 | 47, 46, 106, 77, 16, 42, 43, 78, 26, 96, |
---|
600 | 16, 80, 31, 32, 33, 34, 81, 116, 65, 74, |
---|
601 | 76, 176, 220, 199, 25, 255, 262, 36, 253, 50, |
---|
602 | 3, 51, 37, 49, 340, 79, 231, 102, 356, 340, |
---|
603 | 62, 36, 344, 280, 271, 254, 37, 344, 1, 183, |
---|
604 | 1, 214, 103, 243, 38, -1, 83, 56, 345, 79, |
---|
605 | -115, 340, 267, 345, 196, 58, 3, 180, 225, 344, |
---|
606 | 261, 370, 390, 40, 3, 39, 3, 283, 393, 86, |
---|
607 | 340, 1, 26, 79, 88, 345, 181, 81, 344, 39, |
---|
608 | 384, 122, 93, 16, 29, 346, 40, 364, 2, 79, |
---|
609 | 346, 40, -117, 2, 345, 94, 79, 3, 5, 35, |
---|
610 | 40, -36, 4, 5, 79, 223, 90, -11, 81, 109, |
---|
611 | 290, 50, 346, 51, 225, 91, 336, 52, 225, 225, |
---|
612 | 303, 110, 54, 388, 391, 362, 55, 79, 365, 111, |
---|
613 | 112, 346, 1, 312, -2, 16, 89, 313, 113, 56, |
---|
614 | 57, 203, 204, 257, 114, 92, -28, 58, -28, 25, |
---|
615 | 59, 60, 95, 335, 196, 280, 142, 247, 3, 392, |
---|
616 | 1, 207, 208, 209, 196, 205, 206, 215, 1, 269, |
---|
617 | 29, 225, 122, 240, 241, 242, 323, 225, -33, 143, |
---|
618 | 98, 361, 2, 40, 122, 99, 3, 1, 144, 145, |
---|
619 | 175, 4, 5, 177, 3, 146, 147, 148, 236, 237, |
---|
620 | 279, 238, 239, 179, 79, 149, 186, 79, 189, 2, |
---|
621 | 190, 150, 151, 3, 79, 198, 152, 1, 4, 5, |
---|
622 | 256, 200, -3, 142, 201, 211, 202, 147, 213, 278, |
---|
623 | 273, 275, 276, 277, 260, 1, 218, 327, 219, 2, |
---|
624 | 222, 227, 264, 3, 230, 122, 143, 232, 4, 5, |
---|
625 | 79, 245, -4, 274, 248, 144, 145, 354, 250, 252, |
---|
626 | 122, 3, 146, 147, 148, 196, 259, 145, 270, 375, |
---|
627 | 311, 46, 149, 281, 287, 42, 43, 91, 150, 151, |
---|
628 | 284, 285, 286, 152, 83, 304, 305, 306, 307, 308, |
---|
629 | 347, 387, 291, 324, 348, 347, 339, 292, 325, 348, |
---|
630 | 330, 81, 83, 331, 334, 363, 352, 372, 376, 84, |
---|
631 | 40, 122, 85, 378, 380, 79, 381, 347, 337, 142, |
---|
632 | 79, 348, 360, 395, 386, 86, 396, 343, 141, 87, |
---|
633 | 88, 1, 343, 293, 385, 360, 347, 295, 79, 326, |
---|
634 | 348, 224, 143, 296, 329, 197, 297, 377, 342, 234, |
---|
635 | 79, 144, 145, 63, 343, 210, 233, 3, 146, 147, |
---|
636 | 148, 235, 244, 109, 75, 50, 258, 51, 149, 105, |
---|
637 | 300, 52, 79, 343, 264, 110, 54, 367, 368, 0, |
---|
638 | 55, 268, 301, 111, 112, 0, 1, 212, 0, 369, |
---|
639 | 0, 0, 113, 56, 57, 0, 0, 0, 114, 0, |
---|
640 | 0, 58, 0, 349, 59, 60, 0, 0, -93, 0, |
---|
641 | 0, 109, 3, 50, 312, 51, 83, 0, 313, 52, |
---|
642 | 0, 0, 0, 110, 54, 0, 85, 0, 55, 319, |
---|
643 | 0, 111, 112, 0, 1, 320, 0, 40, 0, 86, |
---|
644 | 113, 56, 57, 87, 88, 0, 114, 0, 0, 58, |
---|
645 | 0, 0, 59, 60, 0, 0, 0, 109, 0, 50, |
---|
646 | 3, 51, 0, 0, 0, 52, 0, 0, 0, 110, |
---|
647 | 54, 0, 0, 0, 55, 0, 0, 111, 112, 0, |
---|
648 | 1, 0, 0, 0, 0, 40, 113, 56, 57, 0, |
---|
649 | 0, 0, 114, 0, 0, 58, 0, 0, 59, 60, |
---|
650 | 0, 0, 0, 0, 0, 109, 3, 50, 0, 51, |
---|
651 | 0, 0, 0, 52, 0, 282, 0, 110, 54, 0, |
---|
652 | 0, 0, 55, 0, 0, 111, 112, 0, 1, 0, |
---|
653 | 0, 40, 0, 0, 113, 56, 57, 0, 0, 0, |
---|
654 | 114, 0, 0, 58, 0, 349, 59, 60, 0, 0, |
---|
655 | 0, 109, 0, 50, 3, 51, 0, 0, 0, 52, |
---|
656 | 0, 0, 0, 110, 54, 0, 0, 0, 55, 0, |
---|
657 | 0, 111, 112, 0, 1, 0, 0, 0, 0, 40, |
---|
658 | 113, 56, 57, 0, 0, 0, 114, 0, 0, 58, |
---|
659 | 0, 0, 59, 60, 0, 0, 0, 109, 0, 50, |
---|
660 | 3, 51, 0, 0, 0, 52, 0, 0, 0, 110, |
---|
661 | 54, 0, 0, 0, 55, 0, 0, 111, 112, 0, |
---|
662 | 1, 0, 0, 0, 0, 40, 113, 56, 57, 0, |
---|
663 | 0, 0, 114, 0, 50, 58, 51, 0, 59, 60, |
---|
664 | 52, 0, 0, 0, 53, 54, 3, 0, 0, 55, |
---|
665 | 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, |
---|
666 | 0, 0, 56, 57, 0, 0, 0, 0, 0, 0, |
---|
667 | 58, 0, 0, 59, 60, 0, 0, 0, 0, 0, |
---|
668 | 0, 3 |
---|
669 | }; |
---|
670 | |
---|
671 | static const short yycheck[] = { 1, |
---|
672 | 20, 20, 85, 36, 0, 20, 20, 36, 10, 61, |
---|
673 | 6, 37, 12, 13, 14, 15, 37, 87, 36, 36, |
---|
674 | 36, 95, 184, 149, 6, 226, 246, 8, 59, 5, |
---|
675 | 52, 7, 13, 35, 333, 37, 198, 23, 42, 338, |
---|
676 | 36, 8, 333, 263, 20, 76, 13, 338, 26, 101, |
---|
677 | 26, 177, 38, 215, 21, 0, 12, 33, 333, 61, |
---|
678 | 64, 360, 251, 338, 116, 41, 52, 59, 59, 360, |
---|
679 | 61, 360, 386, 77, 52, 56, 52, 266, 392, 35, |
---|
680 | 379, 26, 84, 85, 40, 360, 78, 108, 379, 56, |
---|
681 | 379, 87, 20, 89, 58, 333, 77, 59, 48, 101, |
---|
682 | 338, 77, 64, 48, 379, 33, 108, 52, 58, 26, |
---|
683 | 77, 61, 57, 58, 116, 189, 11, 52, 139, 3, |
---|
684 | 282, 5, 360, 7, 59, 20, 327, 11, 59, 59, |
---|
685 | 292, 15, 16, 64, 64, 355, 20, 139, 358, 23, |
---|
686 | 24, 379, 26, 6, 0, 141, 60, 10, 32, 33, |
---|
687 | 34, 27, 28, 227, 38, 75, 60, 41, 62, 141, |
---|
688 | 44, 45, 75, 325, 216, 385, 14, 219, 52, 389, |
---|
689 | 26, 71, 72, 73, 226, 69, 70, 61, 26, 253, |
---|
690 | 58, 59, 178, 207, 208, 209, 312, 59, 60, 37, |
---|
691 | 60, 353, 48, 77, 190, 49, 52, 26, 46, 47, |
---|
692 | 20, 57, 58, 65, 52, 53, 54, 55, 203, 204, |
---|
693 | 262, 205, 206, 50, 216, 63, 63, 219, 75, 48, |
---|
694 | 75, 69, 70, 52, 226, 61, 74, 26, 57, 58, |
---|
695 | 78, 66, 61, 14, 67, 76, 68, 54, 76, 259, |
---|
696 | 259, 259, 259, 259, 244, 26, 49, 317, 60, 48, |
---|
697 | 60, 77, 248, 52, 36, 251, 37, 64, 57, 58, |
---|
698 | 262, 50, 61, 259, 62, 46, 47, 350, 51, 59, |
---|
699 | 266, 52, 53, 54, 55, 327, 63, 47, 78, 362, |
---|
700 | 300, 300, 63, 60, 280, 300, 300, 20, 69, 70, |
---|
701 | 76, 76, 64, 74, 12, 295, 296, 297, 298, 299, |
---|
702 | 333, 384, 60, 62, 333, 338, 332, 61, 61, 338, |
---|
703 | 4, 332, 12, 43, 62, 64, 63, 30, 42, 19, |
---|
704 | 77, 317, 22, 64, 63, 327, 9, 360, 328, 14, |
---|
705 | 332, 360, 352, 0, 63, 35, 0, 333, 89, 39, |
---|
706 | 40, 26, 338, 289, 380, 365, 379, 289, 350, 315, |
---|
707 | 379, 190, 37, 289, 317, 139, 289, 365, 333, 201, |
---|
708 | 362, 46, 47, 36, 360, 161, 200, 52, 53, 54, |
---|
709 | 55, 202, 216, 3, 36, 5, 228, 7, 63, 84, |
---|
710 | 289, 11, 384, 379, 380, 15, 16, 17, 18, -1, |
---|
711 | 20, 252, 289, 23, 24, -1, 26, 172, -1, 29, |
---|
712 | -1, -1, 32, 33, 34, -1, -1, -1, 38, -1, |
---|
713 | -1, 41, -1, 43, 44, 45, -1, -1, 4, -1, |
---|
714 | -1, 3, 52, 5, 6, 7, 12, -1, 10, 11, |
---|
715 | -1, -1, -1, 15, 16, -1, 22, -1, 20, 25, |
---|
716 | -1, 23, 24, -1, 26, 31, -1, 77, -1, 35, |
---|
717 | 32, 33, 34, 39, 40, -1, 38, -1, -1, 41, |
---|
718 | -1, -1, 44, 45, -1, -1, -1, 3, -1, 5, |
---|
719 | 52, 7, -1, -1, -1, 11, -1, -1, -1, 15, |
---|
720 | 16, -1, -1, -1, 20, -1, -1, 23, 24, -1, |
---|
721 | 26, -1, -1, -1, -1, 77, 32, 33, 34, -1, |
---|
722 | -1, -1, 38, -1, -1, 41, -1, -1, 44, 45, |
---|
723 | -1, -1, -1, -1, -1, 3, 52, 5, -1, 7, |
---|
724 | -1, -1, -1, 11, -1, 61, -1, 15, 16, -1, |
---|
725 | -1, -1, 20, -1, -1, 23, 24, -1, 26, -1, |
---|
726 | -1, 77, -1, -1, 32, 33, 34, -1, -1, -1, |
---|
727 | 38, -1, -1, 41, -1, 43, 44, 45, -1, -1, |
---|
728 | -1, 3, -1, 5, 52, 7, -1, -1, -1, 11, |
---|
729 | -1, -1, -1, 15, 16, -1, -1, -1, 20, -1, |
---|
730 | -1, 23, 24, -1, 26, -1, -1, -1, -1, 77, |
---|
731 | 32, 33, 34, -1, -1, -1, 38, -1, -1, 41, |
---|
732 | -1, -1, 44, 45, -1, -1, -1, 3, -1, 5, |
---|
733 | 52, 7, -1, -1, -1, 11, -1, -1, -1, 15, |
---|
734 | 16, -1, -1, -1, 20, -1, -1, 23, 24, -1, |
---|
735 | 26, -1, -1, -1, -1, 77, 32, 33, 34, -1, |
---|
736 | -1, -1, 38, -1, 5, 41, 7, -1, 44, 45, |
---|
737 | 11, -1, -1, -1, 15, 16, 52, -1, -1, 20, |
---|
738 | -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, |
---|
739 | -1, -1, 33, 34, -1, -1, -1, -1, -1, -1, |
---|
740 | 41, -1, -1, 44, 45, -1, -1, -1, -1, -1, |
---|
741 | -1, 52 |
---|
742 | }; |
---|
743 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
---|
744 | #line 3 "/usr/lib/bison.simple" |
---|
745 | /* This file comes from bison-1.28. */ |
---|
746 | |
---|
747 | /* Skeleton output parser for bison, |
---|
748 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
---|
749 | |
---|
750 | This program is free software; you can redistribute it and/or modify |
---|
751 | it under the terms of the GNU General Public License as published by |
---|
752 | the Free Software Foundation; either version 2, or (at your option) |
---|
753 | any later version. |
---|
754 | |
---|
755 | This program is distributed in the hope that it will be useful, |
---|
756 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
757 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
758 | GNU General Public License for more details. |
---|
759 | |
---|
760 | You should have received a copy of the GNU General Public License |
---|
761 | along with this program; if not, write to the Free Software |
---|
762 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
763 | Boston, MA 02111-1307, USA. */ |
---|
764 | |
---|
765 | /* As a special exception, when this file is copied by Bison into a |
---|
766 | Bison output file, you may use that output file without restriction. |
---|
767 | This special exception was added by the Free Software Foundation |
---|
768 | in version 1.24 of Bison. */ |
---|
769 | |
---|
770 | /* This is the parser code that is written into each bison parser |
---|
771 | when the %semantic_parser declaration is not specified in the grammar. |
---|
772 | It was written by Richard Stallman by simplifying the hairy parser |
---|
773 | used when %semantic_parser is specified. */ |
---|
774 | |
---|
775 | #ifndef YYSTACK_USE_ALLOCA |
---|
776 | #ifdef alloca |
---|
777 | #define YYSTACK_USE_ALLOCA |
---|
778 | #else /* alloca not defined */ |
---|
779 | #ifdef __GNUC__ |
---|
780 | #define YYSTACK_USE_ALLOCA |
---|
781 | #define alloca __builtin_alloca |
---|
782 | #else /* not GNU C. */ |
---|
783 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) |
---|
784 | #define YYSTACK_USE_ALLOCA |
---|
785 | #include <alloca.h> |
---|
786 | #else /* not sparc */ |
---|
787 | /* We think this test detects Watcom and Microsoft C. */ |
---|
788 | /* This used to test MSDOS, but that is a bad idea |
---|
789 | since that symbol is in the user namespace. */ |
---|
790 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) |
---|
791 | #if 0 /* No need for malloc.h, which pollutes the namespace; |
---|
792 | instead, just don't use alloca. */ |
---|
793 | #include <malloc.h> |
---|
794 | #endif |
---|
795 | #else /* not MSDOS, or __TURBOC__ */ |
---|
796 | #if defined(_AIX) |
---|
797 | /* I don't know what this was needed for, but it pollutes the namespace. |
---|
798 | So I turned it off. rms, 2 May 1997. */ |
---|
799 | /* #include <malloc.h> */ |
---|
800 | #pragma alloca |
---|
801 | #define YYSTACK_USE_ALLOCA |
---|
802 | #else /* not MSDOS, or __TURBOC__, or _AIX */ |
---|
803 | #if 0 |
---|
804 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, |
---|
805 | and on HPUX 10. Eventually we can turn this on. */ |
---|
806 | #define YYSTACK_USE_ALLOCA |
---|
807 | #define alloca __builtin_alloca |
---|
808 | #endif /* __hpux */ |
---|
809 | #endif |
---|
810 | #endif /* not _AIX */ |
---|
811 | #endif /* not MSDOS, or __TURBOC__ */ |
---|
812 | #endif /* not sparc */ |
---|
813 | #endif /* not GNU C */ |
---|
814 | #endif /* alloca not defined */ |
---|
815 | #endif /* YYSTACK_USE_ALLOCA not defined */ |
---|
816 | |
---|
817 | #ifdef YYSTACK_USE_ALLOCA |
---|
818 | #define YYSTACK_ALLOC alloca |
---|
819 | #else |
---|
820 | #define YYSTACK_ALLOC malloc |
---|
821 | #endif |
---|
822 | |
---|
823 | /* Note: there must be only one dollar sign in this file. |
---|
824 | It is replaced by the list of actions, each action |
---|
825 | as one case of the switch. */ |
---|
826 | |
---|
827 | #define yyerrok (yyerrstatus = 0) |
---|
828 | #define yyclearin (yychar = YYEMPTY) |
---|
829 | #define YYEMPTY -2 |
---|
830 | #define YYEOF 0 |
---|
831 | #define YYACCEPT goto yyacceptlab |
---|
832 | #define YYABORT goto yyabortlab |
---|
833 | #define YYERROR goto yyerrlab1 |
---|
834 | /* Like YYERROR except do call yyerror. |
---|
835 | This remains here temporarily to ease the |
---|
836 | transition to the new meaning of YYERROR, for GCC. |
---|
837 | Once GCC version 2 has supplanted version 1, this can go. */ |
---|
838 | #define YYFAIL goto yyerrlab |
---|
839 | #define YYRECOVERING() (!!yyerrstatus) |
---|
840 | #define YYBACKUP(token, value) \ |
---|
841 | do \ |
---|
842 | if (yychar == YYEMPTY && yylen == 1) \ |
---|
843 | { yychar = (token), yylval = (value); \ |
---|
844 | yychar1 = YYTRANSLATE (yychar); \ |
---|
845 | YYPOPSTACK; \ |
---|
846 | goto yybackup; \ |
---|
847 | } \ |
---|
848 | else \ |
---|
849 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ |
---|
850 | while (0) |
---|
851 | |
---|
852 | #define YYTERROR 1 |
---|
853 | #define YYERRCODE 256 |
---|
854 | |
---|
855 | #ifndef YYPURE |
---|
856 | #define YYLEX yylex() |
---|
857 | #endif |
---|
858 | |
---|
859 | #ifdef YYPURE |
---|
860 | #ifdef YYLSP_NEEDED |
---|
861 | #ifdef YYLEX_PARAM |
---|
862 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) |
---|
863 | #else |
---|
864 | #define YYLEX yylex(&yylval, &yylloc) |
---|
865 | #endif |
---|
866 | #else /* not YYLSP_NEEDED */ |
---|
867 | #ifdef YYLEX_PARAM |
---|
868 | #define YYLEX yylex(&yylval, YYLEX_PARAM) |
---|
869 | #else |
---|
870 | #define YYLEX yylex(&yylval) |
---|
871 | #endif |
---|
872 | #endif /* not YYLSP_NEEDED */ |
---|
873 | #endif |
---|
874 | |
---|
875 | /* If nonreentrant, generate the variables here */ |
---|
876 | |
---|
877 | #ifndef YYPURE |
---|
878 | |
---|
879 | int yychar; /* the lookahead symbol */ |
---|
880 | YYSTYPE yylval; /* the semantic value of the */ |
---|
881 | /* lookahead symbol */ |
---|
882 | |
---|
883 | #ifdef YYLSP_NEEDED |
---|
884 | YYLTYPE yylloc; /* location data for the lookahead */ |
---|
885 | /* symbol */ |
---|
886 | #endif |
---|
887 | |
---|
888 | int yynerrs; /* number of parse errors so far */ |
---|
889 | #endif /* not YYPURE */ |
---|
890 | |
---|
891 | #if YYDEBUG != 0 |
---|
892 | int yydebug; /* nonzero means print parse trace */ |
---|
893 | /* Since this is uninitialized, it does not stop multiple parsers |
---|
894 | from coexisting. */ |
---|
895 | #endif |
---|
896 | |
---|
897 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ |
---|
898 | |
---|
899 | #ifndef YYINITDEPTH |
---|
900 | #define YYINITDEPTH 200 |
---|
901 | #endif |
---|
902 | |
---|
903 | /* YYMAXDEPTH is the maximum size the stacks can grow to |
---|
904 | (effective only if the built-in stack extension method is used). */ |
---|
905 | |
---|
906 | #if YYMAXDEPTH == 0 |
---|
907 | #undef YYMAXDEPTH |
---|
908 | #endif |
---|
909 | |
---|
910 | #ifndef YYMAXDEPTH |
---|
911 | #define YYMAXDEPTH 10000 |
---|
912 | #endif |
---|
913 | |
---|
914 | /* Define __yy_memcpy. Note that the size argument |
---|
915 | should be passed with type unsigned int, because that is what the non-GCC |
---|
916 | definitions require. With GCC, __builtin_memcpy takes an arg |
---|
917 | of type size_t, but it can handle unsigned int. */ |
---|
918 | |
---|
919 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
---|
920 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
---|
921 | #else /* not GNU C or C++ */ |
---|
922 | #ifndef __cplusplus |
---|
923 | |
---|
924 | /* This is the most reliable way to avoid incompatibilities |
---|
925 | in available built-in functions on various systems. */ |
---|
926 | static void |
---|
927 | __yy_memcpy (to, from, count) |
---|
928 | char *to; |
---|
929 | char *from; |
---|
930 | unsigned int count; |
---|
931 | { |
---|
932 | register char *f = from; |
---|
933 | register char *t = to; |
---|
934 | register int i = count; |
---|
935 | |
---|
936 | while (i-- > 0) |
---|
937 | *t++ = *f++; |
---|
938 | } |
---|
939 | |
---|
940 | #else /* __cplusplus */ |
---|
941 | |
---|
942 | /* This is the most reliable way to avoid incompatibilities |
---|
943 | in available built-in functions on various systems. */ |
---|
944 | static void |
---|
945 | __yy_memcpy (char *to, char *from, unsigned int count) |
---|
946 | { |
---|
947 | register char *t = to; |
---|
948 | register char *f = from; |
---|
949 | register int i = count; |
---|
950 | |
---|
951 | while (i-- > 0) |
---|
952 | *t++ = *f++; |
---|
953 | } |
---|
954 | |
---|
955 | #endif |
---|
956 | #endif |
---|
957 | |
---|
958 | #line 217 "/usr/lib/bison.simple" |
---|
959 | |
---|
960 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
---|
961 | into yyparse. The argument should have type void *. |
---|
962 | It should actually point to an object. |
---|
963 | Grammar actions can access the variable by casting it |
---|
964 | to the proper pointer type. */ |
---|
965 | |
---|
966 | #ifdef YYPARSE_PARAM |
---|
967 | #ifdef __cplusplus |
---|
968 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
---|
969 | #define YYPARSE_PARAM_DECL |
---|
970 | #else /* not __cplusplus */ |
---|
971 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM |
---|
972 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
---|
973 | #endif /* not __cplusplus */ |
---|
974 | #else /* not YYPARSE_PARAM */ |
---|
975 | #define YYPARSE_PARAM_ARG |
---|
976 | #define YYPARSE_PARAM_DECL |
---|
977 | #endif /* not YYPARSE_PARAM */ |
---|
978 | |
---|
979 | /* Prevent warning if -Wstrict-prototypes. */ |
---|
980 | #ifdef __GNUC__ |
---|
981 | #ifdef YYPARSE_PARAM |
---|
982 | int yyparse (void *); |
---|
983 | #else |
---|
984 | int yyparse (void); |
---|
985 | #endif |
---|
986 | #endif |
---|
987 | |
---|
988 | int |
---|
989 | yyparse(YYPARSE_PARAM_ARG) |
---|
990 | YYPARSE_PARAM_DECL |
---|
991 | { |
---|
992 | register int yystate; |
---|
993 | register int yyn; |
---|
994 | register short *yyssp; |
---|
995 | register YYSTYPE *yyvsp; |
---|
996 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ |
---|
997 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
---|
998 | |
---|
999 | short yyssa[YYINITDEPTH]; /* the state stack */ |
---|
1000 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ |
---|
1001 | |
---|
1002 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ |
---|
1003 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ |
---|
1004 | |
---|
1005 | #ifdef YYLSP_NEEDED |
---|
1006 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ |
---|
1007 | YYLTYPE *yyls = yylsa; |
---|
1008 | YYLTYPE *yylsp; |
---|
1009 | |
---|
1010 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
---|
1011 | #else |
---|
1012 | #define YYPOPSTACK (yyvsp--, yyssp--) |
---|
1013 | #endif |
---|
1014 | |
---|
1015 | int yystacksize = YYINITDEPTH; |
---|
1016 | int yyfree_stacks = 0; |
---|
1017 | |
---|
1018 | #ifdef YYPURE |
---|
1019 | int yychar; |
---|
1020 | YYSTYPE yylval; |
---|
1021 | int yynerrs; |
---|
1022 | #ifdef YYLSP_NEEDED |
---|
1023 | YYLTYPE yylloc; |
---|
1024 | #endif |
---|
1025 | #endif |
---|
1026 | |
---|
1027 | YYSTYPE yyval; /* the variable used to return */ |
---|
1028 | /* semantic values from the action */ |
---|
1029 | /* routines */ |
---|
1030 | |
---|
1031 | int yylen; |
---|
1032 | |
---|
1033 | #if YYDEBUG != 0 |
---|
1034 | if (yydebug) |
---|
1035 | fprintf(stderr, "Starting parse\n"); |
---|
1036 | #endif |
---|
1037 | |
---|
1038 | yystate = 0; |
---|
1039 | yyerrstatus = 0; |
---|
1040 | yynerrs = 0; |
---|
1041 | yychar = YYEMPTY; /* Cause a token to be read. */ |
---|
1042 | |
---|
1043 | /* Initialize stack pointers. |
---|
1044 | Waste one element of value and location stack |
---|
1045 | so that they stay on the same level as the state stack. |
---|
1046 | The wasted elements are never initialized. */ |
---|
1047 | |
---|
1048 | yyssp = yyss - 1; |
---|
1049 | yyvsp = yyvs; |
---|
1050 | #ifdef YYLSP_NEEDED |
---|
1051 | yylsp = yyls; |
---|
1052 | #endif |
---|
1053 | |
---|
1054 | /* Push a new state, which is found in yystate . */ |
---|
1055 | /* In all cases, when you get here, the value and location stacks |
---|
1056 | have just been pushed. so pushing a state here evens the stacks. */ |
---|
1057 | yynewstate: |
---|
1058 | |
---|
1059 | *++yyssp = yystate; |
---|
1060 | |
---|
1061 | if (yyssp >= yyss + yystacksize - 1) |
---|
1062 | { |
---|
1063 | /* Give user a chance to reallocate the stack */ |
---|
1064 | /* Use copies of these so that the &'s don't force the real ones into memory. */ |
---|
1065 | YYSTYPE *yyvs1 = yyvs; |
---|
1066 | short *yyss1 = yyss; |
---|
1067 | #ifdef YYLSP_NEEDED |
---|
1068 | YYLTYPE *yyls1 = yyls; |
---|
1069 | #endif |
---|
1070 | |
---|
1071 | /* Get the current used size of the three stacks, in elements. */ |
---|
1072 | int size = yyssp - yyss + 1; |
---|
1073 | |
---|
1074 | #ifdef yyoverflow |
---|
1075 | /* Each stack pointer address is followed by the size of |
---|
1076 | the data in use in that stack, in bytes. */ |
---|
1077 | #ifdef YYLSP_NEEDED |
---|
1078 | /* This used to be a conditional around just the two extra args, |
---|
1079 | but that might be undefined if yyoverflow is a macro. */ |
---|
1080 | yyoverflow("parser stack overflow", |
---|
1081 | &yyss1, size * sizeof (*yyssp), |
---|
1082 | &yyvs1, size * sizeof (*yyvsp), |
---|
1083 | &yyls1, size * sizeof (*yylsp), |
---|
1084 | &yystacksize); |
---|
1085 | #else |
---|
1086 | yyoverflow("parser stack overflow", |
---|
1087 | &yyss1, size * sizeof (*yyssp), |
---|
1088 | &yyvs1, size * sizeof (*yyvsp), |
---|
1089 | &yystacksize); |
---|
1090 | #endif |
---|
1091 | |
---|
1092 | yyss = yyss1; yyvs = yyvs1; |
---|
1093 | #ifdef YYLSP_NEEDED |
---|
1094 | yyls = yyls1; |
---|
1095 | #endif |
---|
1096 | #else /* no yyoverflow */ |
---|
1097 | /* Extend the stack our own way. */ |
---|
1098 | if (yystacksize >= YYMAXDEPTH) |
---|
1099 | { |
---|
1100 | yyerror("parser stack overflow"); |
---|
1101 | if (yyfree_stacks) |
---|
1102 | { |
---|
1103 | free (yyss); |
---|
1104 | free (yyvs); |
---|
1105 | #ifdef YYLSP_NEEDED |
---|
1106 | free (yyls); |
---|
1107 | #endif |
---|
1108 | } |
---|
1109 | return 2; |
---|
1110 | } |
---|
1111 | yystacksize *= 2; |
---|
1112 | if (yystacksize > YYMAXDEPTH) |
---|
1113 | yystacksize = YYMAXDEPTH; |
---|
1114 | #ifndef YYSTACK_USE_ALLOCA |
---|
1115 | yyfree_stacks = 1; |
---|
1116 | #endif |
---|
1117 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); |
---|
1118 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
---|
1119 | size * (unsigned int) sizeof (*yyssp)); |
---|
1120 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); |
---|
1121 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
---|
1122 | size * (unsigned int) sizeof (*yyvsp)); |
---|
1123 | #ifdef YYLSP_NEEDED |
---|
1124 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
---|
1125 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
---|
1126 | size * (unsigned int) sizeof (*yylsp)); |
---|
1127 | #endif |
---|
1128 | #endif /* no yyoverflow */ |
---|
1129 | |
---|
1130 | yyssp = yyss + size - 1; |
---|
1131 | yyvsp = yyvs + size - 1; |
---|
1132 | #ifdef YYLSP_NEEDED |
---|
1133 | yylsp = yyls + size - 1; |
---|
1134 | #endif |
---|
1135 | |
---|
1136 | #if YYDEBUG != 0 |
---|
1137 | if (yydebug) |
---|
1138 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); |
---|
1139 | #endif |
---|
1140 | |
---|
1141 | if (yyssp >= yyss + yystacksize - 1) |
---|
1142 | YYABORT; |
---|
1143 | } |
---|
1144 | |
---|
1145 | #if YYDEBUG != 0 |
---|
1146 | if (yydebug) |
---|
1147 | fprintf(stderr, "Entering state %d\n", yystate); |
---|
1148 | #endif |
---|
1149 | |
---|
1150 | goto yybackup; |
---|
1151 | yybackup: |
---|
1152 | |
---|
1153 | /* Do appropriate processing given the current state. */ |
---|
1154 | /* Read a lookahead token if we need one and don't already have one. */ |
---|
1155 | /* yyresume: */ |
---|
1156 | |
---|
1157 | /* First try to decide what to do without reference to lookahead token. */ |
---|
1158 | |
---|
1159 | yyn = yypact[yystate]; |
---|
1160 | if (yyn == YYFLAG) |
---|
1161 | goto yydefault; |
---|
1162 | |
---|
1163 | /* Not known => get a lookahead token if don't already have one. */ |
---|
1164 | |
---|
1165 | /* yychar is either YYEMPTY or YYEOF |
---|
1166 | or a valid token in external form. */ |
---|
1167 | |
---|
1168 | if (yychar == YYEMPTY) |
---|
1169 | { |
---|
1170 | #if YYDEBUG != 0 |
---|
1171 | if (yydebug) |
---|
1172 | fprintf(stderr, "Reading a token: "); |
---|
1173 | #endif |
---|
1174 | yychar = YYLEX; |
---|
1175 | } |
---|
1176 | |
---|
1177 | /* Convert token to internal form (in yychar1) for indexing tables with */ |
---|
1178 | |
---|
1179 | if (yychar <= 0) /* This means end of input. */ |
---|
1180 | { |
---|
1181 | yychar1 = 0; |
---|
1182 | yychar = YYEOF; /* Don't call YYLEX any more */ |
---|
1183 | |
---|
1184 | #if YYDEBUG != 0 |
---|
1185 | if (yydebug) |
---|
1186 | fprintf(stderr, "Now at end of input.\n"); |
---|
1187 | #endif |
---|
1188 | } |
---|
1189 | else |
---|
1190 | { |
---|
1191 | yychar1 = YYTRANSLATE(yychar); |
---|
1192 | |
---|
1193 | #if YYDEBUG != 0 |
---|
1194 | if (yydebug) |
---|
1195 | { |
---|
1196 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); |
---|
1197 | /* Give the individual parser a way to print the precise meaning |
---|
1198 | of a token, for further debugging info. */ |
---|
1199 | #ifdef YYPRINT |
---|
1200 | YYPRINT (stderr, yychar, yylval); |
---|
1201 | #endif |
---|
1202 | fprintf (stderr, ")\n"); |
---|
1203 | } |
---|
1204 | #endif |
---|
1205 | } |
---|
1206 | |
---|
1207 | yyn += yychar1; |
---|
1208 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
---|
1209 | goto yydefault; |
---|
1210 | |
---|
1211 | yyn = yytable[yyn]; |
---|
1212 | |
---|
1213 | /* yyn is what to do for this token type in this state. |
---|
1214 | Negative => reduce, -yyn is rule number. |
---|
1215 | Positive => shift, yyn is new state. |
---|
1216 | New state is final state => don't bother to shift, |
---|
1217 | just return success. |
---|
1218 | 0, or most negative number => error. */ |
---|
1219 | |
---|
1220 | if (yyn < 0) |
---|
1221 | { |
---|
1222 | if (yyn == YYFLAG) |
---|
1223 | goto yyerrlab; |
---|
1224 | yyn = -yyn; |
---|
1225 | goto yyreduce; |
---|
1226 | } |
---|
1227 | else if (yyn == 0) |
---|
1228 | goto yyerrlab; |
---|
1229 | |
---|
1230 | if (yyn == YYFINAL) |
---|
1231 | YYACCEPT; |
---|
1232 | |
---|
1233 | /* Shift the lookahead token. */ |
---|
1234 | |
---|
1235 | #if YYDEBUG != 0 |
---|
1236 | if (yydebug) |
---|
1237 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); |
---|
1238 | #endif |
---|
1239 | |
---|
1240 | /* Discard the token being shifted unless it is eof. */ |
---|
1241 | if (yychar != YYEOF) |
---|
1242 | yychar = YYEMPTY; |
---|
1243 | |
---|
1244 | *++yyvsp = yylval; |
---|
1245 | #ifdef YYLSP_NEEDED |
---|
1246 | *++yylsp = yylloc; |
---|
1247 | #endif |
---|
1248 | |
---|
1249 | /* count tokens shifted since error; after three, turn off error status. */ |
---|
1250 | if (yyerrstatus) yyerrstatus--; |
---|
1251 | |
---|
1252 | yystate = yyn; |
---|
1253 | goto yynewstate; |
---|
1254 | |
---|
1255 | /* Do the default action for the current state. */ |
---|
1256 | yydefault: |
---|
1257 | |
---|
1258 | yyn = yydefact[yystate]; |
---|
1259 | if (yyn == 0) |
---|
1260 | goto yyerrlab; |
---|
1261 | |
---|
1262 | /* Do a reduction. yyn is the number of a rule to reduce with. */ |
---|
1263 | yyreduce: |
---|
1264 | yylen = yyr2[yyn]; |
---|
1265 | if (yylen > 0) |
---|
1266 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ |
---|
1267 | |
---|
1268 | #if YYDEBUG != 0 |
---|
1269 | if (yydebug) |
---|
1270 | { |
---|
1271 | int i; |
---|
1272 | |
---|
1273 | fprintf (stderr, "Reducing via rule %d (line %d), ", |
---|
1274 | yyn, yyrline[yyn]); |
---|
1275 | |
---|
1276 | /* Print the symbols being reduced, and their result. */ |
---|
1277 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) |
---|
1278 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); |
---|
1279 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
---|
1280 | } |
---|
1281 | #endif |
---|
1282 | |
---|
1283 | |
---|
1284 | switch (yyn) { |
---|
1285 | |
---|
1286 | case 1: |
---|
1287 | #line 309 "./parser.y" |
---|
1288 | { yyerror ("Empty file"); YYABORT; ; |
---|
1289 | break;} |
---|
1290 | case 2: |
---|
1291 | #line 310 "./parser.y" |
---|
1292 | { __IDL_root = yyvsp[0].tree; ; |
---|
1293 | break;} |
---|
1294 | case 3: |
---|
1295 | #line 313 "./parser.y" |
---|
1296 | { yyval.tree = NULL; ; |
---|
1297 | break;} |
---|
1298 | case 5: |
---|
1299 | #line 317 "./parser.y" |
---|
1300 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
1301 | break;} |
---|
1302 | case 6: |
---|
1303 | #line 318 "./parser.y" |
---|
1304 | { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ; |
---|
1305 | break;} |
---|
1306 | case 8: |
---|
1307 | #line 322 "./parser.y" |
---|
1308 | { |
---|
1309 | if (do_token_error (yyvsp[0].tree, "Missing semicolon after", TRUE)) |
---|
1310 | YYABORT; |
---|
1311 | ; |
---|
1312 | break;} |
---|
1313 | case 9: |
---|
1314 | #line 328 "./parser.y" |
---|
1315 | { |
---|
1316 | yyerror ("Dangling semicolon has no effect"); |
---|
1317 | yyval.tree = NULL; |
---|
1318 | ; |
---|
1319 | break;} |
---|
1320 | case 11: |
---|
1321 | #line 335 "./parser.y" |
---|
1322 | { |
---|
1323 | if (do_token_error (yyvsp[0].tree, "Missing comma after", TRUE)) |
---|
1324 | YYABORT; |
---|
1325 | ; |
---|
1326 | break;} |
---|
1327 | case 12: |
---|
1328 | #line 341 "./parser.y" |
---|
1329 | { |
---|
1330 | if (IDL_NODE_UP (yyvsp[0].tree)) |
---|
1331 | do_token_error (IDL_NODE_UP (yyvsp[0].tree), "Illegal context for", FALSE); |
---|
1332 | else |
---|
1333 | yyerror ("Illegal context for identifier"); |
---|
1334 | YYABORT; |
---|
1335 | ; |
---|
1336 | break;} |
---|
1337 | case 23: |
---|
1338 | #line 365 "./parser.y" |
---|
1339 | { |
---|
1340 | if (IDL_NODE_UP (yyvsp[0].tree) != NULL && |
---|
1341 | IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_MODULE) { |
---|
1342 | yyerror ("Module definition conflicts"); |
---|
1343 | do_token_error (IDL_NODE_UP (yyvsp[0].tree), "with", FALSE); |
---|
1344 | YYABORT; |
---|
1345 | } |
---|
1346 | ; |
---|
1347 | break;} |
---|
1348 | case 24: |
---|
1349 | #line 374 "./parser.y" |
---|
1350 | { |
---|
1351 | IDL_tree module; |
---|
1352 | |
---|
1353 | if (yyvsp[-2].tree == NULL) { |
---|
1354 | yyerrorv ("Empty module declaration `%s' is not legal IDL", |
---|
1355 | IDL_IDENT (yyvsp[-5].tree).str); |
---|
1356 | module = NULL; |
---|
1357 | } |
---|
1358 | |
---|
1359 | if (__IDL_flags & IDLF_COMBINE_REOPENED_MODULES) { |
---|
1360 | if (IDL_NODE_UP (yyvsp[-5].tree) == NULL) |
---|
1361 | module = IDL_module_new (yyvsp[-5].tree, yyvsp[-2].tree); |
---|
1362 | else { |
---|
1363 | module = IDL_NODE_UP (yyvsp[-5].tree); |
---|
1364 | IDL_MODULE (module).definition_list = |
---|
1365 | IDL_list_concat (IDL_MODULE (module).definition_list, yyvsp[-2].tree); |
---|
1366 | module = NULL; |
---|
1367 | } |
---|
1368 | } else |
---|
1369 | module = IDL_module_new (yyvsp[-5].tree, yyvsp[-2].tree); |
---|
1370 | |
---|
1371 | yyval.tree = module; |
---|
1372 | if (yyval.tree) assign_declspec (yyval.tree, yyvsp[-6].declspec); |
---|
1373 | ; |
---|
1374 | break;} |
---|
1375 | case 26: |
---|
1376 | #line 403 "./parser.y" |
---|
1377 | { |
---|
1378 | yyerror ("Interfaces cannot be named `Object'"); |
---|
1379 | YYABORT; |
---|
1380 | ; |
---|
1381 | break;} |
---|
1382 | case 27: |
---|
1383 | #line 407 "./parser.y" |
---|
1384 | { |
---|
1385 | yyerror ("Interfaces cannot be named `TypeCode'"); |
---|
1386 | YYABORT; |
---|
1387 | ; |
---|
1388 | break;} |
---|
1389 | case 28: |
---|
1390 | #line 416 "./parser.y" |
---|
1391 | { |
---|
1392 | assert (yyvsp[0].tree != NULL); |
---|
1393 | assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT); |
---|
1394 | assert (IDL_IDENT_TO_NS (yyvsp[0].tree) != NULL); |
---|
1395 | assert (IDL_NODE_TYPE (IDL_IDENT_TO_NS (yyvsp[0].tree)) == IDLN_GENTREE); |
---|
1396 | |
---|
1397 | if (IDL_NODE_UP (yyvsp[0].tree) != NULL && |
---|
1398 | IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_INTERFACE && |
---|
1399 | IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_FORWARD_DCL) { |
---|
1400 | yyerrorl ("Interface definition conflicts", |
---|
1401 | __IDL_prev_token_line - __IDL_cur_token_line); |
---|
1402 | do_token_error (IDL_NODE_UP (yyvsp[0].tree), "with", FALSE); |
---|
1403 | YYABORT; |
---|
1404 | } else if (IDL_NODE_UP (yyvsp[0].tree) != NULL && |
---|
1405 | IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_FORWARD_DCL) { |
---|
1406 | yyerrorv ("Cannot redeclare interface `%s'", IDL_IDENT (yyvsp[0].tree).str); |
---|
1407 | IDL_tree_error (yyvsp[0].tree, "Previous declaration of interface `%s'", IDL_IDENT (yyvsp[0].tree).str); |
---|
1408 | YYABORT; |
---|
1409 | } else if (IDL_NODE_UP (yyvsp[0].tree) != NULL && |
---|
1410 | IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) == IDLN_FORWARD_DCL) |
---|
1411 | __IDL_assign_this_location (yyvsp[0].tree, __IDL_cur_filename, __IDL_cur_line); |
---|
1412 | ; |
---|
1413 | break;} |
---|
1414 | case 29: |
---|
1415 | #line 439 "./parser.y" |
---|
1416 | { |
---|
1417 | IDL_GENTREE (IDL_IDENT_TO_NS (yyvsp[-3].tree))._import = yyvsp[0].tree; |
---|
1418 | IDL_ns_push_scope (__IDL_root_ns, IDL_IDENT_TO_NS (yyvsp[-3].tree)); |
---|
1419 | if (IDL_ns_check_for_ambiguous_inheritance (yyvsp[-3].tree, yyvsp[0].tree)) |
---|
1420 | __IDL_is_okay = FALSE; |
---|
1421 | ; |
---|
1422 | break;} |
---|
1423 | case 30: |
---|
1424 | #line 446 "./parser.y" |
---|
1425 | { |
---|
1426 | yyval.tree = IDL_interface_new (yyvsp[-8].tree, yyvsp[-5].tree, yyvsp[-2].tree); |
---|
1427 | assign_declspec (yyval.tree, yyvsp[-11].declspec); |
---|
1428 | assign_props (IDL_INTERFACE (yyval.tree).ident, yyvsp[-10].hash_table); |
---|
1429 | ; |
---|
1430 | break;} |
---|
1431 | case 31: |
---|
1432 | #line 455 "./parser.y" |
---|
1433 | { |
---|
1434 | if (yyvsp[-3].hash_table) yywarningv (IDL_WARNING1, |
---|
1435 | "Ignoring properties for forward declaration `%s'", |
---|
1436 | IDL_IDENT (yyvsp[-1].tree).str); |
---|
1437 | yyval.tree = IDL_forward_dcl_new (yyvsp[-1].tree); |
---|
1438 | assign_declspec (yyval.tree, yyvsp[-4].declspec); |
---|
1439 | ; |
---|
1440 | break;} |
---|
1441 | case 32: |
---|
1442 | #line 464 "./parser.y" |
---|
1443 | { yyval.tree = NULL; ; |
---|
1444 | break;} |
---|
1445 | case 33: |
---|
1446 | #line 465 "./parser.y" |
---|
1447 | { |
---|
1448 | GHashTable *table = g_hash_table_new (g_direct_hash, g_direct_equal); |
---|
1449 | gboolean die = FALSE; |
---|
1450 | IDL_tree p = yyvsp[0].tree; |
---|
1451 | |
---|
1452 | assert (IDL_NODE_TYPE (p) == IDLN_LIST); |
---|
1453 | for (; p != NULL && !die; p = IDL_LIST (p).next) { |
---|
1454 | assert (IDL_LIST (p).data != NULL); |
---|
1455 | assert (IDL_NODE_TYPE (IDL_LIST (p).data) == IDLN_IDENT); |
---|
1456 | |
---|
1457 | if (g_hash_table_lookup_extended (table, IDL_LIST (p).data, NULL, NULL)) { |
---|
1458 | char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0); |
---|
1459 | yyerrorv ("Cannot inherit from interface `%s' more than once", s); |
---|
1460 | g_free (s); |
---|
1461 | die = TRUE; |
---|
1462 | break; |
---|
1463 | } else |
---|
1464 | g_hash_table_insert (table, IDL_LIST (p).data, NULL); |
---|
1465 | |
---|
1466 | if (IDL_NODE_TYPE (IDL_NODE_UP (IDL_LIST (p).data)) == IDLN_FORWARD_DCL) { |
---|
1467 | char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0); |
---|
1468 | yyerrorv ("Incomplete definition of interface `%s'", s); |
---|
1469 | IDL_tree_error (IDL_LIST (p).data, |
---|
1470 | "Previous forward declaration of `%s'", s); |
---|
1471 | g_free (s); |
---|
1472 | die = TRUE; |
---|
1473 | } |
---|
1474 | else if (IDL_NODE_TYPE (IDL_NODE_UP (IDL_LIST (p).data)) != IDLN_INTERFACE) { |
---|
1475 | char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0); |
---|
1476 | yyerrorv ("`%s' is not an interface", s); |
---|
1477 | IDL_tree_error (IDL_LIST (p).data, |
---|
1478 | "Previous declaration of `%s'", s); |
---|
1479 | g_free (s); |
---|
1480 | die = TRUE; |
---|
1481 | } |
---|
1482 | } |
---|
1483 | |
---|
1484 | g_hash_table_destroy (table); |
---|
1485 | |
---|
1486 | if (die) |
---|
1487 | YYABORT; |
---|
1488 | |
---|
1489 | yyval.tree = yyvsp[0].tree; |
---|
1490 | ; |
---|
1491 | break;} |
---|
1492 | case 34: |
---|
1493 | #line 511 "./parser.y" |
---|
1494 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
1495 | break;} |
---|
1496 | case 35: |
---|
1497 | #line 513 "./parser.y" |
---|
1498 | { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ; |
---|
1499 | break;} |
---|
1500 | case 37: |
---|
1501 | #line 519 "./parser.y" |
---|
1502 | { yyval.tree = NULL; ; |
---|
1503 | break;} |
---|
1504 | case 38: |
---|
1505 | #line 520 "./parser.y" |
---|
1506 | { yyval.tree = zlist_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ; |
---|
1507 | break;} |
---|
1508 | case 46: |
---|
1509 | #line 532 "./parser.y" |
---|
1510 | { |
---|
1511 | yyval.tree = yyvsp[0].tree; |
---|
1512 | assign_declspec (yyval.tree, yyvsp[-1].declspec); |
---|
1513 | ; |
---|
1514 | break;} |
---|
1515 | case 47: |
---|
1516 | #line 539 "./parser.y" |
---|
1517 | { |
---|
1518 | IDL_tree_node node; |
---|
1519 | IDL_tree p, dcl; |
---|
1520 | |
---|
1521 | yyval.tree = yyvsp[0].tree; |
---|
1522 | node.properties = yyvsp[-2].hash_table; |
---|
1523 | for (p = IDL_TYPE_DCL (yyvsp[0].tree).dcls; p; p = IDL_LIST (p).next) { |
---|
1524 | dcl = IDL_LIST (p).data; |
---|
1525 | IDL_tree_properties_copy (&node, dcl); |
---|
1526 | } |
---|
1527 | __IDL_free_properties (node.properties); |
---|
1528 | ; |
---|
1529 | break;} |
---|
1530 | case 51: |
---|
1531 | #line 555 "./parser.y" |
---|
1532 | { |
---|
1533 | yyval.tree = IDL_native_new (yyvsp[0].tree); |
---|
1534 | assign_props (IDL_NATIVE (yyval.tree).ident, yyvsp[-2].hash_table); |
---|
1535 | ; |
---|
1536 | break;} |
---|
1537 | case 52: |
---|
1538 | #line 560 "./parser.y" |
---|
1539 | { |
---|
1540 | /* Enable native type scanning */ |
---|
1541 | if (__IDL_pidl > 0) |
---|
1542 | __IDL_flagsi |= IDLFP_NATIVE; |
---|
1543 | else { |
---|
1544 | yyerror ("Native syntax not enabled"); |
---|
1545 | YYABORT; |
---|
1546 | } |
---|
1547 | ; |
---|
1548 | break;} |
---|
1549 | case 53: |
---|
1550 | #line 568 "./parser.y" |
---|
1551 | { |
---|
1552 | yyval.tree = IDL_native_new (yyvsp[-3].tree); |
---|
1553 | IDL_NATIVE (yyval.tree).user_type = yyvsp[0].str; |
---|
1554 | assign_props (IDL_NATIVE (yyval.tree).ident, yyvsp[-5].hash_table); |
---|
1555 | ; |
---|
1556 | break;} |
---|
1557 | case 54: |
---|
1558 | #line 575 "./parser.y" |
---|
1559 | { yyval.tree = IDL_type_dcl_new (yyvsp[-1].tree, yyvsp[0].tree); ; |
---|
1560 | break;} |
---|
1561 | case 63: |
---|
1562 | #line 592 "./parser.y" |
---|
1563 | { |
---|
1564 | yyerrorv ("Missing identifier in %s definition", yyvsp[0].str); |
---|
1565 | YYABORT; |
---|
1566 | ; |
---|
1567 | break;} |
---|
1568 | case 65: |
---|
1569 | #line 599 "./parser.y" |
---|
1570 | { |
---|
1571 | yyerrorv ("Missing identifier in %s definition", yyvsp[0].str); |
---|
1572 | YYABORT; |
---|
1573 | ; |
---|
1574 | break;} |
---|
1575 | case 67: |
---|
1576 | #line 607 "./parser.y" |
---|
1577 | { yyval.str = "struct"; ; |
---|
1578 | break;} |
---|
1579 | case 68: |
---|
1580 | #line 608 "./parser.y" |
---|
1581 | { |
---|
1582 | g_hash_table_insert (__IDL_structunion_ht, yyvsp[-1].tree, yyvsp[-1].tree); |
---|
1583 | yyval.tree = IDL_type_struct_new (yyvsp[-1].tree, NULL); |
---|
1584 | ; |
---|
1585 | break;} |
---|
1586 | case 69: |
---|
1587 | #line 612 "./parser.y" |
---|
1588 | { |
---|
1589 | g_hash_table_remove (__IDL_structunion_ht, yyvsp[-5].tree); |
---|
1590 | yyval.tree = yyvsp[-3].tree; |
---|
1591 | __IDL_assign_up_node (yyval.tree, yyvsp[-2].tree); |
---|
1592 | IDL_TYPE_STRUCT (yyval.tree).member_list = yyvsp[-2].tree; |
---|
1593 | assign_props (IDL_TYPE_STRUCT (yyval.tree).ident, yyvsp[-8].hash_table); |
---|
1594 | ; |
---|
1595 | break;} |
---|
1596 | case 70: |
---|
1597 | #line 622 "./parser.y" |
---|
1598 | { yyval.str = "union"; ; |
---|
1599 | break;} |
---|
1600 | case 71: |
---|
1601 | #line 625 "./parser.y" |
---|
1602 | { |
---|
1603 | g_hash_table_insert (__IDL_structunion_ht, yyvsp[-5].tree, yyvsp[-5].tree); |
---|
1604 | yyval.tree = IDL_type_union_new (yyvsp[-5].tree, yyvsp[-2].tree, NULL); |
---|
1605 | ; |
---|
1606 | break;} |
---|
1607 | case 72: |
---|
1608 | #line 629 "./parser.y" |
---|
1609 | { |
---|
1610 | g_hash_table_remove (__IDL_structunion_ht, yyvsp[-9].tree); |
---|
1611 | yyval.tree = yyvsp[-3].tree; |
---|
1612 | __IDL_assign_up_node (yyval.tree, yyvsp[-2].tree); |
---|
1613 | IDL_TYPE_UNION (yyval.tree).switch_body = yyvsp[-2].tree; |
---|
1614 | assign_props (IDL_TYPE_UNION (yyval.tree).ident, yyvsp[-12].hash_table); |
---|
1615 | ; |
---|
1616 | break;} |
---|
1617 | case 79: |
---|
1618 | #line 648 "./parser.y" |
---|
1619 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
1620 | break;} |
---|
1621 | case 80: |
---|
1622 | #line 649 "./parser.y" |
---|
1623 | { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ; |
---|
1624 | break;} |
---|
1625 | case 81: |
---|
1626 | #line 653 "./parser.y" |
---|
1627 | { yyval.tree = IDL_case_stmt_new (yyvsp[-2].tree, yyvsp[-1].tree); ; |
---|
1628 | break;} |
---|
1629 | case 82: |
---|
1630 | #line 656 "./parser.y" |
---|
1631 | { |
---|
1632 | char *s; |
---|
1633 | |
---|
1634 | yyval.tree = IDL_member_new (yyvsp[-1].tree, list_start (yyvsp[0].tree, TRUE)); |
---|
1635 | if (IDL_NODE_TYPE (yyvsp[-1].tree) == IDLN_IDENT && |
---|
1636 | g_hash_table_lookup (__IDL_structunion_ht, yyvsp[-1].tree)) { |
---|
1637 | s = IDL_ns_ident_to_qstring (yyvsp[0].tree, "::", 0); |
---|
1638 | yyerrorv ("Member `%s'", s); |
---|
1639 | do_token_error (IDL_NODE_UP (yyvsp[-1].tree), "recurses", TRUE); |
---|
1640 | g_free (s); |
---|
1641 | } |
---|
1642 | ; |
---|
1643 | break;} |
---|
1644 | case 83: |
---|
1645 | #line 670 "./parser.y" |
---|
1646 | { yyval.tree = list_start (yyvsp[0].tree, FALSE); ; |
---|
1647 | break;} |
---|
1648 | case 84: |
---|
1649 | #line 671 "./parser.y" |
---|
1650 | { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, FALSE); ; |
---|
1651 | break;} |
---|
1652 | case 85: |
---|
1653 | #line 674 "./parser.y" |
---|
1654 | { yyval.tree = yyvsp[-1].tree; ; |
---|
1655 | break;} |
---|
1656 | case 86: |
---|
1657 | #line 675 "./parser.y" |
---|
1658 | { yyval.tree = NULL; ; |
---|
1659 | break;} |
---|
1660 | case 87: |
---|
1661 | #line 678 "./parser.y" |
---|
1662 | { |
---|
1663 | yyval.tree = yyvsp[0].tree; |
---|
1664 | assign_declspec (yyval.tree, yyvsp[-1].declspec); |
---|
1665 | ; |
---|
1666 | break;} |
---|
1667 | case 88: |
---|
1668 | #line 685 "./parser.y" |
---|
1669 | { |
---|
1670 | yyval.tree = IDL_const_dcl_new (yyvsp[-3].tree, yyvsp[-2].tree, yyvsp[0].tree); |
---|
1671 | /* Should probably do some type checking here... */ |
---|
1672 | ; |
---|
1673 | break;} |
---|
1674 | case 89: |
---|
1675 | #line 691 "./parser.y" |
---|
1676 | { |
---|
1677 | yyval.tree = yyvsp[0].tree; |
---|
1678 | assign_declspec (yyval.tree, yyvsp[-1].declspec); |
---|
1679 | ; |
---|
1680 | break;} |
---|
1681 | case 90: |
---|
1682 | #line 699 "./parser.y" |
---|
1683 | { yyval.tree = IDL_except_dcl_new (yyvsp[-4].tree, yyvsp[-2].tree); ; |
---|
1684 | break;} |
---|
1685 | case 91: |
---|
1686 | #line 702 "./parser.y" |
---|
1687 | { yyval.tree = NULL; ; |
---|
1688 | break;} |
---|
1689 | case 92: |
---|
1690 | #line 703 "./parser.y" |
---|
1691 | { yyval.tree = zlist_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ; |
---|
1692 | break;} |
---|
1693 | case 93: |
---|
1694 | #line 706 "./parser.y" |
---|
1695 | { yyval.boolean = FALSE; ; |
---|
1696 | break;} |
---|
1697 | case 94: |
---|
1698 | #line 707 "./parser.y" |
---|
1699 | { yyval.boolean = TRUE; ; |
---|
1700 | break;} |
---|
1701 | case 95: |
---|
1702 | #line 710 "./parser.y" |
---|
1703 | { |
---|
1704 | yyval.tree = yyvsp[0].tree; |
---|
1705 | assign_declspec (yyval.tree, yyvsp[-1].declspec); |
---|
1706 | ; |
---|
1707 | break;} |
---|
1708 | case 96: |
---|
1709 | #line 719 "./parser.y" |
---|
1710 | { yyval.str = "attribute"; ; |
---|
1711 | break;} |
---|
1712 | case 97: |
---|
1713 | #line 721 "./parser.y" |
---|
1714 | { |
---|
1715 | IDL_tree_node node; |
---|
1716 | IDL_tree p, dcl; |
---|
1717 | |
---|
1718 | yyval.tree = IDL_attr_dcl_new (yyvsp[-4].boolean, yyvsp[-1].tree, yyvsp[0].tree); |
---|
1719 | node.properties = yyvsp[-5].hash_table; |
---|
1720 | for (p = yyvsp[0].tree; p; p = IDL_LIST (p).next) { |
---|
1721 | dcl = IDL_LIST (p).data; |
---|
1722 | IDL_tree_properties_copy (&node, dcl); |
---|
1723 | } |
---|
1724 | __IDL_free_properties (node.properties); |
---|
1725 | ; |
---|
1726 | break;} |
---|
1727 | case 99: |
---|
1728 | #line 736 "./parser.y" |
---|
1729 | { |
---|
1730 | yyerrorv ("Illegal type `void' for %s", yyvsp[-1].str); |
---|
1731 | yyval.tree = NULL; |
---|
1732 | ; |
---|
1733 | break;} |
---|
1734 | case 107: |
---|
1735 | #line 752 "./parser.y" |
---|
1736 | { |
---|
1737 | illegal_context_type_error (yyvsp[0].tree, yyvsp[-1].str); |
---|
1738 | yyval.tree = yyvsp[0].tree; |
---|
1739 | ; |
---|
1740 | break;} |
---|
1741 | case 108: |
---|
1742 | #line 758 "./parser.y" |
---|
1743 | { yyval.boolean = FALSE; ; |
---|
1744 | break;} |
---|
1745 | case 109: |
---|
1746 | #line 759 "./parser.y" |
---|
1747 | { yyval.boolean = TRUE; ; |
---|
1748 | break;} |
---|
1749 | case 110: |
---|
1750 | #line 762 "./parser.y" |
---|
1751 | { |
---|
1752 | yyval.tree = yyvsp[0].tree; |
---|
1753 | assign_declspec (yyval.tree, yyvsp[-1].declspec); |
---|
1754 | ; |
---|
1755 | break;} |
---|
1756 | case 111: |
---|
1757 | #line 773 "./parser.y" |
---|
1758 | { |
---|
1759 | yyval.tree = IDL_op_dcl_new (yyvsp[-6].boolean, yyvsp[-5].tree, yyvsp[-4].tree, yyvsp[-3].treedata.tree, yyvsp[-1].tree, yyvsp[0].tree); |
---|
1760 | IDL_OP_DCL (yyval.tree).f_varargs = GPOINTER_TO_INT (yyvsp[-3].treedata.data); |
---|
1761 | assign_props (IDL_OP_DCL (yyval.tree).ident, yyvsp[-7].hash_table); |
---|
1762 | ; |
---|
1763 | break;} |
---|
1764 | case 112: |
---|
1765 | #line 780 "./parser.y" |
---|
1766 | { yyval.str = "operation return value"; ; |
---|
1767 | break;} |
---|
1768 | case 113: |
---|
1769 | #line 781 "./parser.y" |
---|
1770 | { yyval.tree = yyvsp[0].tree; ; |
---|
1771 | break;} |
---|
1772 | case 114: |
---|
1773 | #line 782 "./parser.y" |
---|
1774 | { yyval.tree = NULL; ; |
---|
1775 | break;} |
---|
1776 | case 115: |
---|
1777 | #line 785 "./parser.y" |
---|
1778 | { yyval.boolean = FALSE; ; |
---|
1779 | break;} |
---|
1780 | case 116: |
---|
1781 | #line 786 "./parser.y" |
---|
1782 | { yyval.boolean = TRUE; ; |
---|
1783 | break;} |
---|
1784 | case 117: |
---|
1785 | #line 789 "./parser.y" |
---|
1786 | { yyval.boolean = FALSE; ; |
---|
1787 | break;} |
---|
1788 | case 118: |
---|
1789 | #line 790 "./parser.y" |
---|
1790 | { yyval.boolean = TRUE; ; |
---|
1791 | break;} |
---|
1792 | case 119: |
---|
1793 | #line 796 "./parser.y" |
---|
1794 | { |
---|
1795 | yyval.treedata.tree = yyvsp[-2].tree; |
---|
1796 | yyval.treedata.data = GINT_TO_POINTER (yyvsp[-1].boolean); |
---|
1797 | ; |
---|
1798 | break;} |
---|
1799 | case 120: |
---|
1800 | #line 800 "./parser.y" |
---|
1801 | { |
---|
1802 | yyval.treedata.tree = NULL; |
---|
1803 | yyval.treedata.data = GINT_TO_POINTER (yyvsp[-1].boolean); |
---|
1804 | ; |
---|
1805 | break;} |
---|
1806 | case 121: |
---|
1807 | #line 806 "./parser.y" |
---|
1808 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
1809 | break;} |
---|
1810 | case 122: |
---|
1811 | #line 808 "./parser.y" |
---|
1812 | { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ; |
---|
1813 | break;} |
---|
1814 | case 123: |
---|
1815 | #line 813 "./parser.y" |
---|
1816 | { yyval.str = "parameter"; ; |
---|
1817 | break;} |
---|
1818 | case 124: |
---|
1819 | #line 815 "./parser.y" |
---|
1820 | { |
---|
1821 | yyval.tree = IDL_param_dcl_new (yyvsp[-3].paramattr, yyvsp[-1].tree, yyvsp[0].tree); |
---|
1822 | assign_props (IDL_PARAM_DCL (yyval.tree).simple_declarator, yyvsp[-4].hash_table); |
---|
1823 | ; |
---|
1824 | break;} |
---|
1825 | case 125: |
---|
1826 | #line 821 "./parser.y" |
---|
1827 | { yyval.paramattr = IDL_PARAM_IN; ; |
---|
1828 | break;} |
---|
1829 | case 126: |
---|
1830 | #line 822 "./parser.y" |
---|
1831 | { yyval.paramattr = IDL_PARAM_OUT; ; |
---|
1832 | break;} |
---|
1833 | case 127: |
---|
1834 | #line 823 "./parser.y" |
---|
1835 | { yyval.paramattr = IDL_PARAM_INOUT; ; |
---|
1836 | break;} |
---|
1837 | case 128: |
---|
1838 | #line 824 "./parser.y" |
---|
1839 | { |
---|
1840 | yyerrorv ("Missing direction attribute (in, out, inout) before parameter"); |
---|
1841 | IDL_tree_free (yyvsp[0].tree); |
---|
1842 | ; |
---|
1843 | break;} |
---|
1844 | case 129: |
---|
1845 | #line 830 "./parser.y" |
---|
1846 | { yyval.tree = NULL; ; |
---|
1847 | break;} |
---|
1848 | case 131: |
---|
1849 | #line 834 "./parser.y" |
---|
1850 | { yyval.tree = NULL; ; |
---|
1851 | break;} |
---|
1852 | case 133: |
---|
1853 | #line 840 "./parser.y" |
---|
1854 | { yyval.tree = yyvsp[-1].tree; ; |
---|
1855 | break;} |
---|
1856 | case 134: |
---|
1857 | #line 845 "./parser.y" |
---|
1858 | { yyval.tree = yyvsp[-1].tree; ; |
---|
1859 | break;} |
---|
1860 | case 146: |
---|
1861 | #line 863 "./parser.y" |
---|
1862 | { do_binop (yyval.tree, IDL_BINOP_OR, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1863 | break;} |
---|
1864 | case 148: |
---|
1865 | #line 867 "./parser.y" |
---|
1866 | { do_binop (yyval.tree, IDL_BINOP_XOR, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1867 | break;} |
---|
1868 | case 150: |
---|
1869 | #line 871 "./parser.y" |
---|
1870 | { do_binop (yyval.tree, IDL_BINOP_AND, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1871 | break;} |
---|
1872 | case 152: |
---|
1873 | #line 875 "./parser.y" |
---|
1874 | { do_binop (yyval.tree, IDL_BINOP_SHR, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1875 | break;} |
---|
1876 | case 153: |
---|
1877 | #line 876 "./parser.y" |
---|
1878 | { do_binop (yyval.tree, IDL_BINOP_SHL, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1879 | break;} |
---|
1880 | case 155: |
---|
1881 | #line 880 "./parser.y" |
---|
1882 | { do_binop (yyval.tree, IDL_BINOP_ADD, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1883 | break;} |
---|
1884 | case 156: |
---|
1885 | #line 881 "./parser.y" |
---|
1886 | { do_binop (yyval.tree, IDL_BINOP_SUB, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1887 | break;} |
---|
1888 | case 158: |
---|
1889 | #line 885 "./parser.y" |
---|
1890 | { do_binop (yyval.tree, IDL_BINOP_MULT, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1891 | break;} |
---|
1892 | case 159: |
---|
1893 | #line 886 "./parser.y" |
---|
1894 | { do_binop (yyval.tree, IDL_BINOP_DIV, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1895 | break;} |
---|
1896 | case 160: |
---|
1897 | #line 887 "./parser.y" |
---|
1898 | { do_binop (yyval.tree, IDL_BINOP_MOD, yyvsp[-2].tree, yyvsp[0].tree); ; |
---|
1899 | break;} |
---|
1900 | case 161: |
---|
1901 | #line 890 "./parser.y" |
---|
1902 | { do_unaryop (yyval.tree, yyvsp[-1].unaryop, yyvsp[0].tree); ; |
---|
1903 | break;} |
---|
1904 | case 163: |
---|
1905 | #line 894 "./parser.y" |
---|
1906 | { yyval.unaryop = IDL_UNARYOP_MINUS; ; |
---|
1907 | break;} |
---|
1908 | case 164: |
---|
1909 | #line 895 "./parser.y" |
---|
1910 | { yyval.unaryop = IDL_UNARYOP_PLUS; ; |
---|
1911 | break;} |
---|
1912 | case 165: |
---|
1913 | #line 896 "./parser.y" |
---|
1914 | { yyval.unaryop = IDL_UNARYOP_COMPLEMENT; ; |
---|
1915 | break;} |
---|
1916 | case 166: |
---|
1917 | #line 899 "./parser.y" |
---|
1918 | { |
---|
1919 | IDL_tree p, literal; |
---|
1920 | |
---|
1921 | assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT); |
---|
1922 | |
---|
1923 | p = IDL_NODE_UP (yyvsp[0].tree); |
---|
1924 | |
---|
1925 | if ((literal = IDL_resolve_const_exp (yyvsp[0].tree, IDLN_ANY))) { |
---|
1926 | ++IDL_NODE_REFS (literal); |
---|
1927 | yyval.tree = literal; |
---|
1928 | IDL_tree_free (yyvsp[0].tree); |
---|
1929 | } else |
---|
1930 | yyval.tree = yyvsp[0].tree; |
---|
1931 | ; |
---|
1932 | break;} |
---|
1933 | case 168: |
---|
1934 | #line 914 "./parser.y" |
---|
1935 | { yyval.tree = yyvsp[-1].tree; ; |
---|
1936 | break;} |
---|
1937 | case 175: |
---|
1938 | #line 926 "./parser.y" |
---|
1939 | { yyval.str = "enum"; ; |
---|
1940 | break;} |
---|
1941 | case 176: |
---|
1942 | #line 929 "./parser.y" |
---|
1943 | { |
---|
1944 | yyval.tree = IDL_type_enum_new (yyvsp[-3].tree, yyvsp[-1].tree); |
---|
1945 | assign_props (IDL_TYPE_ENUM (yyval.tree).ident, yyvsp[-6].hash_table); |
---|
1946 | ; |
---|
1947 | break;} |
---|
1948 | case 177: |
---|
1949 | #line 935 "./parser.y" |
---|
1950 | { |
---|
1951 | assert (yyvsp[0].tree != NULL); |
---|
1952 | assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_GENTREE); |
---|
1953 | assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); |
---|
1954 | yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; |
---|
1955 | ; |
---|
1956 | break;} |
---|
1957 | case 179: |
---|
1958 | #line 944 "./parser.y" |
---|
1959 | { yyval.tree = yyvsp[0].tree; ; |
---|
1960 | break;} |
---|
1961 | case 180: |
---|
1962 | #line 946 "./parser.y" |
---|
1963 | { |
---|
1964 | IDL_tree p; |
---|
1965 | |
---|
1966 | assert (IDL_NODE_TYPE (yyvsp[-2].tree) == IDLN_GENTREE); |
---|
1967 | assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT); |
---|
1968 | |
---|
1969 | #ifdef YYDEBUG |
---|
1970 | if (yydebug) |
---|
1971 | fprintf (stderr, "ns: looking in `%s' for `%s'\n", |
---|
1972 | IDL_IDENT (IDL_GENTREE (yyvsp[-2].tree).data).str, IDL_IDENT(yyvsp[0].tree).str); |
---|
1973 | #endif |
---|
1974 | |
---|
1975 | if ((p = IDL_ns_lookup_this_scope (__IDL_root_ns, yyvsp[-2].tree, yyvsp[0].tree, NULL)) == NULL) { |
---|
1976 | yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str); |
---|
1977 | IDL_tree_free (yyvsp[0].tree); |
---|
1978 | YYABORT; |
---|
1979 | } |
---|
1980 | IDL_tree_free (yyvsp[0].tree); |
---|
1981 | #ifdef REF_IDENTS |
---|
1982 | ++IDL_NODE_REFS (IDL_GENTREE (p).data); |
---|
1983 | #endif |
---|
1984 | yyval.tree = p; |
---|
1985 | ; |
---|
1986 | break;} |
---|
1987 | case 181: |
---|
1988 | #line 971 "./parser.y" |
---|
1989 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
1990 | break;} |
---|
1991 | case 182: |
---|
1992 | #line 973 "./parser.y" |
---|
1993 | { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ; |
---|
1994 | break;} |
---|
1995 | case 183: |
---|
1996 | #line 976 "./parser.y" |
---|
1997 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
1998 | break;} |
---|
1999 | case 184: |
---|
2000 | #line 977 "./parser.y" |
---|
2001 | { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ; |
---|
2002 | break;} |
---|
2003 | case 185: |
---|
2004 | #line 981 "./parser.y" |
---|
2005 | { |
---|
2006 | char *s; |
---|
2007 | |
---|
2008 | yyval.tree = IDL_member_new (yyvsp[-2].tree, yyvsp[-1].tree); |
---|
2009 | if (IDL_NODE_TYPE (yyvsp[-2].tree) == IDLN_IDENT && |
---|
2010 | g_hash_table_lookup (__IDL_structunion_ht, yyvsp[-2].tree)) { |
---|
2011 | s = IDL_ns_ident_to_qstring (IDL_LIST (yyvsp[-1].tree).data, "::", 0); |
---|
2012 | yyerrorv ("Member `%s'", s); |
---|
2013 | do_token_error (IDL_NODE_UP (yyvsp[-2].tree), "recurses", TRUE); |
---|
2014 | g_free (s); |
---|
2015 | } |
---|
2016 | ; |
---|
2017 | break;} |
---|
2018 | case 199: |
---|
2019 | #line 1014 "./parser.y" |
---|
2020 | { yyval.tree = IDL_type_sequence_new (yyvsp[-3].tree, yyvsp[-1].tree); ; |
---|
2021 | break;} |
---|
2022 | case 200: |
---|
2023 | #line 1017 "./parser.y" |
---|
2024 | { yyval.tree = IDL_type_sequence_new (yyvsp[-1].tree, NULL); ; |
---|
2025 | break;} |
---|
2026 | case 201: |
---|
2027 | #line 1020 "./parser.y" |
---|
2028 | { yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_FLOAT); ; |
---|
2029 | break;} |
---|
2030 | case 202: |
---|
2031 | #line 1021 "./parser.y" |
---|
2032 | { yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_DOUBLE); ; |
---|
2033 | break;} |
---|
2034 | case 203: |
---|
2035 | #line 1022 "./parser.y" |
---|
2036 | { yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_LONGDOUBLE); ; |
---|
2037 | break;} |
---|
2038 | case 204: |
---|
2039 | #line 1027 "./parser.y" |
---|
2040 | { yyval.tree = IDL_type_fixed_new (yyvsp[-3].tree, yyvsp[-1].tree); ; |
---|
2041 | break;} |
---|
2042 | case 205: |
---|
2043 | #line 1030 "./parser.y" |
---|
2044 | { yyval.tree = IDL_type_fixed_new (NULL, NULL); ; |
---|
2045 | break;} |
---|
2046 | case 206: |
---|
2047 | #line 1033 "./parser.y" |
---|
2048 | { yyval.tree = IDL_type_integer_new (TRUE, yyvsp[0].integer); ; |
---|
2049 | break;} |
---|
2050 | case 207: |
---|
2051 | #line 1034 "./parser.y" |
---|
2052 | { yyval.tree = IDL_type_integer_new (FALSE, yyvsp[0].integer); ; |
---|
2053 | break;} |
---|
2054 | case 208: |
---|
2055 | #line 1037 "./parser.y" |
---|
2056 | { yyval.integer = IDL_INTEGER_TYPE_SHORT; ; |
---|
2057 | break;} |
---|
2058 | case 209: |
---|
2059 | #line 1038 "./parser.y" |
---|
2060 | { yyval.integer = IDL_INTEGER_TYPE_LONG; ; |
---|
2061 | break;} |
---|
2062 | case 210: |
---|
2063 | #line 1039 "./parser.y" |
---|
2064 | { yyval.integer = IDL_INTEGER_TYPE_LONGLONG; ; |
---|
2065 | break;} |
---|
2066 | case 214: |
---|
2067 | #line 1051 "./parser.y" |
---|
2068 | { yyval.integer = IDL_INTEGER_TYPE_SHORT; ; |
---|
2069 | break;} |
---|
2070 | case 215: |
---|
2071 | #line 1052 "./parser.y" |
---|
2072 | { yyval.integer = IDL_INTEGER_TYPE_LONG; ; |
---|
2073 | break;} |
---|
2074 | case 216: |
---|
2075 | #line 1053 "./parser.y" |
---|
2076 | { yyval.integer = IDL_INTEGER_TYPE_LONGLONG; ; |
---|
2077 | break;} |
---|
2078 | case 220: |
---|
2079 | #line 1065 "./parser.y" |
---|
2080 | { yyval.tree = IDL_type_char_new (); ; |
---|
2081 | break;} |
---|
2082 | case 221: |
---|
2083 | #line 1068 "./parser.y" |
---|
2084 | { yyval.tree = IDL_type_wide_char_new (); ; |
---|
2085 | break;} |
---|
2086 | case 222: |
---|
2087 | #line 1071 "./parser.y" |
---|
2088 | { yyval.tree = IDL_type_boolean_new (); ; |
---|
2089 | break;} |
---|
2090 | case 223: |
---|
2091 | #line 1074 "./parser.y" |
---|
2092 | { yyval.tree = IDL_type_octet_new (); ; |
---|
2093 | break;} |
---|
2094 | case 224: |
---|
2095 | #line 1077 "./parser.y" |
---|
2096 | { yyval.tree = IDL_type_any_new (); ; |
---|
2097 | break;} |
---|
2098 | case 225: |
---|
2099 | #line 1080 "./parser.y" |
---|
2100 | { yyval.tree = IDL_type_object_new (); ; |
---|
2101 | break;} |
---|
2102 | case 226: |
---|
2103 | #line 1083 "./parser.y" |
---|
2104 | { yyval.tree = IDL_type_typecode_new (); ; |
---|
2105 | break;} |
---|
2106 | case 227: |
---|
2107 | #line 1088 "./parser.y" |
---|
2108 | { yyval.tree = IDL_type_string_new (yyvsp[-1].tree); ; |
---|
2109 | break;} |
---|
2110 | case 228: |
---|
2111 | #line 1089 "./parser.y" |
---|
2112 | { yyval.tree = IDL_type_string_new (NULL); ; |
---|
2113 | break;} |
---|
2114 | case 229: |
---|
2115 | #line 1094 "./parser.y" |
---|
2116 | { yyval.tree = IDL_type_wide_string_new (yyvsp[-1].tree); ; |
---|
2117 | break;} |
---|
2118 | case 230: |
---|
2119 | #line 1095 "./parser.y" |
---|
2120 | { yyval.tree = IDL_type_wide_string_new (NULL); ; |
---|
2121 | break;} |
---|
2122 | case 231: |
---|
2123 | #line 1098 "./parser.y" |
---|
2124 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
2125 | break;} |
---|
2126 | case 232: |
---|
2127 | #line 1100 "./parser.y" |
---|
2128 | { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ; |
---|
2129 | break;} |
---|
2130 | case 237: |
---|
2131 | #line 1113 "./parser.y" |
---|
2132 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
2133 | break;} |
---|
2134 | case 238: |
---|
2135 | #line 1115 "./parser.y" |
---|
2136 | { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ; |
---|
2137 | break;} |
---|
2138 | case 239: |
---|
2139 | #line 1119 "./parser.y" |
---|
2140 | { |
---|
2141 | IDL_tree p; |
---|
2142 | int i; |
---|
2143 | |
---|
2144 | yyval.tree = IDL_type_array_new (yyvsp[-1].tree, yyvsp[0].tree); |
---|
2145 | for (i = 1, p = yyvsp[0].tree; p; ++i, p = IDL_LIST (p).next) |
---|
2146 | if (!IDL_LIST (p).data) { |
---|
2147 | char *s = IDL_ns_ident_to_qstring (yyvsp[-1].tree, "::", 0); |
---|
2148 | yyerrorv ("Missing value in dimension %d of array `%s'", i, s); |
---|
2149 | g_free (s); |
---|
2150 | } |
---|
2151 | ; |
---|
2152 | break;} |
---|
2153 | case 240: |
---|
2154 | #line 1133 "./parser.y" |
---|
2155 | { yyval.tree = list_start (yyvsp[0].tree, FALSE); ; |
---|
2156 | break;} |
---|
2157 | case 241: |
---|
2158 | #line 1135 "./parser.y" |
---|
2159 | { yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, FALSE); ; |
---|
2160 | break;} |
---|
2161 | case 242: |
---|
2162 | #line 1138 "./parser.y" |
---|
2163 | { yyval.tree = yyvsp[-1].tree; ; |
---|
2164 | break;} |
---|
2165 | case 243: |
---|
2166 | #line 1139 "./parser.y" |
---|
2167 | { yyval.tree = NULL; ; |
---|
2168 | break;} |
---|
2169 | case 244: |
---|
2170 | #line 1143 "./parser.y" |
---|
2171 | { |
---|
2172 | yyval.hash_table = g_hash_table_new (IDL_strcase_hash, IDL_strcase_equal); |
---|
2173 | g_hash_table_insert (yyval.hash_table, yyvsp[-1].str, yyvsp[0].str); |
---|
2174 | ; |
---|
2175 | break;} |
---|
2176 | case 245: |
---|
2177 | #line 1149 "./parser.y" |
---|
2178 | { |
---|
2179 | yyval.hash_table = yyvsp[-3].hash_table; |
---|
2180 | g_hash_table_insert (yyval.hash_table, yyvsp[-1].str, yyvsp[0].str); |
---|
2181 | ; |
---|
2182 | break;} |
---|
2183 | case 246: |
---|
2184 | #line 1153 "./parser.y" |
---|
2185 | { |
---|
2186 | yyval.hash_table = g_hash_table_new (IDL_strcase_hash, IDL_strcase_equal); |
---|
2187 | g_hash_table_insert (yyval.hash_table, yyvsp[0].str, g_strdup ("")); |
---|
2188 | ; |
---|
2189 | break;} |
---|
2190 | case 247: |
---|
2191 | #line 1158 "./parser.y" |
---|
2192 | { |
---|
2193 | yyval.hash_table = yyvsp[-2].hash_table; |
---|
2194 | g_hash_table_insert (yyval.hash_table, yyvsp[0].str, g_strdup ("")); |
---|
2195 | ; |
---|
2196 | break;} |
---|
2197 | case 248: |
---|
2198 | #line 1164 "./parser.y" |
---|
2199 | { yyval.tree = IDL_ident_new (yyvsp[0].str); ; |
---|
2200 | break;} |
---|
2201 | case 249: |
---|
2202 | #line 1167 "./parser.y" |
---|
2203 | { |
---|
2204 | assert (yyvsp[0].tree != NULL); |
---|
2205 | assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_GENTREE); |
---|
2206 | assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); |
---|
2207 | yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; |
---|
2208 | ; |
---|
2209 | break;} |
---|
2210 | case 250: |
---|
2211 | #line 1175 "./parser.y" |
---|
2212 | { |
---|
2213 | IDL_tree old_top = IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data; |
---|
2214 | IDL_ns_push_scope (__IDL_root_ns, yyvsp[0].tree); |
---|
2215 | #ifdef YYDEBUG |
---|
2216 | if (yydebug) |
---|
2217 | fprintf (stderr, "ns: entering new scope `%s' of `%s'\n", |
---|
2218 | IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str, IDL_IDENT(old_top).str); |
---|
2219 | #endif |
---|
2220 | assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); |
---|
2221 | yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; |
---|
2222 | ; |
---|
2223 | break;} |
---|
2224 | case 251: |
---|
2225 | #line 1188 "./parser.y" |
---|
2226 | { |
---|
2227 | IDL_tree old_top = IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data; |
---|
2228 | IDL_ns_push_scope (__IDL_root_ns, yyvsp[0].tree); |
---|
2229 | assert (IDL_NS (__IDL_root_ns).current != NULL); |
---|
2230 | assert (IDL_NODE_TYPE (IDL_NS (__IDL_root_ns).current) == IDLN_GENTREE); |
---|
2231 | assert (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data != NULL); |
---|
2232 | assert (IDL_NODE_TYPE (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data) == IDLN_IDENT); |
---|
2233 | #ifdef YYDEBUG |
---|
2234 | if (yydebug) |
---|
2235 | fprintf (stderr,"ns: entering new/prev scope `%s' of `%s'\n", |
---|
2236 | IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str, IDL_IDENT(old_top).str); |
---|
2237 | #endif |
---|
2238 | assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT); |
---|
2239 | yyval.tree = IDL_GENTREE (yyvsp[0].tree).data; |
---|
2240 | ; |
---|
2241 | break;} |
---|
2242 | case 252: |
---|
2243 | #line 1205 "./parser.y" |
---|
2244 | { |
---|
2245 | IDL_tree cur_top = IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data; |
---|
2246 | IDL_ns_pop_scope (__IDL_root_ns); |
---|
2247 | #ifdef YYDEBUG |
---|
2248 | if (yydebug) |
---|
2249 | fprintf (stderr, "ns: pop scope from `%s' to `%s'\n", |
---|
2250 | IDL_IDENT(cur_top).str, |
---|
2251 | IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str); |
---|
2252 | #endif |
---|
2253 | ; |
---|
2254 | break;} |
---|
2255 | case 253: |
---|
2256 | #line 1217 "./parser.y" |
---|
2257 | { |
---|
2258 | IDL_tree p; |
---|
2259 | |
---|
2260 | if ((p = IDL_ns_place_new (__IDL_root_ns, yyvsp[0].tree)) == NULL) { |
---|
2261 | IDL_tree q; |
---|
2262 | int i; |
---|
2263 | |
---|
2264 | p = IDL_ns_lookup_cur_scope (__IDL_root_ns, yyvsp[0].tree, NULL); |
---|
2265 | |
---|
2266 | for (i = 0, q = IDL_GENTREE (p).data; |
---|
2267 | q && (IDL_NODE_TYPE (q) == IDLN_IDENT || |
---|
2268 | IDL_NODE_TYPE (q) == IDLN_LIST) && i < 4; |
---|
2269 | ++i) |
---|
2270 | if (IDL_NODE_UP (q)) |
---|
2271 | q = IDL_NODE_UP (q); |
---|
2272 | |
---|
2273 | if (q) { |
---|
2274 | IDL_tree_error (yyvsp[0].tree, "`%s' conflicts", IDL_IDENT (yyvsp[0].tree).str); |
---|
2275 | do_token_error (q, "with", FALSE); |
---|
2276 | } else |
---|
2277 | yyerrorv ("`%s' duplicate identifier", IDL_IDENT (yyvsp[0].tree).str); |
---|
2278 | |
---|
2279 | IDL_tree_free (yyvsp[0].tree); |
---|
2280 | YYABORT; |
---|
2281 | } |
---|
2282 | assert (IDL_IDENT (yyvsp[0].tree)._ns_ref == p); |
---|
2283 | #ifdef REF_IDENTS |
---|
2284 | ++IDL_NODE_REFS (IDL_GENTREE (p).data); |
---|
2285 | #endif |
---|
2286 | if (__IDL_new_ident_comments != NULL) { |
---|
2287 | assert (IDL_IDENT (yyvsp[0].tree).comments == NULL); |
---|
2288 | IDL_IDENT (yyvsp[0].tree).comments = __IDL_new_ident_comments; |
---|
2289 | __IDL_new_ident_comments = NULL; |
---|
2290 | } |
---|
2291 | yyval.tree = p; |
---|
2292 | ; |
---|
2293 | break;} |
---|
2294 | case 254: |
---|
2295 | #line 1255 "./parser.y" |
---|
2296 | { |
---|
2297 | IDL_tree p; |
---|
2298 | |
---|
2299 | if ((p = IDL_ns_resolve_ident (__IDL_root_ns, yyvsp[0].tree)) == NULL) { |
---|
2300 | yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str); |
---|
2301 | IDL_tree_free (yyvsp[0].tree); |
---|
2302 | YYABORT; |
---|
2303 | } |
---|
2304 | IDL_tree_free (yyvsp[0].tree); |
---|
2305 | assert (IDL_GENTREE (p).data != NULL); |
---|
2306 | assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p); |
---|
2307 | #ifdef REF_IDENTS |
---|
2308 | ++IDL_NODE_REFS (IDL_GENTREE (p).data); |
---|
2309 | #endif |
---|
2310 | yyval.tree = p; |
---|
2311 | ; |
---|
2312 | break;} |
---|
2313 | case 255: |
---|
2314 | #line 1274 "./parser.y" |
---|
2315 | { |
---|
2316 | IDL_tree p; |
---|
2317 | |
---|
2318 | if ((p = IDL_ns_lookup_cur_scope (__IDL_root_ns, yyvsp[0].tree, NULL)) == NULL) { |
---|
2319 | #ifdef YYDEBUG |
---|
2320 | if (yydebug) |
---|
2321 | fprintf (stderr, "ns: place_new `%s' in `%s'\n", |
---|
2322 | IDL_IDENT(yyvsp[0].tree).str, |
---|
2323 | IDL_IDENT(IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str ); |
---|
2324 | #endif |
---|
2325 | p = IDL_ns_place_new (__IDL_root_ns, yyvsp[0].tree); |
---|
2326 | assert (p != NULL); |
---|
2327 | assert (IDL_IDENT (yyvsp[0].tree)._ns_ref == p); |
---|
2328 | if (__IDL_new_ident_comments != NULL) { |
---|
2329 | assert (IDL_IDENT (yyvsp[0].tree).comments == NULL); |
---|
2330 | IDL_IDENT (yyvsp[0].tree).comments = __IDL_new_ident_comments; |
---|
2331 | __IDL_new_ident_comments = NULL; |
---|
2332 | } |
---|
2333 | } else { |
---|
2334 | IDL_tree_free (yyvsp[0].tree); |
---|
2335 | assert (IDL_GENTREE (p).data != NULL); |
---|
2336 | assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p); |
---|
2337 | } |
---|
2338 | #ifdef REF_IDENTS |
---|
2339 | ++IDL_NODE_REFS (IDL_GENTREE (p).data); |
---|
2340 | #endif |
---|
2341 | yyval.tree = p; |
---|
2342 | ; |
---|
2343 | break;} |
---|
2344 | case 256: |
---|
2345 | #line 1304 "./parser.y" |
---|
2346 | { |
---|
2347 | IDL_tree p; |
---|
2348 | |
---|
2349 | if ((p = IDL_ns_lookup_this_scope ( |
---|
2350 | __IDL_root_ns,IDL_NS (__IDL_root_ns).file, yyvsp[0].tree, NULL)) == NULL) { |
---|
2351 | yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str); |
---|
2352 | IDL_tree_free (yyvsp[0].tree); |
---|
2353 | YYABORT; |
---|
2354 | } |
---|
2355 | IDL_tree_free (yyvsp[0].tree); |
---|
2356 | assert (IDL_GENTREE (p).data != NULL); |
---|
2357 | assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p); |
---|
2358 | #ifdef REF_IDENTS |
---|
2359 | ++IDL_NODE_REFS (IDL_GENTREE (p).data); |
---|
2360 | #endif |
---|
2361 | yyval.tree = p; |
---|
2362 | ; |
---|
2363 | break;} |
---|
2364 | case 257: |
---|
2365 | #line 1323 "./parser.y" |
---|
2366 | { yyval.tree = list_start (yyvsp[0].tree, TRUE); ; |
---|
2367 | break;} |
---|
2368 | case 258: |
---|
2369 | #line 1325 "./parser.y" |
---|
2370 | { yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ; |
---|
2371 | break;} |
---|
2372 | case 259: |
---|
2373 | #line 1328 "./parser.y" |
---|
2374 | { |
---|
2375 | IDL_tree literal, ident = NULL; |
---|
2376 | IDL_longlong_t value = 0; |
---|
2377 | |
---|
2378 | if ((literal = IDL_resolve_const_exp (yyvsp[0].tree, IDLN_INTEGER))) { |
---|
2379 | assert (IDL_NODE_TYPE (literal) == IDLN_INTEGER); |
---|
2380 | ++IDL_NODE_REFS (literal); |
---|
2381 | value = IDL_INTEGER (literal).value; |
---|
2382 | if ( literal != yyvsp[0].tree ) |
---|
2383 | IDL_tree_free (yyvsp[0].tree); |
---|
2384 | } |
---|
2385 | |
---|
2386 | if (literal && IDL_NODE_UP (literal) && |
---|
2387 | IDL_NODE_TYPE (IDL_NODE_UP (literal)) == IDLN_CONST_DCL) |
---|
2388 | ident = IDL_CONST_DCL (IDL_NODE_UP (literal)).ident; |
---|
2389 | |
---|
2390 | if (literal == NULL) { |
---|
2391 | if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) |
---|
2392 | yyerror ("Could not resolve constant expression"); |
---|
2393 | yyval.tree = yyvsp[0].tree; |
---|
2394 | } else if (value == 0) { |
---|
2395 | yyerror ("Zero array size is illegal"); |
---|
2396 | if (ident) |
---|
2397 | IDL_tree_error (ident, "From constant declared here"); |
---|
2398 | yyval.tree = NULL; |
---|
2399 | } else if (value < 0) { |
---|
2400 | yywarningv (IDL_WARNING1, "Cannot use negative value %" |
---|
2401 | IDL_LL "d, using %" IDL_LL "d", |
---|
2402 | value, -value); |
---|
2403 | if (ident) |
---|
2404 | IDL_tree_warning (ident, |
---|
2405 | IDL_WARNING1, "From constant declared here"); |
---|
2406 | yyval.tree = IDL_integer_new (-value); |
---|
2407 | } |
---|
2408 | else |
---|
2409 | yyval.tree = IDL_integer_new (value); |
---|
2410 | ; |
---|
2411 | break;} |
---|
2412 | case 260: |
---|
2413 | #line 1367 "./parser.y" |
---|
2414 | { yyval.declspec = 0; ; |
---|
2415 | break;} |
---|
2416 | case 261: |
---|
2417 | #line 1368 "./parser.y" |
---|
2418 | { |
---|
2419 | yyval.declspec = IDL_parse_declspec (yyvsp[0].str); |
---|
2420 | g_free (yyvsp[0].str); |
---|
2421 | ; |
---|
2422 | break;} |
---|
2423 | case 262: |
---|
2424 | #line 1374 "./parser.y" |
---|
2425 | { yyval.hash_table = NULL; ; |
---|
2426 | break;} |
---|
2427 | case 263: |
---|
2428 | #line 1375 "./parser.y" |
---|
2429 | { |
---|
2430 | /* Enable property scanning */ |
---|
2431 | if (__IDL_flags & IDLF_PROPERTIES) |
---|
2432 | __IDL_flagsi |= IDLFP_PROPERTIES; |
---|
2433 | else { |
---|
2434 | yyerror ("Property syntax not enabled"); |
---|
2435 | YYABORT; |
---|
2436 | } |
---|
2437 | ; |
---|
2438 | break;} |
---|
2439 | case 264: |
---|
2440 | #line 1384 "./parser.y" |
---|
2441 | { yyval.hash_table = yyvsp[-1].hash_table; ; |
---|
2442 | break;} |
---|
2443 | case 265: |
---|
2444 | #line 1387 "./parser.y" |
---|
2445 | { yyval.tree = IDL_integer_new (yyvsp[0].integer); ; |
---|
2446 | break;} |
---|
2447 | case 266: |
---|
2448 | #line 1390 "./parser.y" |
---|
2449 | { yyval.tree = IDL_string_new (yyvsp[0].str); ; |
---|
2450 | break;} |
---|
2451 | case 267: |
---|
2452 | #line 1393 "./parser.y" |
---|
2453 | { yyval.tree = IDL_char_new (yyvsp[0].str); ; |
---|
2454 | break;} |
---|
2455 | case 268: |
---|
2456 | #line 1396 "./parser.y" |
---|
2457 | { yyval.tree = IDL_fixed_new (yyvsp[0].str); ; |
---|
2458 | break;} |
---|
2459 | case 269: |
---|
2460 | #line 1399 "./parser.y" |
---|
2461 | { yyval.tree = IDL_float_new (yyvsp[0].floatp); ; |
---|
2462 | break;} |
---|
2463 | case 270: |
---|
2464 | #line 1402 "./parser.y" |
---|
2465 | { yyval.tree = IDL_boolean_new (TRUE); ; |
---|
2466 | break;} |
---|
2467 | case 271: |
---|
2468 | #line 1403 "./parser.y" |
---|
2469 | { yyval.tree = IDL_boolean_new (FALSE); ; |
---|
2470 | break;} |
---|
2471 | case 272: |
---|
2472 | #line 1406 "./parser.y" |
---|
2473 | { |
---|
2474 | yyval.tree = yyvsp[0].tree; |
---|
2475 | assign_declspec (yyval.tree, yyvsp[-1].declspec); |
---|
2476 | ; |
---|
2477 | break;} |
---|
2478 | case 273: |
---|
2479 | #line 1412 "./parser.y" |
---|
2480 | { |
---|
2481 | yyval.tree = yyvsp[0].tree; |
---|
2482 | ; |
---|
2483 | break;} |
---|
2484 | case 275: |
---|
2485 | #line 1418 "./parser.y" |
---|
2486 | { |
---|
2487 | char *catstr = g_malloc (strlen (yyvsp[-1].str) + strlen (yyvsp[0].str) + 1); |
---|
2488 | strcpy (catstr, yyvsp[-1].str); g_free (yyvsp[-1].str); |
---|
2489 | strcat (catstr, yyvsp[0].str); g_free (yyvsp[0].str); |
---|
2490 | yyval.str = catstr; |
---|
2491 | ; |
---|
2492 | break;} |
---|
2493 | case 276: |
---|
2494 | #line 1426 "./parser.y" |
---|
2495 | { |
---|
2496 | char *s = IDL_do_escapes (yyvsp[0].str); |
---|
2497 | g_free (yyvsp[0].str); |
---|
2498 | yyval.str = s; |
---|
2499 | ; |
---|
2500 | break;} |
---|
2501 | case 277: |
---|
2502 | #line 1433 "./parser.y" |
---|
2503 | { |
---|
2504 | char *s = IDL_do_escapes (yyvsp[0].str); |
---|
2505 | g_free (yyvsp[0].str); |
---|
2506 | yyval.str = s; |
---|
2507 | ; |
---|
2508 | break;} |
---|
2509 | } |
---|
2510 | /* the action file gets copied in in place of this dollarsign */ |
---|
2511 | #line 543 "/usr/lib/bison.simple" |
---|
2512 | |
---|
2513 | yyvsp -= yylen; |
---|
2514 | yyssp -= yylen; |
---|
2515 | #ifdef YYLSP_NEEDED |
---|
2516 | yylsp -= yylen; |
---|
2517 | #endif |
---|
2518 | |
---|
2519 | #if YYDEBUG != 0 |
---|
2520 | if (yydebug) |
---|
2521 | { |
---|
2522 | short *ssp1 = yyss - 1; |
---|
2523 | fprintf (stderr, "state stack now"); |
---|
2524 | while (ssp1 != yyssp) |
---|
2525 | fprintf (stderr, " %d", *++ssp1); |
---|
2526 | fprintf (stderr, "\n"); |
---|
2527 | } |
---|
2528 | #endif |
---|
2529 | |
---|
2530 | *++yyvsp = yyval; |
---|
2531 | |
---|
2532 | #ifdef YYLSP_NEEDED |
---|
2533 | yylsp++; |
---|
2534 | if (yylen == 0) |
---|
2535 | { |
---|
2536 | yylsp->first_line = yylloc.first_line; |
---|
2537 | yylsp->first_column = yylloc.first_column; |
---|
2538 | yylsp->last_line = (yylsp-1)->last_line; |
---|
2539 | yylsp->last_column = (yylsp-1)->last_column; |
---|
2540 | yylsp->text = 0; |
---|
2541 | } |
---|
2542 | else |
---|
2543 | { |
---|
2544 | yylsp->last_line = (yylsp+yylen-1)->last_line; |
---|
2545 | yylsp->last_column = (yylsp+yylen-1)->last_column; |
---|
2546 | } |
---|
2547 | #endif |
---|
2548 | |
---|
2549 | /* Now "shift" the result of the reduction. |
---|
2550 | Determine what state that goes to, |
---|
2551 | based on the state we popped back to |
---|
2552 | and the rule number reduced by. */ |
---|
2553 | |
---|
2554 | yyn = yyr1[yyn]; |
---|
2555 | |
---|
2556 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
---|
2557 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
---|
2558 | yystate = yytable[yystate]; |
---|
2559 | else |
---|
2560 | yystate = yydefgoto[yyn - YYNTBASE]; |
---|
2561 | |
---|
2562 | goto yynewstate; |
---|
2563 | |
---|
2564 | yyerrlab: /* here on detecting error */ |
---|
2565 | |
---|
2566 | if (! yyerrstatus) |
---|
2567 | /* If not already recovering from an error, report this error. */ |
---|
2568 | { |
---|
2569 | ++yynerrs; |
---|
2570 | |
---|
2571 | #ifdef YYERROR_VERBOSE |
---|
2572 | yyn = yypact[yystate]; |
---|
2573 | |
---|
2574 | if (yyn > YYFLAG && yyn < YYLAST) |
---|
2575 | { |
---|
2576 | int size = 0; |
---|
2577 | char *msg; |
---|
2578 | int x, count; |
---|
2579 | |
---|
2580 | count = 0; |
---|
2581 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ |
---|
2582 | for (x = (yyn < 0 ? -yyn : 0); |
---|
2583 | x < (sizeof(yytname) / sizeof(char *)); x++) |
---|
2584 | if (yycheck[x + yyn] == x) |
---|
2585 | size += strlen(yytname[x]) + 15, count++; |
---|
2586 | msg = (char *) malloc(size + 15); |
---|
2587 | if (msg != 0) |
---|
2588 | { |
---|
2589 | strcpy(msg, "parse error"); |
---|
2590 | |
---|
2591 | if (count < 5) |
---|
2592 | { |
---|
2593 | count = 0; |
---|
2594 | for (x = (yyn < 0 ? -yyn : 0); |
---|
2595 | x < (sizeof(yytname) / sizeof(char *)); x++) |
---|
2596 | if (yycheck[x + yyn] == x) |
---|
2597 | { |
---|
2598 | strcat(msg, count == 0 ? ", expecting `" : " or `"); |
---|
2599 | strcat(msg, yytname[x]); |
---|
2600 | strcat(msg, "'"); |
---|
2601 | count++; |
---|
2602 | } |
---|
2603 | } |
---|
2604 | yyerror(msg); |
---|
2605 | free(msg); |
---|
2606 | } |
---|
2607 | else |
---|
2608 | yyerror ("parse error; also virtual memory exceeded"); |
---|
2609 | } |
---|
2610 | else |
---|
2611 | #endif /* YYERROR_VERBOSE */ |
---|
2612 | yyerror("parse error"); |
---|
2613 | } |
---|
2614 | |
---|
2615 | goto yyerrlab1; |
---|
2616 | yyerrlab1: /* here on error raised explicitly by an action */ |
---|
2617 | |
---|
2618 | if (yyerrstatus == 3) |
---|
2619 | { |
---|
2620 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ |
---|
2621 | |
---|
2622 | /* return failure if at end of input */ |
---|
2623 | if (yychar == YYEOF) |
---|
2624 | YYABORT; |
---|
2625 | |
---|
2626 | #if YYDEBUG != 0 |
---|
2627 | if (yydebug) |
---|
2628 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); |
---|
2629 | #endif |
---|
2630 | |
---|
2631 | yychar = YYEMPTY; |
---|
2632 | } |
---|
2633 | |
---|
2634 | /* Else will try to reuse lookahead token |
---|
2635 | after shifting the error token. */ |
---|
2636 | |
---|
2637 | yyerrstatus = 3; /* Each real token shifted decrements this */ |
---|
2638 | |
---|
2639 | goto yyerrhandle; |
---|
2640 | |
---|
2641 | yyerrdefault: /* current state does not do anything special for the error token. */ |
---|
2642 | |
---|
2643 | #if 0 |
---|
2644 | /* This is wrong; only states that explicitly want error tokens |
---|
2645 | should shift them. */ |
---|
2646 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ |
---|
2647 | if (yyn) goto yydefault; |
---|
2648 | #endif |
---|
2649 | |
---|
2650 | yyerrpop: /* pop the current state because it cannot handle the error token */ |
---|
2651 | |
---|
2652 | if (yyssp == yyss) YYABORT; |
---|
2653 | yyvsp--; |
---|
2654 | yystate = *--yyssp; |
---|
2655 | #ifdef YYLSP_NEEDED |
---|
2656 | yylsp--; |
---|
2657 | #endif |
---|
2658 | |
---|
2659 | #if YYDEBUG != 0 |
---|
2660 | if (yydebug) |
---|
2661 | { |
---|
2662 | short *ssp1 = yyss - 1; |
---|
2663 | fprintf (stderr, "Error: state stack now"); |
---|
2664 | while (ssp1 != yyssp) |
---|
2665 | fprintf (stderr, " %d", *++ssp1); |
---|
2666 | fprintf (stderr, "\n"); |
---|
2667 | } |
---|
2668 | #endif |
---|
2669 | |
---|
2670 | yyerrhandle: |
---|
2671 | |
---|
2672 | yyn = yypact[yystate]; |
---|
2673 | if (yyn == YYFLAG) |
---|
2674 | goto yyerrdefault; |
---|
2675 | |
---|
2676 | yyn += YYTERROR; |
---|
2677 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
---|
2678 | goto yyerrdefault; |
---|
2679 | |
---|
2680 | yyn = yytable[yyn]; |
---|
2681 | if (yyn < 0) |
---|
2682 | { |
---|
2683 | if (yyn == YYFLAG) |
---|
2684 | goto yyerrpop; |
---|
2685 | yyn = -yyn; |
---|
2686 | goto yyreduce; |
---|
2687 | } |
---|
2688 | else if (yyn == 0) |
---|
2689 | goto yyerrpop; |
---|
2690 | |
---|
2691 | if (yyn == YYFINAL) |
---|
2692 | YYACCEPT; |
---|
2693 | |
---|
2694 | #if YYDEBUG != 0 |
---|
2695 | if (yydebug) |
---|
2696 | fprintf(stderr, "Shifting error token, "); |
---|
2697 | #endif |
---|
2698 | |
---|
2699 | *++yyvsp = yylval; |
---|
2700 | #ifdef YYLSP_NEEDED |
---|
2701 | *++yylsp = yylloc; |
---|
2702 | #endif |
---|
2703 | |
---|
2704 | yystate = yyn; |
---|
2705 | goto yynewstate; |
---|
2706 | |
---|
2707 | yyacceptlab: |
---|
2708 | /* YYACCEPT comes here. */ |
---|
2709 | if (yyfree_stacks) |
---|
2710 | { |
---|
2711 | free (yyss); |
---|
2712 | free (yyvs); |
---|
2713 | #ifdef YYLSP_NEEDED |
---|
2714 | free (yyls); |
---|
2715 | #endif |
---|
2716 | } |
---|
2717 | return 0; |
---|
2718 | |
---|
2719 | yyabortlab: |
---|
2720 | /* YYABORT comes here. */ |
---|
2721 | if (yyfree_stacks) |
---|
2722 | { |
---|
2723 | free (yyss); |
---|
2724 | free (yyvs); |
---|
2725 | #ifdef YYLSP_NEEDED |
---|
2726 | free (yyls); |
---|
2727 | #endif |
---|
2728 | } |
---|
2729 | return 1; |
---|
2730 | } |
---|
2731 | #line 1440 "./parser.y" |
---|
2732 | |
---|
2733 | |
---|
2734 | void __IDL_parser_reset (void) |
---|
2735 | { |
---|
2736 | yyclearin; |
---|
2737 | } |
---|
2738 | |
---|
2739 | static const char *IDL_ns_get_cur_prefix (IDL_ns ns) |
---|
2740 | { |
---|
2741 | IDL_tree p; |
---|
2742 | |
---|
2743 | p = IDL_NS (ns).current; |
---|
2744 | |
---|
2745 | assert (p != NULL); |
---|
2746 | |
---|
2747 | while (p && !IDL_GENTREE (p)._cur_prefix) |
---|
2748 | p = IDL_NODE_UP (p); |
---|
2749 | |
---|
2750 | return p ? IDL_GENTREE (p)._cur_prefix : NULL; |
---|
2751 | } |
---|
2752 | |
---|
2753 | gchar *IDL_ns_ident_make_repo_id (IDL_ns ns, IDL_tree p, |
---|
2754 | const char *p_prefix, int *major, int *minor) |
---|
2755 | { |
---|
2756 | GString *s = g_string_new (NULL); |
---|
2757 | const char *prefix; |
---|
2758 | char *q; |
---|
2759 | |
---|
2760 | assert (p != NULL); |
---|
2761 | |
---|
2762 | if (IDL_NODE_TYPE (p) == IDLN_IDENT) |
---|
2763 | p = IDL_IDENT_TO_NS (p); |
---|
2764 | |
---|
2765 | assert (p != NULL); |
---|
2766 | |
---|
2767 | prefix = p_prefix ? p_prefix : IDL_ns_get_cur_prefix (ns); |
---|
2768 | |
---|
2769 | q = IDL_ns_ident_to_qstring (p, "/", 0); |
---|
2770 | g_string_printf (s, "IDL:%s%s%s:%d.%d", |
---|
2771 | prefix ? prefix : "", |
---|
2772 | prefix && *prefix ? "/" : "", |
---|
2773 | q, |
---|
2774 | major ? *major : 1, |
---|
2775 | minor ? *minor : 0); |
---|
2776 | g_free (q); |
---|
2777 | |
---|
2778 | q = s->str; |
---|
2779 | g_string_free (s, FALSE); |
---|
2780 | |
---|
2781 | return q; |
---|
2782 | } |
---|
2783 | |
---|
2784 | static const char *get_name_token (const char *s, char **tok) |
---|
2785 | { |
---|
2786 | const char *begin = s; |
---|
2787 | int state = 0; |
---|
2788 | |
---|
2789 | if (!s) |
---|
2790 | return NULL; |
---|
2791 | |
---|
2792 | while (g_ascii_isspace (*s)) ++s; |
---|
2793 | |
---|
2794 | while (1) switch (state) { |
---|
2795 | case 0: /* Unknown */ |
---|
2796 | if (*s == ':') |
---|
2797 | state = 1; |
---|
2798 | else if (isalnum ((int)*s) || *s == '_') { |
---|
2799 | begin = s; |
---|
2800 | state = 2; |
---|
2801 | } else |
---|
2802 | return NULL; |
---|
2803 | break; |
---|
2804 | case 1: /* Scope */ |
---|
2805 | if (strncmp (s, "::", 2) == 0) { |
---|
2806 | char *r = g_malloc (3); |
---|
2807 | strcpy (r, "::"); |
---|
2808 | *tok = r; |
---|
2809 | return s + 2; |
---|
2810 | } else /* Invalid */ |
---|
2811 | return NULL; |
---|
2812 | break; |
---|
2813 | case 2: |
---|
2814 | if (isalnum ((int)*s) || *s == '_') |
---|
2815 | ++s; |
---|
2816 | else { |
---|
2817 | char *r = g_malloc (s - begin + 1); |
---|
2818 | strncpy (r, begin, s - begin + 1); |
---|
2819 | r[s - begin] = 0; |
---|
2820 | *tok = r; |
---|
2821 | return s; |
---|
2822 | } |
---|
2823 | break; |
---|
2824 | } |
---|
2825 | } |
---|
2826 | |
---|
2827 | static IDL_tree IDL_ns_pragma_parse_name (IDL_ns ns, const char *s) |
---|
2828 | { |
---|
2829 | IDL_tree p = IDL_NS (ns).current, q; |
---|
2830 | int start = 1; |
---|
2831 | char *tok; |
---|
2832 | |
---|
2833 | /* This is a hack to allow directives for an ident (such |
---|
2834 | * as and interface) to be located within the scope of |
---|
2835 | * that identifier. */ |
---|
2836 | if ( p && (q=IDL_GENTREE(p).data)!=0 |
---|
2837 | && IDL_NODE_TYPE(q)==IDLN_IDENT |
---|
2838 | && strcmp(s,IDL_IDENT(q).str)==0 ) { |
---|
2839 | return p; |
---|
2840 | } |
---|
2841 | |
---|
2842 | while (p && *s && (s = get_name_token (s, &tok))) { |
---|
2843 | if (tok == NULL) |
---|
2844 | return NULL; |
---|
2845 | if (strcmp (tok, "::") == 0) { |
---|
2846 | if (start) { |
---|
2847 | /* Globally scoped */ |
---|
2848 | p = IDL_NS (ns).file; |
---|
2849 | } |
---|
2850 | g_free (tok); |
---|
2851 | } else { |
---|
2852 | IDL_tree ident = IDL_ident_new (tok); |
---|
2853 | p = IDL_ns_lookup_this_scope (__IDL_root_ns, p, ident, NULL); |
---|
2854 | IDL_tree_free (ident); |
---|
2855 | } |
---|
2856 | start = 0; |
---|
2857 | } |
---|
2858 | |
---|
2859 | return p; |
---|
2860 | } |
---|
2861 | |
---|
2862 | void IDL_ns_ID (IDL_ns ns, const char *s) |
---|
2863 | { |
---|
2864 | char name[1024], id[1024]; |
---|
2865 | IDL_tree p, ident; |
---|
2866 | int n; |
---|
2867 | |
---|
2868 | n = sscanf (s, "%1023s \"%1023s\"", name, id); |
---|
2869 | if (n < 2 && __IDL_is_parsing) { |
---|
2870 | yywarning (IDL_WARNING1, "Malformed pragma ID"); |
---|
2871 | return; |
---|
2872 | } |
---|
2873 | if (id[strlen (id) - 1] == '"') |
---|
2874 | id[strlen (id) - 1] = 0; |
---|
2875 | |
---|
2876 | p = IDL_ns_pragma_parse_name (__IDL_root_ns, name); |
---|
2877 | if (!p && __IDL_is_parsing) { |
---|
2878 | yywarningv (IDL_WARNING1, "Unknown identifier `%s' in pragma ID", name); |
---|
2879 | return; |
---|
2880 | } |
---|
2881 | |
---|
2882 | /* We have resolved the identifier, so assign the repo id */ |
---|
2883 | assert (IDL_NODE_TYPE (p) == IDLN_GENTREE); |
---|
2884 | assert (IDL_GENTREE (p).data != NULL); |
---|
2885 | assert (IDL_NODE_TYPE (IDL_GENTREE (p).data) == IDLN_IDENT); |
---|
2886 | ident = IDL_GENTREE (p).data; |
---|
2887 | |
---|
2888 | if (IDL_IDENT_REPO_ID (ident) != NULL) |
---|
2889 | g_free (IDL_IDENT_REPO_ID (ident)); |
---|
2890 | |
---|
2891 | IDL_IDENT_REPO_ID (ident) = g_strdup (id); |
---|
2892 | } |
---|
2893 | |
---|
2894 | void IDL_ns_version (IDL_ns ns, const char *s) |
---|
2895 | { |
---|
2896 | char name[1024]; |
---|
2897 | int n, major, minor; |
---|
2898 | IDL_tree p, ident; |
---|
2899 | |
---|
2900 | n = sscanf (s, "%1023s %u.%u", name, &major, &minor); |
---|
2901 | if (n < 3 && __IDL_is_parsing) { |
---|
2902 | yywarning (IDL_WARNING1, "Malformed pragma version"); |
---|
2903 | return; |
---|
2904 | } |
---|
2905 | |
---|
2906 | p = IDL_ns_pragma_parse_name (__IDL_root_ns, name); |
---|
2907 | if (!p && __IDL_is_parsing) { |
---|
2908 | yywarningv (IDL_WARNING1, "Unknown identifier `%s' in pragma version", name); |
---|
2909 | return; |
---|
2910 | } |
---|
2911 | |
---|
2912 | /* We have resolved the identifier, so assign the repo id */ |
---|
2913 | assert (IDL_NODE_TYPE (p) == IDLN_GENTREE); |
---|
2914 | assert (IDL_GENTREE (p).data != NULL); |
---|
2915 | assert (IDL_NODE_TYPE (IDL_GENTREE (p).data) == IDLN_IDENT); |
---|
2916 | ident = IDL_GENTREE (p).data; |
---|
2917 | |
---|
2918 | if (IDL_IDENT_REPO_ID (ident) != NULL) { |
---|
2919 | char *v = strrchr (IDL_IDENT_REPO_ID (ident), ':'); |
---|
2920 | if (v) { |
---|
2921 | GString *s; |
---|
2922 | |
---|
2923 | *v = 0; |
---|
2924 | s = g_string_new (NULL); |
---|
2925 | g_string_printf (s, "%s:%d.%d", |
---|
2926 | IDL_IDENT_REPO_ID (ident), major, minor); |
---|
2927 | g_free (IDL_IDENT_REPO_ID (ident)); |
---|
2928 | IDL_IDENT_REPO_ID (ident) = s->str; |
---|
2929 | g_string_free (s, FALSE); |
---|
2930 | } else if (__IDL_is_parsing) |
---|
2931 | yywarningv (IDL_WARNING1, "Cannot find RepositoryID OMG IDL version in ID `%s'", |
---|
2932 | IDL_IDENT_REPO_ID (ident)); |
---|
2933 | } else |
---|
2934 | IDL_IDENT_REPO_ID (ident) = |
---|
2935 | IDL_ns_ident_make_repo_id ( |
---|
2936 | __IDL_root_ns, p, NULL, &major, &minor); |
---|
2937 | } |
---|
2938 | |
---|
2939 | int IDL_inhibit_get (void) |
---|
2940 | { |
---|
2941 | g_return_val_if_fail (__IDL_is_parsing, -1); |
---|
2942 | |
---|
2943 | return __IDL_inhibits; |
---|
2944 | } |
---|
2945 | |
---|
2946 | void IDL_inhibit_push (void) |
---|
2947 | { |
---|
2948 | g_return_if_fail (__IDL_is_parsing); |
---|
2949 | |
---|
2950 | ++__IDL_inhibits; |
---|
2951 | } |
---|
2952 | |
---|
2953 | void IDL_inhibit_pop (void) |
---|
2954 | { |
---|
2955 | g_return_if_fail (__IDL_is_parsing); |
---|
2956 | |
---|
2957 | if (--__IDL_inhibits < 0) |
---|
2958 | __IDL_inhibits = 0; |
---|
2959 | } |
---|
2960 | |
---|
2961 | static void IDL_inhibit (IDL_ns ns, const char *s) |
---|
2962 | { |
---|
2963 | if (g_ascii_strcasecmp ("push", s) == 0) |
---|
2964 | IDL_inhibit_push (); |
---|
2965 | else if (g_ascii_strcasecmp ("pop", s) == 0) |
---|
2966 | IDL_inhibit_pop (); |
---|
2967 | } |
---|
2968 | |
---|
2969 | static void IDL_typecodes_as_tok (IDL_ns ns, const char *s) |
---|
2970 | { |
---|
2971 | if (g_ascii_strcasecmp ("push", s) == 0) |
---|
2972 | ++(__IDL_typecodes_as_tok); |
---|
2973 | else if (g_ascii_strcasecmp ("pop", s) == 0) |
---|
2974 | --(__IDL_typecodes_as_tok); |
---|
2975 | } |
---|
2976 | |
---|
2977 | static void IDL_pidl (IDL_ns ns, const char *s) |
---|
2978 | { |
---|
2979 | if (g_ascii_strcasecmp ("push", s) == 0) |
---|
2980 | ++(__IDL_pidl); |
---|
2981 | else if (g_ascii_strcasecmp ("pop", s) == 0) |
---|
2982 | --(__IDL_pidl); |
---|
2983 | } |
---|
2984 | |
---|
2985 | void __IDL_do_pragma (const char *s) |
---|
2986 | { |
---|
2987 | int n; |
---|
2988 | char directive[256]; |
---|
2989 | |
---|
2990 | g_return_if_fail (__IDL_is_parsing); |
---|
2991 | g_return_if_fail (s != NULL); |
---|
2992 | |
---|
2993 | if (sscanf (s, "%255s%n", directive, &n) < 1) |
---|
2994 | return; |
---|
2995 | s += n; |
---|
2996 | while (g_ascii_isspace (*s)) ++s; |
---|
2997 | |
---|
2998 | if (strcmp (directive, "prefix") == 0) |
---|
2999 | IDL_ns_prefix (__IDL_root_ns, s); |
---|
3000 | else if (strcmp (directive, "ID") == 0) |
---|
3001 | IDL_ns_ID (__IDL_root_ns, s); |
---|
3002 | else if (strcmp (directive, "version") == 0) |
---|
3003 | IDL_ns_version (__IDL_root_ns, s); |
---|
3004 | else if (strcmp (directive, "inhibit") == 0) |
---|
3005 | IDL_inhibit (__IDL_root_ns, s); |
---|
3006 | else if (strcmp (directive, "typecodes_as_tok") == 0) |
---|
3007 | IDL_typecodes_as_tok (__IDL_root_ns, s); |
---|
3008 | else if (strcmp (directive, "pidl") == 0) |
---|
3009 | IDL_pidl (__IDL_root_ns, s); |
---|
3010 | } |
---|
3011 | |
---|
3012 | static IDL_declspec_t IDL_parse_declspec (const char *strspec) |
---|
3013 | { |
---|
3014 | IDL_declspec_t flags = IDLF_DECLSPEC_EXIST; |
---|
3015 | |
---|
3016 | if (strspec == NULL) |
---|
3017 | return flags; |
---|
3018 | |
---|
3019 | if (strcmp (strspec, "inhibit") == 0) |
---|
3020 | flags |= IDLF_DECLSPEC_INHIBIT; |
---|
3021 | if (strcmp (strspec, "pidl") == 0) |
---|
3022 | flags |= IDLF_DECLSPEC_PIDL; |
---|
3023 | else if (__IDL_is_parsing) |
---|
3024 | yywarningv (IDL_WARNING1, "Ignoring unknown declspec `%s'", strspec); |
---|
3025 | |
---|
3026 | return flags; |
---|
3027 | } |
---|
3028 | |
---|
3029 | IDL_tree IDL_file_set (const char *filename, int line) |
---|
3030 | { |
---|
3031 | IDL_fileinfo *fi; |
---|
3032 | IDL_tree tree = NULL; |
---|
3033 | |
---|
3034 | g_return_val_if_fail (__IDL_is_parsing, 0); |
---|
3035 | |
---|
3036 | if (filename) { |
---|
3037 | const char *oldfilename = __IDL_cur_filename; |
---|
3038 | gboolean wasInhibit = IS_INHIBIT_STATE(); |
---|
3039 | gboolean isTop = |
---|
3040 | #ifdef HAVE_CPP_PIPE_STDIN |
---|
3041 | strlen (filename)==0; |
---|
3042 | #else |
---|
3043 | __IDL_tmp_filename && |
---|
3044 | strcmp (filename, __IDL_tmp_filename)==0; |
---|
3045 | #endif |
---|
3046 | if ( isTop ) { |
---|
3047 | filename = __IDL_real_filename; |
---|
3048 | __IDL_flagsi &= ~IDLFP_IN_INCLUDES; |
---|
3049 | } else { |
---|
3050 | __IDL_flagsi |= IDLFP_IN_INCLUDES; |
---|
3051 | } |
---|
3052 | |
---|
3053 | if ((fi=g_hash_table_lookup(__IDL_filename_hash, filename)) ) { |
---|
3054 | __IDL_cur_fileinfo = fi; |
---|
3055 | ++(fi->seenCnt); |
---|
3056 | } else { |
---|
3057 | fi = g_new0 (IDL_fileinfo, 1); |
---|
3058 | fi->name = g_strdup(filename); |
---|
3059 | g_hash_table_insert (__IDL_filename_hash, fi->name, fi); |
---|
3060 | } |
---|
3061 | __IDL_cur_fileinfo = fi; |
---|
3062 | __IDL_cur_filename = fi->name; |
---|
3063 | if ( (__IDL_flags & IDLF_SRCFILES)!=0 |
---|
3064 | && (oldfilename==0 |
---|
3065 | || strcmp(oldfilename,fi->name)!=0) ) { |
---|
3066 | tree = IDL_srcfile_new(fi->name, fi->seenCnt, isTop, wasInhibit); |
---|
3067 | } |
---|
3068 | } |
---|
3069 | |
---|
3070 | if (__IDL_cur_line > 0) |
---|
3071 | __IDL_cur_line = line; |
---|
3072 | return tree; |
---|
3073 | } |
---|
3074 | |
---|
3075 | void IDL_file_get (const char **filename, int *line) |
---|
3076 | { |
---|
3077 | g_return_if_fail (__IDL_is_parsing); |
---|
3078 | |
---|
3079 | if (filename) |
---|
3080 | *filename = __IDL_cur_filename; |
---|
3081 | |
---|
3082 | if (line) |
---|
3083 | *line = __IDL_cur_line; |
---|
3084 | } |
---|
3085 | |
---|
3086 | static int do_token_error (IDL_tree p, const char *message, gboolean prev) |
---|
3087 | { |
---|
3088 | int dienow; |
---|
3089 | char *what = NULL, *who = NULL; |
---|
3090 | |
---|
3091 | assert (p != NULL); |
---|
3092 | |
---|
3093 | dienow = IDL_tree_get_node_info (p, &what, &who); |
---|
3094 | |
---|
3095 | assert (what != NULL); |
---|
3096 | |
---|
3097 | if (who && *who) |
---|
3098 | IDL_tree_error (p, "%s %s `%s'", message, what, who); |
---|
3099 | else |
---|
3100 | IDL_tree_error (p, "%s %s", message, what); |
---|
3101 | |
---|
3102 | return dienow; |
---|
3103 | } |
---|
3104 | |
---|
3105 | static void illegal_context_type_error (IDL_tree p, const char *what) |
---|
3106 | { |
---|
3107 | GString *s = g_string_new (NULL); |
---|
3108 | |
---|
3109 | g_string_printf (s, "Illegal type `%%s' for %s", what); |
---|
3110 | illegal_type_error (p, s->str); |
---|
3111 | g_string_free (s, TRUE); |
---|
3112 | } |
---|
3113 | |
---|
3114 | static void illegal_type_error (IDL_tree p, const char *message) |
---|
3115 | { |
---|
3116 | GString *s; |
---|
3117 | |
---|
3118 | s = IDL_tree_to_IDL_string (p, NULL, IDLF_OUTPUT_NO_NEWLINES); |
---|
3119 | yyerrorv (message, s->str); |
---|
3120 | g_string_free (s, TRUE); |
---|
3121 | } |
---|
3122 | |
---|
3123 | static IDL_tree list_start (IDL_tree a, gboolean filter_null) |
---|
3124 | { |
---|
3125 | IDL_tree p; |
---|
3126 | |
---|
3127 | if (!a && filter_null) |
---|
3128 | return NULL; |
---|
3129 | |
---|
3130 | p = IDL_list_new (a); |
---|
3131 | |
---|
3132 | return p; |
---|
3133 | } |
---|
3134 | |
---|
3135 | static IDL_tree list_chain (IDL_tree a, IDL_tree b, gboolean filter_null) |
---|
3136 | { |
---|
3137 | IDL_tree p; |
---|
3138 | |
---|
3139 | if (filter_null) { |
---|
3140 | if (!b) |
---|
3141 | return a; |
---|
3142 | if (!a) |
---|
3143 | return list_start (b, filter_null); |
---|
3144 | } |
---|
3145 | |
---|
3146 | p = IDL_list_new (b); |
---|
3147 | a = IDL_list_concat (a, p); |
---|
3148 | |
---|
3149 | return a; |
---|
3150 | } |
---|
3151 | |
---|
3152 | static IDL_tree zlist_chain (IDL_tree a, IDL_tree b, gboolean filter_null) |
---|
3153 | { |
---|
3154 | if (a == NULL) |
---|
3155 | return list_start (b, filter_null); |
---|
3156 | else |
---|
3157 | return list_chain (a, b, filter_null); |
---|
3158 | } |
---|
3159 | |
---|
3160 | static int IDL_binop_chktypes (enum IDL_binop op, IDL_tree a, IDL_tree b) |
---|
3161 | { |
---|
3162 | if (IDL_NODE_TYPE (a) != IDLN_BINOP && |
---|
3163 | IDL_NODE_TYPE (b) != IDLN_BINOP && |
---|
3164 | IDL_NODE_TYPE (a) != IDLN_UNARYOP && |
---|
3165 | IDL_NODE_TYPE (b) != IDLN_UNARYOP && |
---|
3166 | IDL_NODE_TYPE (a) != IDL_NODE_TYPE (b)) { |
---|
3167 | yyerror ("Invalid mix of types in constant expression"); |
---|
3168 | return -1; |
---|
3169 | } |
---|
3170 | |
---|
3171 | switch (op) { |
---|
3172 | case IDL_BINOP_MULT: |
---|
3173 | case IDL_BINOP_DIV: |
---|
3174 | case IDL_BINOP_ADD: |
---|
3175 | case IDL_BINOP_SUB: |
---|
3176 | break; |
---|
3177 | |
---|
3178 | case IDL_BINOP_MOD: |
---|
3179 | case IDL_BINOP_SHR: |
---|
3180 | case IDL_BINOP_SHL: |
---|
3181 | case IDL_BINOP_AND: |
---|
3182 | case IDL_BINOP_OR: |
---|
3183 | case IDL_BINOP_XOR: |
---|
3184 | if ((IDL_NODE_TYPE (a) != IDLN_INTEGER || |
---|
3185 | IDL_NODE_TYPE (b) != IDLN_INTEGER) && |
---|
3186 | !(IDL_NODE_TYPE (a) == IDLN_BINOP || |
---|
3187 | IDL_NODE_TYPE (b) == IDLN_BINOP || |
---|
3188 | IDL_NODE_TYPE (a) == IDLN_UNARYOP || |
---|
3189 | IDL_NODE_TYPE (b) == IDLN_UNARYOP)) { |
---|
3190 | yyerror ("Invalid operation on non-integer value"); |
---|
3191 | return -1; |
---|
3192 | } |
---|
3193 | break; |
---|
3194 | } |
---|
3195 | |
---|
3196 | return 0; |
---|
3197 | } |
---|
3198 | |
---|
3199 | static int IDL_unaryop_chktypes (enum IDL_unaryop op, IDL_tree a) |
---|
3200 | { |
---|
3201 | switch (op) { |
---|
3202 | case IDL_UNARYOP_PLUS: |
---|
3203 | case IDL_UNARYOP_MINUS: |
---|
3204 | break; |
---|
3205 | |
---|
3206 | case IDL_UNARYOP_COMPLEMENT: |
---|
3207 | if (IDL_NODE_TYPE (a) != IDLN_INTEGER && |
---|
3208 | !(IDL_NODE_TYPE (a) == IDLN_BINOP || |
---|
3209 | IDL_NODE_TYPE (a) == IDLN_UNARYOP)) { |
---|
3210 | yyerror ("Operand to complement must be integer"); |
---|
3211 | return -1; |
---|
3212 | } |
---|
3213 | break; |
---|
3214 | } |
---|
3215 | |
---|
3216 | return 0; |
---|
3217 | } |
---|
3218 | |
---|
3219 | static IDL_tree IDL_binop_eval_integer (enum IDL_binop op, IDL_tree a, IDL_tree b) |
---|
3220 | { |
---|
3221 | IDL_tree p = NULL; |
---|
3222 | |
---|
3223 | assert (IDL_NODE_TYPE (a) == IDLN_INTEGER); |
---|
3224 | |
---|
3225 | switch (op) { |
---|
3226 | case IDL_BINOP_MULT: |
---|
3227 | p = IDL_integer_new (IDL_INTEGER (a).value * IDL_INTEGER (b).value); |
---|
3228 | break; |
---|
3229 | |
---|
3230 | case IDL_BINOP_DIV: |
---|
3231 | if (IDL_INTEGER (b).value == 0) { |
---|
3232 | yyerror ("Divide by zero in constant expression"); |
---|
3233 | return NULL; |
---|
3234 | } |
---|
3235 | p = IDL_integer_new (IDL_INTEGER (a).value / IDL_INTEGER (b).value); |
---|
3236 | break; |
---|
3237 | |
---|
3238 | case IDL_BINOP_ADD: |
---|
3239 | p = IDL_integer_new (IDL_INTEGER (a).value + IDL_INTEGER (b).value); |
---|
3240 | break; |
---|
3241 | |
---|
3242 | case IDL_BINOP_SUB: |
---|
3243 | p = IDL_integer_new (IDL_INTEGER (a).value - IDL_INTEGER (b).value); |
---|
3244 | break; |
---|
3245 | |
---|
3246 | case IDL_BINOP_MOD: |
---|
3247 | if (IDL_INTEGER (b).value == 0) { |
---|
3248 | yyerror ("Modulo by zero in constant expression"); |
---|
3249 | return NULL; |
---|
3250 | } |
---|
3251 | p = IDL_integer_new (IDL_INTEGER (a).value % IDL_INTEGER (b).value); |
---|
3252 | break; |
---|
3253 | |
---|
3254 | case IDL_BINOP_SHR: |
---|
3255 | p = IDL_integer_new (IDL_INTEGER (a).value >> IDL_INTEGER (b).value); |
---|
3256 | break; |
---|
3257 | |
---|
3258 | case IDL_BINOP_SHL: |
---|
3259 | p = IDL_integer_new (IDL_INTEGER (a).value << IDL_INTEGER (b).value); |
---|
3260 | break; |
---|
3261 | |
---|
3262 | case IDL_BINOP_AND: |
---|
3263 | p = IDL_integer_new (IDL_INTEGER (a).value & IDL_INTEGER (b).value); |
---|
3264 | break; |
---|
3265 | |
---|
3266 | case IDL_BINOP_OR: |
---|
3267 | p = IDL_integer_new (IDL_INTEGER (a).value | IDL_INTEGER (b).value); |
---|
3268 | break; |
---|
3269 | |
---|
3270 | case IDL_BINOP_XOR: |
---|
3271 | p = IDL_integer_new (IDL_INTEGER (a).value ^ IDL_INTEGER (b).value); |
---|
3272 | break; |
---|
3273 | } |
---|
3274 | |
---|
3275 | return p; |
---|
3276 | } |
---|
3277 | |
---|
3278 | static IDL_tree IDL_binop_eval_float (enum IDL_binop op, IDL_tree a, IDL_tree b) |
---|
3279 | { |
---|
3280 | IDL_tree p = NULL; |
---|
3281 | |
---|
3282 | assert (IDL_NODE_TYPE (a) == IDLN_FLOAT); |
---|
3283 | |
---|
3284 | switch (op) { |
---|
3285 | case IDL_BINOP_MULT: |
---|
3286 | p = IDL_float_new (IDL_FLOAT (a).value * IDL_FLOAT (b).value); |
---|
3287 | break; |
---|
3288 | |
---|
3289 | case IDL_BINOP_DIV: |
---|
3290 | if (IDL_FLOAT (b).value == 0.0) { |
---|
3291 | yyerror ("Divide by zero in constant expression"); |
---|
3292 | return NULL; |
---|
3293 | } |
---|
3294 | p = IDL_float_new (IDL_FLOAT (a).value / IDL_FLOAT (b).value); |
---|
3295 | break; |
---|
3296 | |
---|
3297 | case IDL_BINOP_ADD: |
---|
3298 | p = IDL_float_new (IDL_FLOAT (a).value + IDL_FLOAT (b).value); |
---|
3299 | break; |
---|
3300 | |
---|
3301 | case IDL_BINOP_SUB: |
---|
3302 | p = IDL_float_new (IDL_FLOAT (a).value - IDL_FLOAT (b).value); |
---|
3303 | break; |
---|
3304 | |
---|
3305 | default: |
---|
3306 | break; |
---|
3307 | } |
---|
3308 | |
---|
3309 | return p; |
---|
3310 | } |
---|
3311 | |
---|
3312 | static IDL_tree IDL_binop_eval (enum IDL_binop op, IDL_tree a, IDL_tree b) |
---|
3313 | { |
---|
3314 | assert (IDL_NODE_TYPE (a) == IDL_NODE_TYPE (b)); |
---|
3315 | |
---|
3316 | switch (IDL_NODE_TYPE (a)) { |
---|
3317 | case IDLN_INTEGER: return IDL_binop_eval_integer (op, a, b); |
---|
3318 | case IDLN_FLOAT: return IDL_binop_eval_float (op, a, b); |
---|
3319 | default: return NULL; |
---|
3320 | } |
---|
3321 | } |
---|
3322 | |
---|
3323 | static IDL_tree IDL_unaryop_eval_integer (enum IDL_unaryop op, IDL_tree a) |
---|
3324 | { |
---|
3325 | IDL_tree p = NULL; |
---|
3326 | |
---|
3327 | assert (IDL_NODE_TYPE (a) == IDLN_INTEGER); |
---|
3328 | |
---|
3329 | switch (op) { |
---|
3330 | case IDL_UNARYOP_PLUS: |
---|
3331 | p = IDL_integer_new (IDL_INTEGER (a).value); |
---|
3332 | break; |
---|
3333 | |
---|
3334 | case IDL_UNARYOP_MINUS: |
---|
3335 | p = IDL_integer_new (-IDL_INTEGER (a).value); |
---|
3336 | break; |
---|
3337 | |
---|
3338 | case IDL_UNARYOP_COMPLEMENT: |
---|
3339 | p = IDL_integer_new (~IDL_INTEGER (a).value); |
---|
3340 | break; |
---|
3341 | } |
---|
3342 | |
---|
3343 | return p; |
---|
3344 | } |
---|
3345 | |
---|
3346 | static IDL_tree IDL_unaryop_eval_fixed (enum IDL_unaryop op, IDL_tree a) |
---|
3347 | { |
---|
3348 | IDL_tree p = NULL; |
---|
3349 | |
---|
3350 | assert (IDL_NODE_TYPE (a) == IDLN_FIXED); |
---|
3351 | |
---|
3352 | switch (op) { |
---|
3353 | case IDL_UNARYOP_PLUS: |
---|
3354 | p = IDL_fixed_new (IDL_FIXED (a).value); |
---|
3355 | break; |
---|
3356 | |
---|
3357 | default: |
---|
3358 | break; |
---|
3359 | } |
---|
3360 | |
---|
3361 | return p; |
---|
3362 | } |
---|
3363 | |
---|
3364 | static IDL_tree IDL_unaryop_eval_float (enum IDL_unaryop op, IDL_tree a) |
---|
3365 | { |
---|
3366 | IDL_tree p = NULL; |
---|
3367 | |
---|
3368 | assert (IDL_NODE_TYPE (a) == IDLN_FLOAT); |
---|
3369 | |
---|
3370 | switch (op) { |
---|
3371 | case IDL_UNARYOP_PLUS: |
---|
3372 | p = IDL_float_new (IDL_FLOAT (a).value); |
---|
3373 | break; |
---|
3374 | |
---|
3375 | case IDL_UNARYOP_MINUS: |
---|
3376 | p = IDL_float_new (-IDL_FLOAT (a).value); |
---|
3377 | break; |
---|
3378 | |
---|
3379 | default: |
---|
3380 | break; |
---|
3381 | } |
---|
3382 | |
---|
3383 | return p; |
---|
3384 | } |
---|
3385 | |
---|
3386 | static IDL_tree IDL_unaryop_eval (enum IDL_unaryop op, IDL_tree a) |
---|
3387 | { |
---|
3388 | switch (IDL_NODE_TYPE (a)) { |
---|
3389 | case IDLN_INTEGER: return IDL_unaryop_eval_integer (op, a); |
---|
3390 | case IDLN_FIXED: return IDL_unaryop_eval_fixed (op, a); |
---|
3391 | case IDLN_FLOAT: return IDL_unaryop_eval_float (op, a); |
---|
3392 | default: return NULL; |
---|
3393 | } |
---|
3394 | } |
---|
3395 | |
---|
3396 | IDL_tree IDL_resolve_const_exp (IDL_tree p, IDL_tree_type type) |
---|
3397 | { |
---|
3398 | gboolean resolved_value = FALSE, die = FALSE; |
---|
3399 | gboolean wrong_type = FALSE; |
---|
3400 | |
---|
3401 | while (!resolved_value && !die) { |
---|
3402 | if (IDL_NODE_TYPE (p) == IDLN_IDENT) { |
---|
3403 | IDL_tree q = IDL_NODE_UP (p); |
---|
3404 | |
---|
3405 | assert (q != NULL); |
---|
3406 | if (IDL_NODE_UP (q) && |
---|
3407 | IDL_NODE_TYPE (IDL_NODE_UP (q)) == IDLN_TYPE_ENUM) { |
---|
3408 | p = q; |
---|
3409 | die = TRUE; |
---|
3410 | break; |
---|
3411 | } else if (IDL_NODE_TYPE (q) != IDLN_CONST_DCL) { |
---|
3412 | p = q; |
---|
3413 | wrong_type = TRUE; |
---|
3414 | die = TRUE; |
---|
3415 | } else |
---|
3416 | p = IDL_CONST_DCL (q).const_exp; |
---|
3417 | } |
---|
3418 | |
---|
3419 | if (p == NULL || |
---|
3420 | IDL_NODE_TYPE (p) == IDLN_BINOP || |
---|
3421 | IDL_NODE_TYPE (p) == IDLN_UNARYOP) { |
---|
3422 | die = TRUE; |
---|
3423 | continue; |
---|
3424 | } |
---|
3425 | |
---|
3426 | resolved_value = IDL_NODE_IS_LITERAL (p); |
---|
3427 | } |
---|
3428 | |
---|
3429 | if (resolved_value && |
---|
3430 | type != IDLN_ANY && |
---|
3431 | IDL_NODE_TYPE (p) != type) |
---|
3432 | wrong_type = TRUE; |
---|
3433 | |
---|
3434 | if (wrong_type) { |
---|
3435 | yyerror ("Invalid type for constant"); |
---|
3436 | IDL_tree_error (p, "Previous resolved type declaration"); |
---|
3437 | return NULL; |
---|
3438 | } |
---|
3439 | |
---|
3440 | return resolved_value ? p : NULL; |
---|
3441 | } |
---|
3442 | |
---|
3443 | void IDL_queue_new_ident_comment (const char *str) |
---|
3444 | { |
---|
3445 | g_return_if_fail (str != NULL); |
---|
3446 | |
---|
3447 | __IDL_new_ident_comments = g_slist_append (__IDL_new_ident_comments, g_strdup (str)); |
---|
3448 | } |
---|
3449 | |
---|
3450 | /* |
---|
3451 | * Local variables: |
---|
3452 | * mode: C |
---|
3453 | * c-basic-offset: 8 |
---|
3454 | * tab-width: 8 |
---|
3455 | * indent-tabs-mode: t |
---|
3456 | * End: |
---|
3457 | */ |
---|