2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
58 static GList *class_nodes = NULL;
61 static GList *typestack = NULL;
63 static GList *funcargs = NULL;
64 static GList *checks = NULL;
65 static int has_self = FALSE;
66 static int vararg = FALSE;
68 /* destructor and initializer for variables */
69 static char *destructor = NULL;
70 static int destructor_line = 0;
71 static gboolean destructor_simple = TRUE;
72 static char *initializer = NULL;
73 static int initializer_line = 0;
75 static GList *gtktypes = NULL;
77 /* this can be a global as we will only do one function at a time
79 static int the_scope = NO_SCOPE;
84 extern int ccode_line;
95 if(strcmp(yytext,"\n")==0) {
96 out=g_strconcat("Error: ",str," before newline",NULL);
97 } else if(yytext[0]=='\0') {
98 out=g_strconcat("Error: ",str," at end of input",NULL);
100 char *tmp = g_strdup(yytext);
101 while((p=strchr(tmp,'\n')))
104 out=g_strconcat("Error: ",str," before '",tmp,"'",NULL);
108 fprintf(stderr,"%s:%d: %s\n",filename,line_no,out);
117 Type *type = typestack->data;
118 typestack = g_list_remove(typestack,typestack->data);
123 push_variable(char *name, int scope, int line_no, char *postfix)
126 Type *type = pop_type();
128 type->postfix = postfix;
130 var = new_variable(scope, type, name, line_no,
131 destructor, destructor_line,
133 initializer, initializer_line);
134 class_nodes = g_list_append(class_nodes, var);
138 push_function(int scope, int method, char *oid, char *id, char *onerror,
139 GString *cbuf, int line_no, int ccode_line, gboolean vararg,
146 if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) {
149 type = (Type *)new_type(0,g_strdup("void"),NULL);
152 /* a complicated and ugly test to figure out if we have
153 the wrong number of types for a signal */
154 if((method == SIGNAL_FIRST_METHOD ||
155 method == SIGNAL_LAST_METHOD) &&
156 g_list_length(gtktypes) != g_list_length(funcargs) &&
157 !(g_list_length(funcargs) == 1 &&
158 g_list_length(gtktypes) == 2 &&
159 strcmp(gtktypes->next->data,"NONE")==0)) {
160 print_error(TRUE, _("The number of GTK arguments and "
161 "function arguments for a signal "
162 "don't seem to match"),line_no);
166 c_cbuf = p = cbuf->str;
167 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
174 node = new_method(scope, method, type, oid, gtktypes, flags,
175 id, funcargs, onerror, c_cbuf, line_no,
180 /*only free segment if we haven't passed it
186 class_nodes = g_list_append(class_nodes, node);
190 push_funcarg(char *name, char *postfix)
193 Type *type = pop_type();
195 type->postfix = postfix;
197 node = new_funcarg(type,name,checks);
200 funcargs = g_list_append(funcargs, node);
204 push_init_arg(char *name, int is_class)
211 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
213 tn = g_strdup(((Class *)class)->otype);
215 type = new_type(1,tn,NULL);
216 node = new_funcarg((Type *)type,name,NULL);
217 funcargs = g_list_prepend(funcargs, node);
226 type = new_type(1,g_strdup(((Class *)class)->otype),NULL);
227 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
228 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
229 node = new_funcarg((Type *)type,id,ch);
230 funcargs = g_list_prepend(funcargs, node);
234 find_var_or_die(const char *id, int line)
239 for(li = class_nodes; li != NULL; li = li->next) {
241 Node *node = li->data;
242 if(node->type != VARIABLE_NODE)
245 if(strcmp(var->id, id)==0)
249 s = g_strdup_printf(_("Variable %s not defined here"), id);
250 print_error(FALSE, s, line);
252 g_assert_not_reached();
280 #define YYFLAG -32768
283 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 86)
285 static const char yytranslate[] = { 0,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289 2, 2, 48, 2, 2, 2, 2, 2, 2, 41,
290 42, 44, 2, 45, 49, 2, 2, 2, 2, 2,
291 2, 2, 2, 2, 2, 2, 2, 2, 39, 47,
292 40, 46, 2, 2, 2, 2, 2, 2, 2, 2,
293 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
294 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
295 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
298 2, 2, 37, 43, 38, 2, 2, 2, 2, 2,
299 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
300 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
301 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
302 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
303 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
304 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
305 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
306 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
307 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
308 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
309 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
310 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
311 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
312 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
313 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
314 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
318 static const short yyprhs[] = { 0,
319 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
320 24, 27, 29, 34, 38, 43, 46, 48, 50, 52,
321 54, 56, 58, 60, 62, 65, 69, 72, 76, 79,
322 82, 84, 86, 87, 93, 100, 112, 121, 127, 133,
323 135, 139, 140, 144, 146, 148, 151, 153, 156, 159,
324 162, 164, 167, 170, 172, 174, 176, 178, 181, 183,
325 185, 188, 190, 193, 195, 197, 199, 201, 203, 206,
326 208, 211, 213, 217, 221, 224, 226, 231, 235, 237,
327 240, 242, 253, 265, 275, 285, 294, 306, 315, 321,
328 324, 328, 329, 331, 333, 337, 339, 343, 345, 349,
329 351, 354, 358, 365, 373, 376, 378, 380, 383, 386,
330 390, 394, 398, 402, 404, 407
333 static const short yyrhs[] = { 52,
334 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
335 0, 24, 0, 27, 0, 25, 0, 26, 0, 28,
336 0, 29, 0, 52, 51, 0, 51, 0, 54, 37,
337 55, 38, 0, 54, 37, 38, 0, 3, 22, 4,
338 22, 0, 55, 56, 0, 56, 0, 77, 0, 61,
339 0, 62, 0, 39, 0, 30, 0, 31, 0, 32,
340 0, 20, 20, 0, 20, 37, 24, 0, 40, 85,
341 0, 40, 37, 24, 0, 58, 59, 0, 59, 58,
342 0, 59, 0, 58, 0, 0, 57, 66, 20, 60,
343 39, 0, 57, 66, 20, 23, 60, 39, 0, 33,
344 64, 63, 20, 20, 37, 24, 20, 37, 24, 39,
345 0, 33, 64, 63, 20, 20, 37, 24, 39, 0,
346 33, 64, 63, 20, 20, 0, 20, 41, 20, 66,
347 42, 0, 20, 0, 41, 65, 42, 0, 0, 20,
348 43, 65, 0, 20, 0, 67, 0, 5, 67, 0,
349 68, 0, 68, 71, 0, 12, 69, 0, 11, 69,
350 0, 69, 0, 12, 18, 0, 11, 18, 0, 18,
351 0, 17, 0, 16, 0, 20, 0, 70, 20, 0,
352 22, 0, 6, 0, 13, 15, 0, 13, 0, 14,
353 15, 0, 14, 0, 15, 0, 9, 0, 8, 0,
354 7, 0, 44, 71, 0, 44, 0, 20, 74, 0,
355 74, 0, 57, 20, 74, 0, 20, 57, 74, 0,
356 57, 74, 0, 72, 0, 20, 41, 75, 42, 0,
357 75, 45, 20, 0, 20, 0, 37, 24, 0, 39,
358 0, 35, 64, 73, 66, 20, 41, 79, 42, 78,
359 76, 0, 57, 35, 64, 72, 66, 20, 41, 79,
360 42, 78, 76, 0, 34, 57, 66, 20, 41, 79,
361 42, 78, 76, 0, 57, 34, 66, 20, 41, 79,
362 42, 78, 76, 0, 34, 66, 20, 41, 79, 42,
363 78, 76, 0, 36, 41, 22, 42, 66, 20, 41,
364 79, 42, 78, 76, 0, 57, 66, 20, 41, 79,
365 42, 78, 76, 0, 20, 41, 20, 42, 76, 0,
366 19, 85, 0, 19, 37, 24, 0, 0, 6, 0,
367 20, 0, 20, 45, 80, 0, 80, 0, 81, 45,
368 10, 0, 81, 0, 81, 45, 82, 0, 82, 0,
369 66, 20, 0, 66, 20, 23, 0, 66, 20, 41,
370 20, 83, 42, 0, 66, 20, 23, 41, 20, 83,
371 42, 0, 83, 84, 0, 84, 0, 20, 0, 46,
372 85, 0, 47, 85, 0, 46, 40, 85, 0, 47,
373 40, 85, 0, 40, 40, 85, 0, 48, 40, 85,
374 0, 21, 0, 49, 21, 0, 20, 0
380 static const short yyrline[] = { 0,
381 255, 256, 257, 258, 261, 267, 273, 279, 285, 291,
382 299, 300, 303, 308, 315, 320, 321, 324, 325, 326,
383 327, 330, 331, 332, 335, 348, 364, 368, 376, 377,
384 378, 379, 380, 386, 389, 393, 428, 456, 521, 530,
385 536, 537, 540, 543, 549, 550, 558, 562, 569, 572,
386 575, 578, 581, 584, 587, 590, 593, 596, 600, 603,
387 608, 611, 614, 617, 620, 625, 628, 631, 636, 637,
388 641, 653, 659, 671, 683, 686, 692, 697, 700, 705,
389 706, 710, 720, 730, 740, 750, 760, 766, 771, 792,
390 793, 797, 800, 801, 812, 822, 825, 826, 829, 830,
391 833, 836, 839, 847, 857, 858, 861, 874, 878, 882,
392 886, 890, 894, 900, 901, 905
397 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
399 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
400 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
401 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","ONERROR","TOKEN","NUMBER","TYPETOKEN",
402 "ARRAY_DIM","CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE",
403 "PROTECTED","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='",
404 "'('","')'","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
405 "class","classdec","classcode","thing","scope","destructor","initializer","varoptions",
406 "variable","argument","argtype","flags","flaglist","type","type1","type2","integer",
407 "tspecifier","stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode",
408 "method","onerror","funcargs","arglist","arglist1","arg","checklist","check",
413 static const short yyr1[] = { 0,
414 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
415 52, 52, 53, 53, 54, 55, 55, 56, 56, 56,
416 56, 57, 57, 57, 58, 58, 59, 59, 60, 60,
417 60, 60, 60, 61, 61, 62, 62, 62, 63, 63,
418 64, 64, 65, 65, 66, 66, 67, 67, 68, 68,
419 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
420 69, 69, 69, 69, 69, 70, 70, 70, 71, 71,
421 72, 72, 73, 73, 73, 73, 74, 75, 75, 76,
422 76, 77, 77, 77, 77, 77, 77, 77, 77, 78,
423 78, 78, 79, 79, 79, 79, 80, 80, 81, 81,
424 82, 82, 82, 82, 83, 83, 84, 84, 84, 84,
425 84, 84, 84, 85, 85, 85
428 static const short yyr2[] = { 0,
429 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
430 2, 1, 4, 3, 4, 2, 1, 1, 1, 1,
431 1, 1, 1, 1, 2, 3, 2, 3, 2, 2,
432 1, 1, 0, 5, 6, 11, 8, 5, 5, 1,
433 3, 0, 3, 1, 1, 2, 1, 2, 2, 2,
434 1, 2, 2, 1, 1, 1, 1, 2, 1, 1,
435 2, 1, 2, 1, 1, 1, 1, 1, 2, 1,
436 2, 1, 3, 3, 2, 1, 4, 3, 1, 2,
437 1, 10, 11, 9, 9, 8, 11, 8, 5, 2,
438 3, 0, 1, 1, 3, 1, 3, 1, 3, 1,
439 2, 3, 6, 7, 2, 1, 1, 2, 2, 3,
443 static const short yydefact[] = { 0,
444 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
445 0, 0, 11, 3, 2, 0, 0, 1, 0, 22,
446 23, 24, 42, 0, 42, 0, 14, 21, 0, 17,
447 0, 19, 20, 18, 15, 0, 0, 0, 0, 60,
448 68, 67, 66, 0, 0, 62, 64, 65, 56, 55,
449 54, 57, 59, 0, 0, 45, 47, 51, 0, 0,
450 0, 13, 16, 0, 42, 0, 0, 44, 0, 40,
451 0, 46, 53, 50, 52, 49, 61, 63, 0, 0,
452 70, 48, 58, 0, 0, 76, 0, 72, 0, 0,
453 0, 33, 0, 0, 41, 0, 0, 0, 0, 69,
454 0, 0, 0, 71, 0, 75, 0, 0, 0, 0,
455 0, 0, 33, 0, 0, 32, 31, 0, 0, 81,
456 89, 43, 0, 38, 0, 60, 57, 0, 0, 96,
457 98, 100, 79, 0, 74, 73, 0, 0, 0, 0,
458 25, 0, 0, 116, 114, 0, 0, 27, 0, 29,
459 30, 34, 80, 0, 0, 0, 0, 101, 92, 0,
460 77, 0, 0, 0, 0, 0, 26, 35, 28, 115,
461 92, 39, 0, 92, 95, 102, 0, 0, 0, 97,
462 99, 78, 0, 0, 92, 0, 0, 0, 37, 0,
463 0, 0, 0, 90, 86, 92, 0, 0, 0, 88,
464 0, 84, 0, 107, 0, 0, 0, 0, 0, 106,
465 91, 0, 92, 85, 92, 0, 0, 0, 0, 108,
466 0, 109, 0, 103, 105, 82, 0, 0, 36, 104,
467 112, 110, 111, 113, 87, 83, 0, 0, 0
470 static const short yydefgoto[] = { 237,
471 8, 9, 10, 11, 29, 30, 31, 116, 117, 118,
472 32, 33, 71, 38, 69, 128, 56, 57, 58, 59,
473 82, 86, 87, 88, 134, 121, 34, 179, 129, 130,
474 131, 132, 209, 210, 148
477 static const short yypact[] = { 54,
478 -16,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 54, 156,
479 -19, 38,-32768, 156, 156, 140, 29, 156, 25,-32768,
480 -32768,-32768, 35, 137, 35, 47,-32768,-32768, 157,-32768,
481 89,-32768,-32768,-32768,-32768, 102, 127, 142, 245,-32768,
482 -32768,-32768,-32768, 261, 267, 150, 151,-32768,-32768,-32768,
483 -32768,-32768,-32768, 210, 166,-32768, 167,-32768, 174, 95,
484 191,-32768,-32768, 210, 35, 200, 187, 188, 196, 206,
485 229,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 235, 225,
486 167,-32768,-32768, -10, 248,-32768, 210,-32768, 227, 251,
487 252, 45, 92, 127,-32768, 257, 258, 242, 228,-32768,
488 243, 266, 268,-32768, -17,-32768, 269, 210, 246, -17,
489 210, 34, -11, 6, 228, 250, 271, 253, 270,-32768,
490 -32768,-32768, 210, 256, 228, 254, -1, 275, 259,-32768,
491 260,-32768,-32768, 119,-32768,-32768, 262, 277, 228, 278,
492 -32768, 276, 263,-32768,-32768, 280, 285,-32768, 265,-32768,
493 -32768,-32768,-32768, 272, 284, 273, 210, 91, 290, 192,
494 -32768, 279, 228, 281, 274, 282,-32768,-32768,-32768,-32768,
495 290,-32768, -7, 290,-32768, 283, 291, 40, 92,-32768,
496 -32768,-32768, 286, 228, 290, 228, 92, 288,-32768, 92,
497 292, 93, 289,-32768,-32768, 290, 287, 92, 293,-32768,
498 294,-32768, 93,-32768, 296, 70, 72, 297, 27,-32768,
499 -32768, 92, 290,-32768, 290, 295, 88, 15, 15,-32768,
500 15,-32768, 15,-32768,-32768,-32768, 92, 92,-32768,-32768,
501 -32768,-32768,-32768,-32768,-32768,-32768, 310, 317,-32768
504 static const short yypgoto[] = {-32768,
505 255, 106, 311,-32768,-32768, 298, -22, 202, 205, 213,
506 -32768,-32768,-32768, -6, 236, -24, 299,-32768, 73,-32768,
507 264, 240,-32768, 53,-32768, -175,-32768, -157, -114, 175,
508 -32768, 173, 136, -201, -173
515 static const short yytable[] = { 55,
516 149, 54, 101, 195, 194, 12, 66, 225, 112, 101,
517 156, 200, 188, 187, 202, 225, 190, 16, 60, 20,
518 21, 22, 214, 102, 165, 144, 145, 198, 114, 79,
519 102, 189, 220, 222, 144, 145, 226, 85, 212, 90,
520 -94, 17, 146, 157, 231, 232, 204, 233, 183, 234,
521 35, 235, 236, 141, 147, 227, 1, 228, 91, 144,
522 145, 103, 107, 147, 112, 36, 205, 113, 224, 197,
523 142, 199, 206, 207, 208, 37, 193, 2, 3, 4,
524 5, 6, 7, 138, 114, 115, 140, 61, 147, 144,
525 145, 144, 145, 39, 40, 41, 42, 43, 154, 44,
526 45, 46, 47, 48, 49, 50, 51, 204, 52, 219,
527 53, 221, 204, 176, 84, 15, 74, 76, 147, 18,
528 147, 67, 64, 65, 20, 21, 22, 205, 119, 230,
529 120, 177, 205, 206, 207, 208, 104, 106, 206, 207,
530 208, 39, 40, 41, 42, 43, 68, 44, 45, 46,
531 47, 48, 49, 50, 51, 135, 52, 136, 53, 19,
532 161, 70, 104, 162, 77, 78, 20, 21, 22, 20,
533 21, 22, 23, 24, 25, 26, 19, 27, 28, 2,
534 3, 4, 5, 6, 7, 80, 20, 21, 22, 23,
535 24, 25, 26, 83, 62, 28, 39, 40, 41, 42,
536 43, 180, 44, 45, 46, 47, 48, 49, 50, 51,
537 81, 52, 89, 53, 39, 40, 41, 42, 43, 92,
538 44, 45, 46, 47, 48, 49, 50, 51, 93, 52,
539 94, 53, 39, 126, 41, 42, 43, 95, 44, 45,
540 46, 47, 48, 49, 50, 51, 96, 127, 97, 53,
541 40, 41, 42, 43, 98, 44, 45, 46, 47, 48,
542 49, 50, 51, 13, 52, 99, 53, 105, 108, 13,
543 109, 110, 13, 46, 47, 48, 123, 124, 73, 46,
544 47, 48, 125, 102, 75, 133, 139, 101, 137, 114,
545 112, 152, 155, 153, 158, -93, 164, 166, 182, 167,
546 159, 168, 163, 169, 160, 170, 171, 173, 178, 238,
547 192, 203, 211, 172, 174, 185, 239, 216, 151, 14,
548 150, 184, 186, 191, 201, 143, 63, 196, 213, 122,
549 111, 175, 181, 229, 215, 218, 223, 72, 217, 0,
553 static const short yycheck[] = { 24,
554 115, 24, 20, 179, 178, 22, 31, 209, 20, 20,
555 125, 187, 20, 171, 190, 217, 174, 37, 25, 30,
556 31, 32, 198, 41, 139, 20, 21, 185, 40, 54,
557 41, 39, 206, 207, 20, 21, 212, 60, 196, 64,
558 42, 4, 37, 45, 218, 219, 20, 221, 163, 223,
559 22, 227, 228, 20, 49, 213, 3, 215, 65, 20,
560 21, 84, 87, 49, 20, 41, 40, 23, 42, 184,
561 37, 186, 46, 47, 48, 41, 37, 24, 25, 26,
562 27, 28, 29, 108, 40, 41, 111, 41, 49, 20,
563 21, 20, 21, 5, 6, 7, 8, 9, 123, 11,
564 12, 13, 14, 15, 16, 17, 18, 20, 20, 40,
565 22, 40, 20, 23, 20, 10, 44, 45, 49, 14,
566 49, 20, 34, 35, 30, 31, 32, 40, 37, 42,
567 39, 41, 40, 46, 47, 48, 84, 85, 46, 47,
568 48, 5, 6, 7, 8, 9, 20, 11, 12, 13,
569 14, 15, 16, 17, 18, 103, 20, 105, 22, 20,
570 42, 20, 110, 45, 15, 15, 30, 31, 32, 30,
571 31, 32, 33, 34, 35, 36, 20, 38, 39, 24,
572 25, 26, 27, 28, 29, 20, 30, 31, 32, 33,
573 34, 35, 36, 20, 38, 39, 5, 6, 7, 8,
574 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
575 44, 20, 22, 22, 5, 6, 7, 8, 9, 20,
576 11, 12, 13, 14, 15, 16, 17, 18, 42, 20,
577 43, 22, 5, 6, 7, 8, 9, 42, 11, 12,
578 13, 14, 15, 16, 17, 18, 41, 20, 20, 22,
579 6, 7, 8, 9, 20, 11, 12, 13, 14, 15,
580 16, 17, 18, 9, 20, 41, 22, 20, 42, 15,
581 20, 20, 18, 13, 14, 15, 20, 20, 18, 13,
582 14, 15, 41, 41, 18, 20, 41, 20, 20, 40,
583 20, 39, 37, 24, 20, 42, 20, 20, 20, 24,
584 42, 39, 41, 24, 45, 21, 42, 24, 19, 0,
585 20, 20, 24, 42, 42, 42, 0, 24, 117, 9,
586 116, 41, 41, 41, 37, 113, 29, 42, 42, 94,
587 91, 157, 160, 39, 42, 40, 40, 39, 203, -1,
590 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
591 #line 3 "/usr/lib/bison.simple"
592 /* This file comes from bison-1.28. */
594 /* Skeleton output parser for bison,
595 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
597 This program is free software; you can redistribute it and/or modify
598 it under the terms of the GNU General Public License as published by
599 the Free Software Foundation; either version 2, or (at your option)
602 This program is distributed in the hope that it will be useful,
603 but WITHOUT ANY WARRANTY; without even the implied warranty of
604 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
605 GNU General Public License for more details.
607 You should have received a copy of the GNU General Public License
608 along with this program; if not, write to the Free Software
609 Foundation, Inc., 59 Temple Place - Suite 330,
610 Boston, MA 02111-1307, USA. */
612 /* As a special exception, when this file is copied by Bison into a
613 Bison output file, you may use that output file without restriction.
614 This special exception was added by the Free Software Foundation
615 in version 1.24 of Bison. */
617 /* This is the parser code that is written into each bison parser
618 when the %semantic_parser declaration is not specified in the grammar.
619 It was written by Richard Stallman by simplifying the hairy parser
620 used when %semantic_parser is specified. */
622 #ifndef YYSTACK_USE_ALLOCA
624 #define YYSTACK_USE_ALLOCA
625 #else /* alloca not defined */
627 #define YYSTACK_USE_ALLOCA
628 #define alloca __builtin_alloca
629 #else /* not GNU C. */
630 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
631 #define YYSTACK_USE_ALLOCA
633 #else /* not sparc */
634 /* We think this test detects Watcom and Microsoft C. */
635 /* This used to test MSDOS, but that is a bad idea
636 since that symbol is in the user namespace. */
637 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
638 #if 0 /* No need for malloc.h, which pollutes the namespace;
639 instead, just don't use alloca. */
642 #else /* not MSDOS, or __TURBOC__ */
644 /* I don't know what this was needed for, but it pollutes the namespace.
645 So I turned it off. rms, 2 May 1997. */
646 /* #include <malloc.h> */
648 #define YYSTACK_USE_ALLOCA
649 #else /* not MSDOS, or __TURBOC__, or _AIX */
651 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
652 and on HPUX 10. Eventually we can turn this on. */
653 #define YYSTACK_USE_ALLOCA
654 #define alloca __builtin_alloca
657 #endif /* not _AIX */
658 #endif /* not MSDOS, or __TURBOC__ */
659 #endif /* not sparc */
660 #endif /* not GNU C */
661 #endif /* alloca not defined */
662 #endif /* YYSTACK_USE_ALLOCA not defined */
664 #ifdef YYSTACK_USE_ALLOCA
665 #define YYSTACK_ALLOC alloca
667 #define YYSTACK_ALLOC malloc
670 /* Note: there must be only one dollar sign in this file.
671 It is replaced by the list of actions, each action
672 as one case of the switch. */
674 #define yyerrok (yyerrstatus = 0)
675 #define yyclearin (yychar = YYEMPTY)
678 #define YYACCEPT goto yyacceptlab
679 #define YYABORT goto yyabortlab
680 #define YYERROR goto yyerrlab1
681 /* Like YYERROR except do call yyerror.
682 This remains here temporarily to ease the
683 transition to the new meaning of YYERROR, for GCC.
684 Once GCC version 2 has supplanted version 1, this can go. */
685 #define YYFAIL goto yyerrlab
686 #define YYRECOVERING() (!!yyerrstatus)
687 #define YYBACKUP(token, value) \
689 if (yychar == YYEMPTY && yylen == 1) \
690 { yychar = (token), yylval = (value); \
691 yychar1 = YYTRANSLATE (yychar); \
696 { yyerror ("syntax error: cannot back up"); YYERROR; } \
700 #define YYERRCODE 256
703 #define YYLEX yylex()
709 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
711 #define YYLEX yylex(&yylval, &yylloc)
713 #else /* not YYLSP_NEEDED */
715 #define YYLEX yylex(&yylval, YYLEX_PARAM)
717 #define YYLEX yylex(&yylval)
719 #endif /* not YYLSP_NEEDED */
722 /* If nonreentrant, generate the variables here */
726 int yychar; /* the lookahead symbol */
727 YYSTYPE yylval; /* the semantic value of the */
728 /* lookahead symbol */
731 YYLTYPE yylloc; /* location data for the lookahead */
735 int yynerrs; /* number of parse errors so far */
736 #endif /* not YYPURE */
739 int yydebug; /* nonzero means print parse trace */
740 /* Since this is uninitialized, it does not stop multiple parsers
744 /* YYINITDEPTH indicates the initial size of the parser's stacks */
747 #define YYINITDEPTH 200
750 /* YYMAXDEPTH is the maximum size the stacks can grow to
751 (effective only if the built-in stack extension method is used). */
758 #define YYMAXDEPTH 10000
761 /* Define __yy_memcpy. Note that the size argument
762 should be passed with type unsigned int, because that is what the non-GCC
763 definitions require. With GCC, __builtin_memcpy takes an arg
764 of type size_t, but it can handle unsigned int. */
766 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
767 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
768 #else /* not GNU C or C++ */
771 /* This is the most reliable way to avoid incompatibilities
772 in available built-in functions on various systems. */
774 __yy_memcpy (to, from, count)
779 register char *f = from;
780 register char *t = to;
781 register int i = count;
787 #else /* __cplusplus */
789 /* This is the most reliable way to avoid incompatibilities
790 in available built-in functions on various systems. */
792 __yy_memcpy (char *to, char *from, unsigned int count)
794 register char *t = to;
795 register char *f = from;
796 register int i = count;
805 #line 217 "/usr/lib/bison.simple"
807 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
808 into yyparse. The argument should have type void *.
809 It should actually point to an object.
810 Grammar actions can access the variable by casting it
811 to the proper pointer type. */
815 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
816 #define YYPARSE_PARAM_DECL
817 #else /* not __cplusplus */
818 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
819 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
820 #endif /* not __cplusplus */
821 #else /* not YYPARSE_PARAM */
822 #define YYPARSE_PARAM_ARG
823 #define YYPARSE_PARAM_DECL
824 #endif /* not YYPARSE_PARAM */
826 /* Prevent warning if -Wstrict-prototypes. */
829 int yyparse (void *);
836 yyparse(YYPARSE_PARAM_ARG)
839 register int yystate;
841 register short *yyssp;
842 register YYSTYPE *yyvsp;
843 int yyerrstatus; /* number of tokens to shift before error messages enabled */
844 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
846 short yyssa[YYINITDEPTH]; /* the state stack */
847 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
849 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
850 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
853 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
854 YYLTYPE *yyls = yylsa;
857 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
859 #define YYPOPSTACK (yyvsp--, yyssp--)
862 int yystacksize = YYINITDEPTH;
863 int yyfree_stacks = 0;
874 YYSTYPE yyval; /* the variable used to return */
875 /* semantic values from the action */
882 fprintf(stderr, "Starting parse\n");
888 yychar = YYEMPTY; /* Cause a token to be read. */
890 /* Initialize stack pointers.
891 Waste one element of value and location stack
892 so that they stay on the same level as the state stack.
893 The wasted elements are never initialized. */
901 /* Push a new state, which is found in yystate . */
902 /* In all cases, when you get here, the value and location stacks
903 have just been pushed. so pushing a state here evens the stacks. */
908 if (yyssp >= yyss + yystacksize - 1)
910 /* Give user a chance to reallocate the stack */
911 /* Use copies of these so that the &'s don't force the real ones into memory. */
912 YYSTYPE *yyvs1 = yyvs;
915 YYLTYPE *yyls1 = yyls;
918 /* Get the current used size of the three stacks, in elements. */
919 int size = yyssp - yyss + 1;
922 /* Each stack pointer address is followed by the size of
923 the data in use in that stack, in bytes. */
925 /* This used to be a conditional around just the two extra args,
926 but that might be undefined if yyoverflow is a macro. */
927 yyoverflow("parser stack overflow",
928 &yyss1, size * sizeof (*yyssp),
929 &yyvs1, size * sizeof (*yyvsp),
930 &yyls1, size * sizeof (*yylsp),
933 yyoverflow("parser stack overflow",
934 &yyss1, size * sizeof (*yyssp),
935 &yyvs1, size * sizeof (*yyvsp),
939 yyss = yyss1; yyvs = yyvs1;
943 #else /* no yyoverflow */
944 /* Extend the stack our own way. */
945 if (yystacksize >= YYMAXDEPTH)
947 yyerror("parser stack overflow");
959 if (yystacksize > YYMAXDEPTH)
960 yystacksize = YYMAXDEPTH;
961 #ifndef YYSTACK_USE_ALLOCA
964 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
965 __yy_memcpy ((char *)yyss, (char *)yyss1,
966 size * (unsigned int) sizeof (*yyssp));
967 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
968 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
969 size * (unsigned int) sizeof (*yyvsp));
971 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
972 __yy_memcpy ((char *)yyls, (char *)yyls1,
973 size * (unsigned int) sizeof (*yylsp));
975 #endif /* no yyoverflow */
977 yyssp = yyss + size - 1;
978 yyvsp = yyvs + size - 1;
980 yylsp = yyls + size - 1;
985 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
988 if (yyssp >= yyss + yystacksize - 1)
994 fprintf(stderr, "Entering state %d\n", yystate);
1000 /* Do appropriate processing given the current state. */
1001 /* Read a lookahead token if we need one and don't already have one. */
1004 /* First try to decide what to do without reference to lookahead token. */
1006 yyn = yypact[yystate];
1010 /* Not known => get a lookahead token if don't already have one. */
1012 /* yychar is either YYEMPTY or YYEOF
1013 or a valid token in external form. */
1015 if (yychar == YYEMPTY)
1019 fprintf(stderr, "Reading a token: ");
1024 /* Convert token to internal form (in yychar1) for indexing tables with */
1026 if (yychar <= 0) /* This means end of input. */
1029 yychar = YYEOF; /* Don't call YYLEX any more */
1033 fprintf(stderr, "Now at end of input.\n");
1038 yychar1 = YYTRANSLATE(yychar);
1043 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1044 /* Give the individual parser a way to print the precise meaning
1045 of a token, for further debugging info. */
1047 YYPRINT (stderr, yychar, yylval);
1049 fprintf (stderr, ")\n");
1055 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1060 /* yyn is what to do for this token type in this state.
1061 Negative => reduce, -yyn is rule number.
1062 Positive => shift, yyn is new state.
1063 New state is final state => don't bother to shift,
1064 just return success.
1065 0, or most negative number => error. */
1080 /* Shift the lookahead token. */
1084 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1087 /* Discard the token being shifted unless it is eof. */
1088 if (yychar != YYEOF)
1096 /* count tokens shifted since error; after three, turn off error status. */
1097 if (yyerrstatus) yyerrstatus--;
1102 /* Do the default action for the current state. */
1105 yyn = yydefact[yystate];
1109 /* Do a reduction. yyn is the number of a rule to reduce with. */
1113 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1120 fprintf (stderr, "Reducing via rule %d (line %d), ",
1123 /* Print the symbols being reduced, and their result. */
1124 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1125 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1126 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1152 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1154 nodes = g_list_append(nodes,node);
1155 g_string_free(yyvsp[0].cbuf,FALSE);
1161 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1163 nodes = g_list_append(nodes,node);
1164 g_string_free(yyvsp[0].cbuf,FALSE);
1170 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1172 nodes = g_list_append(nodes,node);
1173 g_string_free(yyvsp[0].cbuf,FALSE);
1179 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1181 nodes = g_list_append(nodes,node);
1182 g_string_free(yyvsp[0].cbuf,FALSE);
1188 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1190 nodes = g_list_append(nodes,node);
1191 g_string_free(yyvsp[0].cbuf,FALSE);
1197 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1199 nodes = g_list_append(nodes,node);
1200 g_string_free(yyvsp[0].cbuf,FALSE);
1214 ((Class *)class)->nodes = class_nodes;
1216 nodes = g_list_append(nodes,class);
1222 ((Class *)class)->nodes = NULL;
1224 nodes = g_list_append(nodes,class);
1230 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1259 { the_scope = PUBLIC_SCOPE; ;
1263 { the_scope = PRIVATE_SCOPE; ;
1267 { the_scope = PROTECTED_SCOPE; ;
1272 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1273 g_free(yyvsp[-1].id);
1274 destructor = yyvsp[0].id;
1275 destructor_line = ccode_line;
1276 destructor_simple = TRUE;
1278 g_free(yyvsp[-1].id);
1279 g_free(yyvsp[0].id);
1280 yyerror(_("parse error"));
1288 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1289 g_free(yyvsp[-2].id);
1290 destructor = (yyvsp[0].cbuf)->str;
1291 g_string_free(yyvsp[0].cbuf, FALSE);
1292 destructor_line = ccode_line;
1293 destructor_simple = FALSE;
1295 g_free(yyvsp[-2].id);
1296 g_string_free(yyvsp[0].cbuf, TRUE);
1297 yyerror(_("parse error"));
1305 initializer = yyvsp[0].id;
1306 initializer_line = ccode_line;
1312 initializer = (yyvsp[0].cbuf)->str;
1313 initializer_line = ccode_line;
1314 g_string_free(yyvsp[0].cbuf, FALSE);
1327 { destructor = NULL; ;
1331 { initializer = NULL; ;
1343 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1349 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1355 if(strcmp(yyvsp[-6].id,"get")==0 &&
1356 strcmp(yyvsp[-3].id,"set")==0) {
1358 Type *type = pop_type();
1359 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1360 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1361 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1362 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1364 g_string_free(yyvsp[-4].cbuf,FALSE);
1365 g_string_free(yyvsp[-1].cbuf,FALSE);
1366 class_nodes = g_list_append(class_nodes,node);
1367 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1368 strcmp(yyvsp[-3].id,"get")==0) {
1370 Type *type = pop_type();
1371 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1372 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1373 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1374 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1376 g_string_free(yyvsp[-1].cbuf,FALSE);
1377 g_string_free(yyvsp[-4].cbuf,FALSE);
1378 class_nodes = g_list_append(class_nodes,node);
1380 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1381 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1382 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1383 g_string_free(yyvsp[-1].cbuf,TRUE);
1384 g_string_free(yyvsp[-4].cbuf,TRUE);
1385 yyerror(_("parse error"));
1393 if(strcmp(yyvsp[-3].id,"get")==0) {
1395 Type *type = pop_type();
1396 g_free(yyvsp[-3].id);
1397 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1398 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1399 NULL,0, yyvsp[-7].line);
1400 g_string_free(yyvsp[-1].cbuf,FALSE);
1401 class_nodes = g_list_append(class_nodes,node);
1402 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1404 Type *type = pop_type();
1405 g_free(yyvsp[-3].id);
1406 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1407 NULL,0,(yyvsp[-1].cbuf)->str,
1408 yyvsp[-2].line, yyvsp[-7].line);
1409 g_string_free(yyvsp[-1].cbuf,FALSE);
1410 class_nodes = g_list_append(class_nodes,node);
1412 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1413 g_free(yyvsp[-4].id);
1414 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1415 g_string_free(yyvsp[-1].cbuf,TRUE);
1416 yyerror(_("parse error"));
1430 if(strcmp(yyvsp[0].id,"link")!=0 &&
1431 strcmp(yyvsp[0].id,"stringlink")!=0 &&
1432 strcmp(yyvsp[0].id,"objectlink")!=0) {
1433 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1434 g_free(yyvsp[-1].id);
1435 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1436 yyerror(_("parse error"));
1442 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1443 if(var->scope == PRIVATE_SCOPE)
1444 root = "self->_priv";
1448 if(strcmp(yyvsp[0].id,"link")==0) {
1449 set = g_strdup_printf("%s->%s = ARG;",
1450 root, yyvsp[-1].id);
1451 } else if(strcmp(yyvsp[0].id,"stringlink")==0) {
1452 set = g_strdup_printf("g_free(%s->%s); "
1453 "%s->%s = g_strdup(ARG);",
1455 root, yyvsp[-1].id);
1456 } else if(strcmp(yyvsp[0].id,"objectlink")==0) {
1457 set = g_strdup_printf(
1459 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1462 "gtk_object_ref(GTK_OBJECT(%s->%s)); ",
1467 root, yyvsp[-1].id);
1469 g_assert_not_reached();
1472 /* get is the same for everything */
1473 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1475 g_free(yyvsp[0].id);
1479 type = copy_type(var->vtype);
1481 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1482 yyvsp[-1].id, get, yyvsp[-4].line,
1483 set, yyvsp[-4].line, yyvsp[-4].line);
1484 class_nodes = g_list_append(class_nodes,node);
1490 if(strcmp(yyvsp[-2].id,"type")!=0) {
1491 g_free(yyvsp[-4].id);
1492 g_free(yyvsp[-2].id);
1493 yyerror(_("parse error"));
1496 yyval.id = yyvsp[-4].id;
1502 yyval.id = yyvsp[0].id;
1503 typestack = g_list_prepend(typestack,NULL);
1508 { yyval.list = yyvsp[-1].list; ;
1512 { yyval.list = NULL; ;
1517 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1523 yyval.list = g_list_append(NULL,yyvsp[0].id);
1533 Type *type = typestack->data;
1534 char *oldname = type->name;
1535 type->name = g_strconcat("const ",oldname,NULL);
1542 Node *node = new_type(0,yyvsp[0].id,NULL);
1543 typestack = g_list_prepend(typestack,node);
1549 Node *node = new_type(stars,yyvsp[-1].id,NULL);
1551 typestack = g_list_prepend(typestack,node);
1557 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1563 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1569 yyval.id = g_strdup(yyvsp[0].id);
1575 yyval.id = g_strdup("unsigned char");
1581 yyval.id = g_strdup("signed char");
1587 yyval.id = g_strdup("char");
1593 yyval.id = g_strdup("double");
1599 yyval.id = g_strdup("float");
1605 yyval.id = yyvsp[0].id;
1611 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1612 g_free(yyvsp[0].id);
1618 yyval.id = yyvsp[0].id;
1624 yyval.id = g_strdup("void");
1630 yyval.id = "long int";
1642 yyval.id = "short int";
1666 yyval.id = "union ";
1672 yyval.id = "struct ";
1686 if(strcmp(yyvsp[-1].id,"first")==0)
1687 yyval.sigtype = SIGNAL_FIRST_METHOD;
1688 else if(strcmp(yyvsp[-1].id,"last")==0)
1689 yyval.sigtype = SIGNAL_LAST_METHOD;
1691 yyerror(_("signal must be 'first' or 'last'"));
1692 g_free(yyvsp[-1].id);
1695 g_free(yyvsp[-1].id);
1701 yyval.sigtype = SIGNAL_LAST_METHOD;
1707 if(strcmp(yyvsp[-1].id,"first")==0)
1708 yyval.sigtype = SIGNAL_FIRST_METHOD;
1709 else if(strcmp(yyvsp[-1].id,"last")==0)
1710 yyval.sigtype = SIGNAL_LAST_METHOD;
1712 yyerror(_("signal must be 'first' or 'last'"));
1713 g_free(yyvsp[-1].id);
1716 g_free(yyvsp[-1].id);
1722 if(strcmp(yyvsp[-2].id,"first")==0)
1723 yyval.sigtype = SIGNAL_FIRST_METHOD;
1724 else if(strcmp(yyvsp[-2].id,"last")==0)
1725 yyval.sigtype = SIGNAL_LAST_METHOD;
1727 yyerror(_("signal must be 'first' or 'last'"));
1728 g_free(yyvsp[-2].id);
1731 g_free(yyvsp[-2].id);
1737 yyval.sigtype = SIGNAL_LAST_METHOD;
1743 /* the_scope was default thus public */
1744 the_scope = PUBLIC_SCOPE;
1750 gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
1756 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1762 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1767 { yyval.cbuf = yyvsp[0].cbuf; ;
1771 { yyval.cbuf = NULL; ;
1777 yyerror(_("signal without 'self' as "
1778 "first parameter"));
1781 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1782 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-9].line,
1783 ccode_line, vararg, yyvsp[-8].list);
1790 yyerror(_("signal without 'self' as "
1791 "first parameter"));
1794 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1795 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-9].line,
1796 ccode_line, vararg, yyvsp[-8].list);
1803 yyerror(_("virtual method without 'self' as "
1804 "first parameter"));
1807 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1808 yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-8].line,
1809 ccode_line, vararg, NULL);
1816 yyerror(_("virtual method without 'self' as "
1817 "first parameter"));
1820 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1821 yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-7].line,
1822 ccode_line, vararg, NULL);
1829 yyerror(_("virtual method without 'self' as "
1830 "first parameter"));
1833 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1834 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-7].line,
1835 ccode_line, vararg, NULL);
1841 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
1842 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,
1843 yyvsp[-10].line, ccode_line,
1850 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
1851 yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
1858 if(strcmp(yyvsp[-4].id,"init")==0) {
1859 push_init_arg(yyvsp[-2].id,FALSE);
1860 push_function(NO_SCOPE, INIT_METHOD, NULL,
1861 yyvsp[-4].id, NULL, yyvsp[0].cbuf, yyvsp[-3].line,
1862 ccode_line, FALSE, NULL);
1863 } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
1864 push_init_arg(yyvsp[-2].id,TRUE);
1865 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
1866 yyvsp[-4].id, NULL, yyvsp[0].cbuf, yyvsp[-3].line,
1867 ccode_line, FALSE, NULL);
1869 g_free(yyvsp[-4].id);
1870 g_free(yyvsp[-2].id);
1871 g_string_free(yyvsp[-2].cbuf,TRUE);
1872 yyerror(_("parse error"));
1879 { yyval.id = yyvsp[0].id; ;
1884 yyval.id = (yyvsp[0].cbuf)->str;
1885 g_string_free(yyvsp[0].cbuf,FALSE);
1890 { yyval.id = NULL; ;
1894 { vararg = FALSE; has_self = FALSE; ;
1901 if(strcmp(yyvsp[0].id,"self")==0)
1902 push_self(yyvsp[0].id);
1904 g_free(yyvsp[0].id);
1905 yyerror(_("parse error"));
1914 if(strcmp(yyvsp[-2].id,"self")==0)
1915 push_self(yyvsp[-2].id);
1917 g_free(yyvsp[-2].id);
1918 yyerror(_("parse error"));
1925 { has_self = FALSE; ;
1946 push_funcarg(yyvsp[0].id,NULL);
1952 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
1958 if(strcmp(yyvsp[-2].id,"check")!=0) {
1959 yyerror(_("parse error"));
1962 g_free(yyvsp[-2].id);
1963 push_funcarg(yyvsp[-4].id,NULL);
1969 if(strcmp(yyvsp[-2].id,"check")!=0) {
1970 yyerror(_("parse error"));
1973 g_free(yyvsp[-2].id);
1974 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
1988 if(strcmp(yyvsp[0].id,"type")==0) {
1989 Node *node = new_check(TYPE_CHECK,NULL);
1990 checks = g_list_append(checks,node);
1991 } else if(strcmp(yyvsp[0].id,"null")==0) {
1992 Node *node = new_check(NULL_CHECK,NULL);
1993 checks = g_list_append(checks,node);
1995 yyerror(_("parse error"));
1998 g_free(yyvsp[0].id);
2004 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2005 checks = g_list_append(checks,node);
2011 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2012 checks = g_list_append(checks,node);
2018 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2019 checks = g_list_append(checks,node);
2025 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2026 checks = g_list_append(checks,node);
2032 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2033 checks = g_list_append(checks,node);
2039 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2040 checks = g_list_append(checks,node);
2045 { yyval.id = yyvsp[0].id; ;
2050 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2051 g_free(yyvsp[0].id);
2056 { yyval.id = yyvsp[0].id; ;
2059 /* the action file gets copied in in place of this dollarsign */
2060 #line 543 "/usr/lib/bison.simple"
2071 short *ssp1 = yyss - 1;
2072 fprintf (stderr, "state stack now");
2073 while (ssp1 != yyssp)
2074 fprintf (stderr, " %d", *++ssp1);
2075 fprintf (stderr, "\n");
2085 yylsp->first_line = yylloc.first_line;
2086 yylsp->first_column = yylloc.first_column;
2087 yylsp->last_line = (yylsp-1)->last_line;
2088 yylsp->last_column = (yylsp-1)->last_column;
2093 yylsp->last_line = (yylsp+yylen-1)->last_line;
2094 yylsp->last_column = (yylsp+yylen-1)->last_column;
2098 /* Now "shift" the result of the reduction.
2099 Determine what state that goes to,
2100 based on the state we popped back to
2101 and the rule number reduced by. */
2105 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2106 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2107 yystate = yytable[yystate];
2109 yystate = yydefgoto[yyn - YYNTBASE];
2113 yyerrlab: /* here on detecting error */
2116 /* If not already recovering from an error, report this error. */
2120 #ifdef YYERROR_VERBOSE
2121 yyn = yypact[yystate];
2123 if (yyn > YYFLAG && yyn < YYLAST)
2130 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2131 for (x = (yyn < 0 ? -yyn : 0);
2132 x < (sizeof(yytname) / sizeof(char *)); x++)
2133 if (yycheck[x + yyn] == x)
2134 size += strlen(yytname[x]) + 15, count++;
2135 msg = (char *) malloc(size + 15);
2138 strcpy(msg, "parse error");
2143 for (x = (yyn < 0 ? -yyn : 0);
2144 x < (sizeof(yytname) / sizeof(char *)); x++)
2145 if (yycheck[x + yyn] == x)
2147 strcat(msg, count == 0 ? ", expecting `" : " or `");
2148 strcat(msg, yytname[x]);
2157 yyerror ("parse error; also virtual memory exceeded");
2160 #endif /* YYERROR_VERBOSE */
2161 yyerror("parse error");
2165 yyerrlab1: /* here on error raised explicitly by an action */
2167 if (yyerrstatus == 3)
2169 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2171 /* return failure if at end of input */
2172 if (yychar == YYEOF)
2177 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2183 /* Else will try to reuse lookahead token
2184 after shifting the error token. */
2186 yyerrstatus = 3; /* Each real token shifted decrements this */
2190 yyerrdefault: /* current state does not do anything special for the error token. */
2193 /* This is wrong; only states that explicitly want error tokens
2194 should shift them. */
2195 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2196 if (yyn) goto yydefault;
2199 yyerrpop: /* pop the current state because it cannot handle the error token */
2201 if (yyssp == yyss) YYABORT;
2211 short *ssp1 = yyss - 1;
2212 fprintf (stderr, "Error: state stack now");
2213 while (ssp1 != yyssp)
2214 fprintf (stderr, " %d", *++ssp1);
2215 fprintf (stderr, "\n");
2221 yyn = yypact[yystate];
2226 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2245 fprintf(stderr, "Shifting error token, ");
2257 /* YYACCEPT comes here. */
2269 /* YYABORT comes here. */