2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
50 #include "treefuncs.h"
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 char *onerror = NULL;
76 static char *defreturn = NULL;
78 static GList *gtktypes = NULL;
80 /* this can be a global as we will only do one function at a time
82 static int the_scope = NO_SCOPE;
87 extern int ccode_line;
98 if(strcmp(yytext,"\n")==0) {
99 out=g_strconcat("Error: ",str," before newline",NULL);
100 } else if(yytext[0]=='\0') {
101 out=g_strconcat("Error: ", str, " at end of input", NULL);
103 char *tmp = g_strdup(yytext);
104 while((p=strchr(tmp, '\n')))
107 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
111 fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
120 Type *type = typestack->data;
121 typestack = g_list_remove(typestack,typestack->data);
126 push_variable(char *name, int scope, int line_no, char *postfix)
129 Type *type = pop_type();
131 type->postfix = postfix;
133 var = new_variable(scope, type, name, line_no,
134 destructor, destructor_line,
136 initializer, initializer_line);
137 class_nodes = g_list_append(class_nodes, var);
141 push_function(int scope, int method, char *oid, char *id,
142 GString *cbuf, int line_no, int ccode_line,
143 gboolean vararg, GList *flags)
149 g_assert(scope != CLASS_SCOPE);
151 if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) {
154 type = (Type *)new_type(0,g_strdup("void"),NULL);
157 /* a complicated and ugly test to figure out if we have
158 the wrong number of types for a signal */
159 if((method == SIGNAL_FIRST_METHOD ||
160 method == SIGNAL_LAST_METHOD) &&
161 g_list_length(gtktypes) != g_list_length(funcargs) &&
162 !(g_list_length(funcargs) == 1 &&
163 g_list_length(gtktypes) == 2 &&
164 strcmp(gtktypes->next->data, "NONE")==0)) {
165 print_error(TRUE, _("The number of GTK arguments and "
166 "function arguments for a signal "
167 "don't seem to match"), line_no);
169 if(g_list_length(gtktypes) > 2) {
171 for(li = gtktypes->next; li; li = li->next) {
172 if(strcmp(li->data, "NONE")==0) {
174 _("NONE can only appear in an "
175 "argument list by itself"),
182 c_cbuf = p = cbuf->str;
183 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
190 node = new_method(scope, method, type, oid, gtktypes, flags,
191 id, funcargs, onerror, defreturn, c_cbuf, line_no,
192 ccode_line, vararg, method_unique_id++);
196 /*only free segment if we haven't passed it
205 class_nodes = g_list_append(class_nodes, node);
209 free_all_global_state(void)
216 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
217 g_list_free(gtktypes);
220 free_node_list(funcargs);
225 push_funcarg(char *name, char *postfix)
228 Type *type = pop_type();
230 type->postfix = postfix;
232 node = new_funcarg(type, name, checks);
235 funcargs = g_list_append(funcargs, node);
239 push_init_arg(char *name, int is_class)
246 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
248 tn = g_strdup(((Class *)class)->otype);
250 type = new_type(1,tn,NULL);
251 node = new_funcarg((Type *)type,name,NULL);
252 funcargs = g_list_prepend(funcargs, node);
261 type = new_type(1,g_strdup(((Class *)class)->otype),NULL);
262 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
263 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
264 node = new_funcarg((Type *)type,id,ch);
265 funcargs = g_list_prepend(funcargs, node);
269 find_var_or_die(const char *id, int line)
274 for(li = class_nodes; li != NULL; li = li->next) {
276 Node *node = li->data;
277 if(node->type != VARIABLE_NODE)
280 if(strcmp(var->id, id)==0)
284 s = g_strdup_printf(_("Variable %s not defined here"), id);
285 print_error(FALSE, s, line);
287 g_assert_not_reached();
292 set_return_value(char *type, char *val)
294 if(strcmp(type, "onerror")==0) {
300 } else if(strcmp(type, "defreturn")==0) {
334 #define YYFLAG -32768
337 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 87)
339 static const char yytranslate[] = { 0,
340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343 2, 2, 48, 2, 2, 2, 2, 2, 2, 41,
344 42, 44, 2, 45, 49, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 39, 47,
346 40, 46, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 37, 43, 38, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
366 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
367 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
368 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
372 static const short yyprhs[] = { 0,
373 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
374 24, 27, 29, 34, 38, 43, 46, 48, 50, 52,
375 54, 56, 58, 60, 62, 64, 67, 71, 74, 78,
376 81, 84, 86, 88, 89, 95, 102, 114, 123, 129,
377 135, 137, 141, 142, 146, 148, 150, 153, 155, 158,
378 161, 164, 166, 169, 172, 174, 176, 178, 180, 183,
379 185, 187, 190, 192, 195, 197, 199, 201, 203, 205,
380 208, 210, 213, 215, 219, 223, 226, 228, 233, 237,
381 239, 242, 244, 255, 267, 277, 287, 296, 308, 317,
382 323, 326, 331, 332, 334, 337, 339, 341, 345, 347,
383 351, 353, 357, 359, 362, 366, 373, 381, 384, 386,
384 388, 391, 394, 398, 402, 406, 410, 412, 415
387 static const short yyrhs[] = { 52,
388 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
389 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
390 0, 28, 0, 52, 51, 0, 51, 0, 54, 37,
391 55, 38, 0, 54, 37, 38, 0, 3, 21, 4,
392 21, 0, 55, 56, 0, 56, 0, 77, 0, 61,
393 0, 62, 0, 39, 0, 29, 0, 30, 0, 31,
394 0, 32, 0, 19, 19, 0, 19, 37, 23, 0,
395 40, 86, 0, 40, 37, 23, 0, 58, 59, 0,
396 59, 58, 0, 59, 0, 58, 0, 0, 57, 66,
397 19, 60, 39, 0, 57, 66, 19, 22, 60, 39,
398 0, 33, 64, 63, 19, 19, 37, 23, 19, 37,
399 23, 39, 0, 33, 64, 63, 19, 19, 37, 23,
400 39, 0, 33, 64, 63, 19, 19, 0, 19, 41,
401 19, 66, 42, 0, 19, 0, 41, 65, 42, 0,
402 0, 19, 43, 65, 0, 19, 0, 67, 0, 5,
403 67, 0, 68, 0, 68, 71, 0, 12, 69, 0,
404 11, 69, 0, 69, 0, 12, 18, 0, 11, 18,
405 0, 18, 0, 17, 0, 16, 0, 19, 0, 70,
406 19, 0, 21, 0, 6, 0, 13, 15, 0, 13,
407 0, 14, 15, 0, 14, 0, 15, 0, 9, 0,
408 8, 0, 7, 0, 44, 71, 0, 44, 0, 19,
409 74, 0, 74, 0, 57, 19, 74, 0, 19, 57,
410 74, 0, 57, 74, 0, 72, 0, 19, 41, 75,
411 42, 0, 75, 45, 19, 0, 19, 0, 37, 23,
412 0, 39, 0, 35, 64, 73, 66, 19, 41, 80,
413 42, 78, 76, 0, 57, 35, 64, 72, 66, 19,
414 41, 80, 42, 78, 76, 0, 34, 57, 66, 19,
415 41, 80, 42, 78, 76, 0, 57, 34, 66, 19,
416 41, 80, 42, 78, 76, 0, 34, 66, 19, 41,
417 80, 42, 78, 76, 0, 36, 41, 21, 42, 66,
418 19, 41, 80, 42, 78, 76, 0, 57, 66, 19,
419 41, 80, 42, 78, 76, 0, 19, 41, 19, 42,
420 76, 0, 19, 79, 0, 19, 79, 19, 79, 0,
421 0, 86, 0, 37, 23, 0, 6, 0, 19, 0,
422 19, 45, 81, 0, 81, 0, 82, 45, 10, 0,
423 82, 0, 82, 45, 83, 0, 83, 0, 66, 19,
424 0, 66, 19, 22, 0, 66, 19, 41, 19, 84,
425 42, 0, 66, 19, 22, 41, 19, 84, 42, 0,
426 84, 85, 0, 85, 0, 19, 0, 46, 86, 0,
427 47, 86, 0, 46, 40, 86, 0, 47, 40, 86,
428 0, 40, 40, 86, 0, 48, 40, 86, 0, 20,
435 static const short yyrline[] = { 0,
436 308, 309, 310, 311, 314, 320, 326, 332, 338, 344,
437 352, 353, 356, 361, 368, 373, 374, 377, 378, 379,
438 380, 383, 384, 385, 386, 389, 402, 418, 422, 430,
439 431, 432, 433, 434, 440, 443, 447, 482, 510, 580,
440 589, 595, 596, 599, 602, 608, 609, 617, 621, 628,
441 631, 634, 637, 640, 643, 646, 649, 652, 655, 659,
442 662, 667, 670, 673, 676, 679, 684, 687, 690, 695,
443 696, 700, 712, 718, 730, 742, 745, 751, 756, 759,
444 764, 765, 769, 785, 801, 817, 833, 844, 850, 860,
445 883, 894, 913, 919, 920, 926, 927, 938, 948, 951,
446 952, 955, 956, 959, 962, 965, 973, 983, 984, 987,
447 1000, 1004, 1008, 1012, 1016, 1020, 1026, 1027, 1031
452 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
454 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
455 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
456 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
457 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
458 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='",
459 "'('","')'","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
460 "class","classdec","classcode","thing","scope","destructor","initializer","varoptions",
461 "variable","argument","argtype","flags","flaglist","type","type1","type2","integer",
462 "tspecifier","stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode",
463 "method","returnvals","retcode","funcargs","arglist","arglist1","arg","checklist",
464 "check","numtok", NULL
468 static const short yyr1[] = { 0,
469 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
470 52, 52, 53, 53, 54, 55, 55, 56, 56, 56,
471 56, 57, 57, 57, 57, 58, 58, 59, 59, 60,
472 60, 60, 60, 60, 61, 61, 62, 62, 62, 63,
473 63, 64, 64, 65, 65, 66, 66, 67, 67, 68,
474 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
475 68, 69, 69, 69, 69, 69, 70, 70, 70, 71,
476 71, 72, 72, 73, 73, 73, 73, 74, 75, 75,
477 76, 76, 77, 77, 77, 77, 77, 77, 77, 77,
478 78, 78, 78, 79, 79, 80, 80, 80, 80, 81,
479 81, 82, 82, 83, 83, 83, 83, 84, 84, 85,
480 85, 85, 85, 85, 85, 85, 86, 86, 86
483 static const short yyr2[] = { 0,
484 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
485 2, 1, 4, 3, 4, 2, 1, 1, 1, 1,
486 1, 1, 1, 1, 1, 2, 3, 2, 3, 2,
487 2, 1, 1, 0, 5, 6, 11, 8, 5, 5,
488 1, 3, 0, 3, 1, 1, 2, 1, 2, 2,
489 2, 1, 2, 2, 1, 1, 1, 1, 2, 1,
490 1, 2, 1, 2, 1, 1, 1, 1, 1, 2,
491 1, 2, 1, 3, 3, 2, 1, 4, 3, 1,
492 2, 1, 10, 11, 9, 9, 8, 11, 8, 5,
493 2, 4, 0, 1, 2, 1, 1, 3, 1, 3,
494 1, 3, 1, 2, 3, 6, 7, 2, 1, 1,
495 2, 2, 3, 3, 3, 3, 1, 2, 1
498 static const short yydefact[] = { 0,
499 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
500 0, 0, 11, 3, 2, 0, 0, 1, 0, 22,
501 23, 24, 25, 43, 0, 43, 0, 14, 21, 0,
502 17, 0, 19, 20, 18, 15, 0, 0, 0, 0,
503 61, 69, 68, 67, 0, 0, 63, 65, 66, 57,
504 56, 55, 58, 60, 0, 0, 46, 48, 52, 0,
505 0, 0, 13, 16, 0, 43, 0, 0, 45, 0,
506 41, 0, 47, 54, 51, 53, 50, 62, 64, 0,
507 0, 71, 49, 59, 0, 0, 77, 0, 73, 0,
508 0, 0, 34, 0, 0, 42, 0, 0, 0, 0,
509 70, 0, 0, 0, 72, 0, 76, 0, 0, 0,
510 0, 0, 0, 34, 0, 0, 33, 32, 0, 0,
511 82, 90, 44, 0, 39, 0, 61, 58, 0, 0,
512 99, 101, 103, 80, 0, 75, 74, 0, 0, 0,
513 0, 26, 0, 0, 119, 117, 0, 0, 28, 0,
514 30, 31, 35, 81, 0, 0, 0, 0, 104, 93,
515 0, 78, 0, 0, 0, 0, 0, 27, 36, 29,
516 118, 93, 40, 0, 93, 98, 105, 0, 0, 0,
517 100, 102, 79, 0, 0, 93, 0, 0, 0, 38,
518 0, 0, 0, 0, 91, 94, 87, 93, 0, 0,
519 0, 89, 0, 85, 0, 110, 0, 0, 0, 0,
520 0, 109, 95, 0, 0, 93, 86, 93, 0, 0,
521 0, 0, 111, 0, 112, 0, 106, 108, 92, 83,
522 0, 0, 37, 107, 115, 113, 114, 116, 88, 84,
526 static const short yydefgoto[] = { 241,
527 8, 9, 10, 11, 30, 31, 32, 117, 118, 119,
528 33, 34, 72, 39, 70, 129, 57, 58, 59, 60,
529 83, 87, 88, 89, 135, 122, 35, 180, 195, 130,
530 131, 132, 133, 211, 212, 196
533 static const short yypact[] = { 158,
534 13,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 158, 185,
535 -26, 44,-32768, 185, 185, 168, 51, 185, 33,-32768,
536 -32768,-32768,-32768, 43, 138, 43, 46,-32768,-32768, 186,
537 -32768, 107,-32768,-32768,-32768,-32768, 67, 71, 82, 271,
538 -32768,-32768,-32768,-32768, 176, 280, 95, 102,-32768,-32768,
539 -32768,-32768,-32768,-32768, 238, 108,-32768, 86,-32768, 112,
540 73, 111,-32768,-32768, 238, 43, 114, 92, 105, 96,
541 121, 144,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 145,
542 131, 86,-32768,-32768, 147, 154,-32768, 238,-32768, 133,
543 161, 177, 152, 41, 71,-32768, 195, 204, 200, 255,
544 -32768, 207, 239, 246,-32768, 1,-32768, 256, 238, 240,
545 1, 238, 8, -10, -5, 255, 155, 272, 257, 274,
546 -32768,-32768,-32768, 238, 262, 255, 258, 20, 282, 260,
547 -32768, 259,-32768,-32768, 34,-32768,-32768, 264, 284, 255,
548 287,-32768, 285, 268,-32768,-32768, 286, 290,-32768, 269,
549 -32768,-32768,-32768,-32768, 270, 291, 273, 238, -3, 294,
550 221,-32768, 297, 255, 276, 277, 279,-32768,-32768,-32768,
551 -32768, 294,-32768, -15, 294,-32768, 281, 299, -2, 41,
552 -32768,-32768,-32768, 283, 255, 294, 255, 41, 289,-32768,
553 41, 302, 89, 300, 305,-32768,-32768, 294, 288, 41,
554 292,-32768, 304,-32768, 89,-32768, 293, 3, 9, 295,
555 35,-32768,-32768, -2, 41, 294,-32768, 294, 298, 49,
556 17, 17,-32768, 17,-32768, 17,-32768,-32768,-32768,-32768,
557 41, 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
561 static const short yypgoto[] = {-32768,
562 52, 45, 322,-32768,-32768, 306, -22, 214, 222, 224,
563 -32768,-32768,-32768, -20, 245, -24, 301,-32768, 53,-32768,
564 261, 250,-32768, 54,-32768, -175,-32768, -165, 130, -114,
565 187,-32768, 188, 141, -151, -115
572 static const short yytable[] = { 149,
573 56, 150, 55, 189, 197, 61, 188, 67, 113, 191,
574 16, 157, 202, 145, 146, 204, 145, 146, 177, 102,
575 200, 145, 146, 190, 217, 166, 142, 145, 146, 115,
576 80, 147, 215, 12, 194, 145, 146, 178, 86, 230,
577 91, 103, 222, 148, 143, 92, 148, 17, 224, 184,
578 231, 148, 232, 206, 15, 239, 240, 148, 18, 228,
579 13, -97, 104, 108, 158, 148, 13, 206, 228, 13,
580 199, 36, 201, 37, 207, 162, 227, 120, 163, 121,
581 208, 209, 210, 38, 139, 68, 62, 141, 207, 69,
582 234, 85, 223, 225, 208, 209, 210, 75, 77, 155,
583 71, 20, 21, 22, 23, 235, 236, 206, 237, 78,
584 238, 40, 41, 42, 43, 44, 79, 45, 46, 47,
585 48, 49, 50, 51, 52, 53, 81, 54, 207, 82,
586 84, 90, 93, 94, 208, 209, 210, 96, 105, 107,
587 65, 66, 40, 41, 42, 43, 44, 95, 45, 46,
588 47, 48, 49, 50, 51, 52, 53, 136, 54, 137,
589 1, 97, 98, 99, 105, 102, 20, 21, 22, 23,
590 113, 100, 106, 114, 109, 20, 21, 22, 23, 110,
591 2, 3, 4, 5, 6, 7, 19, 103, 47, 48,
592 49, 115, 116, 74, 115, 111, 20, 21, 22, 23,
593 24, 25, 26, 27, 19, 28, 29, 2, 3, 4,
594 5, 6, 7, 124, 20, 21, 22, 23, 24, 25,
595 26, 27, 125, 63, 29, 40, 41, 42, 43, 44,
596 181, 45, 46, 47, 48, 49, 50, 51, 52, 53,
597 126, 54, 40, 41, 42, 43, 44, 103, 45, 46,
598 47, 48, 49, 50, 51, 52, 53, 134, 54, 40,
599 127, 42, 43, 44, 102, 45, 46, 47, 48, 49,
600 50, 51, 52, 128, 138, 54, 41, 42, 43, 44,
601 140, 45, 46, 47, 48, 49, 50, 51, 52, 53,
602 113, 54, 47, 48, 49, 153, 154, 76, 156, -96,
603 159, 160, 165, 161, 164, 167, 169, 168, 170, 171,
604 172, 173, 179, 174, 175, 183, 185, 193, 186, 187,
605 205, 192, 213, 214, 198, 203, 219, 242, 243, 216,
606 14, 152, 221, 218, 226, 64, 233, 144, 151, 123,
607 73, 112, 101, 229, 176, 220, 0, 0, 182
610 static const short yycheck[] = { 115,
611 25, 116, 25, 19, 180, 26, 172, 32, 19, 175,
612 37, 126, 188, 19, 20, 191, 19, 20, 22, 19,
613 186, 19, 20, 39, 200, 140, 19, 19, 20, 40,
614 55, 37, 198, 21, 37, 19, 20, 41, 61, 215,
615 65, 41, 40, 49, 37, 66, 49, 4, 40, 164,
616 216, 49, 218, 19, 10, 231, 232, 49, 14, 211,
617 9, 42, 85, 88, 45, 49, 15, 19, 220, 18,
618 185, 21, 187, 41, 40, 42, 42, 37, 45, 39,
619 46, 47, 48, 41, 109, 19, 41, 112, 40, 19,
620 42, 19, 208, 209, 46, 47, 48, 45, 46, 124,
621 19, 29, 30, 31, 32, 221, 222, 19, 224, 15,
622 226, 5, 6, 7, 8, 9, 15, 11, 12, 13,
623 14, 15, 16, 17, 18, 19, 19, 21, 40, 44,
624 19, 21, 19, 42, 46, 47, 48, 42, 85, 86,
625 34, 35, 5, 6, 7, 8, 9, 43, 11, 12,
626 13, 14, 15, 16, 17, 18, 19, 104, 21, 106,
627 3, 41, 19, 19, 111, 19, 29, 30, 31, 32,
628 19, 41, 19, 22, 42, 29, 30, 31, 32, 19,
629 23, 24, 25, 26, 27, 28, 19, 41, 13, 14,
630 15, 40, 41, 18, 40, 19, 29, 30, 31, 32,
631 33, 34, 35, 36, 19, 38, 39, 23, 24, 25,
632 26, 27, 28, 19, 29, 30, 31, 32, 33, 34,
633 35, 36, 19, 38, 39, 5, 6, 7, 8, 9,
634 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
635 41, 21, 5, 6, 7, 8, 9, 41, 11, 12,
636 13, 14, 15, 16, 17, 18, 19, 19, 21, 5,
637 6, 7, 8, 9, 19, 11, 12, 13, 14, 15,
638 16, 17, 18, 19, 19, 21, 6, 7, 8, 9,
639 41, 11, 12, 13, 14, 15, 16, 17, 18, 19,
640 19, 21, 13, 14, 15, 39, 23, 18, 37, 42,
641 19, 42, 19, 45, 41, 19, 39, 23, 23, 20,
642 42, 42, 19, 23, 42, 19, 41, 19, 42, 41,
643 19, 41, 23, 19, 42, 37, 23, 0, 0, 42,
644 9, 118, 40, 42, 40, 30, 39, 114, 117, 95,
645 40, 92, 82, 214, 158, 205, -1, -1, 161
647 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
648 #line 3 "/usr/lib/bison.simple"
649 /* This file comes from bison-1.28. */
651 /* Skeleton output parser for bison,
652 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
654 This program is free software; you can redistribute it and/or modify
655 it under the terms of the GNU General Public License as published by
656 the Free Software Foundation; either version 2, or (at your option)
659 This program is distributed in the hope that it will be useful,
660 but WITHOUT ANY WARRANTY; without even the implied warranty of
661 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
662 GNU General Public License for more details.
664 You should have received a copy of the GNU General Public License
665 along with this program; if not, write to the Free Software
666 Foundation, Inc., 59 Temple Place - Suite 330,
667 Boston, MA 02111-1307, USA. */
669 /* As a special exception, when this file is copied by Bison into a
670 Bison output file, you may use that output file without restriction.
671 This special exception was added by the Free Software Foundation
672 in version 1.24 of Bison. */
674 /* This is the parser code that is written into each bison parser
675 when the %semantic_parser declaration is not specified in the grammar.
676 It was written by Richard Stallman by simplifying the hairy parser
677 used when %semantic_parser is specified. */
679 #ifndef YYSTACK_USE_ALLOCA
681 #define YYSTACK_USE_ALLOCA
682 #else /* alloca not defined */
684 #define YYSTACK_USE_ALLOCA
685 #define alloca __builtin_alloca
686 #else /* not GNU C. */
687 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
688 #define YYSTACK_USE_ALLOCA
690 #else /* not sparc */
691 /* We think this test detects Watcom and Microsoft C. */
692 /* This used to test MSDOS, but that is a bad idea
693 since that symbol is in the user namespace. */
694 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
695 #if 0 /* No need for malloc.h, which pollutes the namespace;
696 instead, just don't use alloca. */
699 #else /* not MSDOS, or __TURBOC__ */
701 /* I don't know what this was needed for, but it pollutes the namespace.
702 So I turned it off. rms, 2 May 1997. */
703 /* #include <malloc.h> */
705 #define YYSTACK_USE_ALLOCA
706 #else /* not MSDOS, or __TURBOC__, or _AIX */
708 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
709 and on HPUX 10. Eventually we can turn this on. */
710 #define YYSTACK_USE_ALLOCA
711 #define alloca __builtin_alloca
714 #endif /* not _AIX */
715 #endif /* not MSDOS, or __TURBOC__ */
716 #endif /* not sparc */
717 #endif /* not GNU C */
718 #endif /* alloca not defined */
719 #endif /* YYSTACK_USE_ALLOCA not defined */
721 #ifdef YYSTACK_USE_ALLOCA
722 #define YYSTACK_ALLOC alloca
724 #define YYSTACK_ALLOC malloc
727 /* Note: there must be only one dollar sign in this file.
728 It is replaced by the list of actions, each action
729 as one case of the switch. */
731 #define yyerrok (yyerrstatus = 0)
732 #define yyclearin (yychar = YYEMPTY)
735 #define YYACCEPT goto yyacceptlab
736 #define YYABORT goto yyabortlab
737 #define YYERROR goto yyerrlab1
738 /* Like YYERROR except do call yyerror.
739 This remains here temporarily to ease the
740 transition to the new meaning of YYERROR, for GCC.
741 Once GCC version 2 has supplanted version 1, this can go. */
742 #define YYFAIL goto yyerrlab
743 #define YYRECOVERING() (!!yyerrstatus)
744 #define YYBACKUP(token, value) \
746 if (yychar == YYEMPTY && yylen == 1) \
747 { yychar = (token), yylval = (value); \
748 yychar1 = YYTRANSLATE (yychar); \
753 { yyerror ("syntax error: cannot back up"); YYERROR; } \
757 #define YYERRCODE 256
760 #define YYLEX yylex()
766 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
768 #define YYLEX yylex(&yylval, &yylloc)
770 #else /* not YYLSP_NEEDED */
772 #define YYLEX yylex(&yylval, YYLEX_PARAM)
774 #define YYLEX yylex(&yylval)
776 #endif /* not YYLSP_NEEDED */
779 /* If nonreentrant, generate the variables here */
783 int yychar; /* the lookahead symbol */
784 YYSTYPE yylval; /* the semantic value of the */
785 /* lookahead symbol */
788 YYLTYPE yylloc; /* location data for the lookahead */
792 int yynerrs; /* number of parse errors so far */
793 #endif /* not YYPURE */
796 int yydebug; /* nonzero means print parse trace */
797 /* Since this is uninitialized, it does not stop multiple parsers
801 /* YYINITDEPTH indicates the initial size of the parser's stacks */
804 #define YYINITDEPTH 200
807 /* YYMAXDEPTH is the maximum size the stacks can grow to
808 (effective only if the built-in stack extension method is used). */
815 #define YYMAXDEPTH 10000
818 /* Define __yy_memcpy. Note that the size argument
819 should be passed with type unsigned int, because that is what the non-GCC
820 definitions require. With GCC, __builtin_memcpy takes an arg
821 of type size_t, but it can handle unsigned int. */
823 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
824 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
825 #else /* not GNU C or C++ */
828 /* This is the most reliable way to avoid incompatibilities
829 in available built-in functions on various systems. */
831 __yy_memcpy (to, from, count)
836 register char *f = from;
837 register char *t = to;
838 register int i = count;
844 #else /* __cplusplus */
846 /* This is the most reliable way to avoid incompatibilities
847 in available built-in functions on various systems. */
849 __yy_memcpy (char *to, char *from, unsigned int count)
851 register char *t = to;
852 register char *f = from;
853 register int i = count;
862 #line 217 "/usr/lib/bison.simple"
864 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
865 into yyparse. The argument should have type void *.
866 It should actually point to an object.
867 Grammar actions can access the variable by casting it
868 to the proper pointer type. */
872 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
873 #define YYPARSE_PARAM_DECL
874 #else /* not __cplusplus */
875 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
876 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
877 #endif /* not __cplusplus */
878 #else /* not YYPARSE_PARAM */
879 #define YYPARSE_PARAM_ARG
880 #define YYPARSE_PARAM_DECL
881 #endif /* not YYPARSE_PARAM */
883 /* Prevent warning if -Wstrict-prototypes. */
886 int yyparse (void *);
893 yyparse(YYPARSE_PARAM_ARG)
896 register int yystate;
898 register short *yyssp;
899 register YYSTYPE *yyvsp;
900 int yyerrstatus; /* number of tokens to shift before error messages enabled */
901 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
903 short yyssa[YYINITDEPTH]; /* the state stack */
904 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
906 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
907 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
910 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
911 YYLTYPE *yyls = yylsa;
914 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
916 #define YYPOPSTACK (yyvsp--, yyssp--)
919 int yystacksize = YYINITDEPTH;
920 int yyfree_stacks = 0;
931 YYSTYPE yyval; /* the variable used to return */
932 /* semantic values from the action */
939 fprintf(stderr, "Starting parse\n");
945 yychar = YYEMPTY; /* Cause a token to be read. */
947 /* Initialize stack pointers.
948 Waste one element of value and location stack
949 so that they stay on the same level as the state stack.
950 The wasted elements are never initialized. */
958 /* Push a new state, which is found in yystate . */
959 /* In all cases, when you get here, the value and location stacks
960 have just been pushed. so pushing a state here evens the stacks. */
965 if (yyssp >= yyss + yystacksize - 1)
967 /* Give user a chance to reallocate the stack */
968 /* Use copies of these so that the &'s don't force the real ones into memory. */
969 YYSTYPE *yyvs1 = yyvs;
972 YYLTYPE *yyls1 = yyls;
975 /* Get the current used size of the three stacks, in elements. */
976 int size = yyssp - yyss + 1;
979 /* Each stack pointer address is followed by the size of
980 the data in use in that stack, in bytes. */
982 /* This used to be a conditional around just the two extra args,
983 but that might be undefined if yyoverflow is a macro. */
984 yyoverflow("parser stack overflow",
985 &yyss1, size * sizeof (*yyssp),
986 &yyvs1, size * sizeof (*yyvsp),
987 &yyls1, size * sizeof (*yylsp),
990 yyoverflow("parser stack overflow",
991 &yyss1, size * sizeof (*yyssp),
992 &yyvs1, size * sizeof (*yyvsp),
996 yyss = yyss1; yyvs = yyvs1;
1000 #else /* no yyoverflow */
1001 /* Extend the stack our own way. */
1002 if (yystacksize >= YYMAXDEPTH)
1004 yyerror("parser stack overflow");
1016 if (yystacksize > YYMAXDEPTH)
1017 yystacksize = YYMAXDEPTH;
1018 #ifndef YYSTACK_USE_ALLOCA
1021 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1022 __yy_memcpy ((char *)yyss, (char *)yyss1,
1023 size * (unsigned int) sizeof (*yyssp));
1024 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1025 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1026 size * (unsigned int) sizeof (*yyvsp));
1028 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1029 __yy_memcpy ((char *)yyls, (char *)yyls1,
1030 size * (unsigned int) sizeof (*yylsp));
1032 #endif /* no yyoverflow */
1034 yyssp = yyss + size - 1;
1035 yyvsp = yyvs + size - 1;
1037 yylsp = yyls + size - 1;
1042 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1045 if (yyssp >= yyss + yystacksize - 1)
1051 fprintf(stderr, "Entering state %d\n", yystate);
1057 /* Do appropriate processing given the current state. */
1058 /* Read a lookahead token if we need one and don't already have one. */
1061 /* First try to decide what to do without reference to lookahead token. */
1063 yyn = yypact[yystate];
1067 /* Not known => get a lookahead token if don't already have one. */
1069 /* yychar is either YYEMPTY or YYEOF
1070 or a valid token in external form. */
1072 if (yychar == YYEMPTY)
1076 fprintf(stderr, "Reading a token: ");
1081 /* Convert token to internal form (in yychar1) for indexing tables with */
1083 if (yychar <= 0) /* This means end of input. */
1086 yychar = YYEOF; /* Don't call YYLEX any more */
1090 fprintf(stderr, "Now at end of input.\n");
1095 yychar1 = YYTRANSLATE(yychar);
1100 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1101 /* Give the individual parser a way to print the precise meaning
1102 of a token, for further debugging info. */
1104 YYPRINT (stderr, yychar, yylval);
1106 fprintf (stderr, ")\n");
1112 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1117 /* yyn is what to do for this token type in this state.
1118 Negative => reduce, -yyn is rule number.
1119 Positive => shift, yyn is new state.
1120 New state is final state => don't bother to shift,
1121 just return success.
1122 0, or most negative number => error. */
1137 /* Shift the lookahead token. */
1141 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1144 /* Discard the token being shifted unless it is eof. */
1145 if (yychar != YYEOF)
1153 /* count tokens shifted since error; after three, turn off error status. */
1154 if (yyerrstatus) yyerrstatus--;
1159 /* Do the default action for the current state. */
1162 yyn = yydefact[yystate];
1166 /* Do a reduction. yyn is the number of a rule to reduce with. */
1170 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1177 fprintf (stderr, "Reducing via rule %d (line %d), ",
1180 /* Print the symbols being reduced, and their result. */
1181 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1182 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1183 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1209 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1211 nodes = g_list_append(nodes,node);
1212 g_string_free(yyvsp[0].cbuf,FALSE);
1218 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1220 nodes = g_list_append(nodes,node);
1221 g_string_free(yyvsp[0].cbuf,FALSE);
1227 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1229 nodes = g_list_append(nodes,node);
1230 g_string_free(yyvsp[0].cbuf,FALSE);
1236 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1238 nodes = g_list_append(nodes,node);
1239 g_string_free(yyvsp[0].cbuf,FALSE);
1245 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1247 nodes = g_list_append(nodes,node);
1248 g_string_free(yyvsp[0].cbuf,FALSE);
1254 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1256 nodes = g_list_append(nodes,node);
1257 g_string_free(yyvsp[0].cbuf,FALSE);
1271 ((Class *)class)->nodes = class_nodes;
1273 nodes = g_list_append(nodes,class);
1279 ((Class *)class)->nodes = NULL;
1281 nodes = g_list_append(nodes,class);
1287 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1316 { the_scope = PUBLIC_SCOPE; ;
1320 { the_scope = PRIVATE_SCOPE; ;
1324 { the_scope = PROTECTED_SCOPE; ;
1328 { the_scope = CLASS_SCOPE; ;
1333 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1334 g_free(yyvsp[-1].id);
1335 destructor = yyvsp[0].id;
1336 destructor_line = line_no;
1337 destructor_simple = TRUE;
1339 g_free(yyvsp[-1].id);
1340 g_free(yyvsp[0].id);
1341 yyerror(_("parse error"));
1349 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1350 g_free(yyvsp[-2].id);
1351 destructor = (yyvsp[0].cbuf)->str;
1352 g_string_free(yyvsp[0].cbuf, FALSE);
1353 destructor_line = ccode_line;
1354 destructor_simple = FALSE;
1356 g_free(yyvsp[-2].id);
1357 g_string_free(yyvsp[0].cbuf, TRUE);
1358 yyerror(_("parse error"));
1366 initializer = yyvsp[0].id;
1367 initializer_line = ccode_line;
1373 initializer = (yyvsp[0].cbuf)->str;
1374 initializer_line = ccode_line;
1375 g_string_free(yyvsp[0].cbuf, FALSE);
1388 { destructor = NULL; ;
1392 { initializer = NULL; ;
1404 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1410 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1416 if(strcmp(yyvsp[-6].id,"get")==0 &&
1417 strcmp(yyvsp[-3].id,"set")==0) {
1419 Type *type = pop_type();
1420 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1421 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1422 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1423 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1425 g_string_free(yyvsp[-4].cbuf,FALSE);
1426 g_string_free(yyvsp[-1].cbuf,FALSE);
1427 class_nodes = g_list_append(class_nodes,node);
1428 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1429 strcmp(yyvsp[-3].id,"get")==0) {
1431 Type *type = pop_type();
1432 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1433 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1434 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1435 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1437 g_string_free(yyvsp[-1].cbuf,FALSE);
1438 g_string_free(yyvsp[-4].cbuf,FALSE);
1439 class_nodes = g_list_append(class_nodes,node);
1441 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1442 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1443 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1444 g_string_free(yyvsp[-1].cbuf,TRUE);
1445 g_string_free(yyvsp[-4].cbuf,TRUE);
1446 yyerror(_("parse error"));
1454 if(strcmp(yyvsp[-3].id,"get")==0) {
1456 Type *type = pop_type();
1457 g_free(yyvsp[-3].id);
1458 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1459 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1460 NULL,0, yyvsp[-7].line);
1461 g_string_free(yyvsp[-1].cbuf,FALSE);
1462 class_nodes = g_list_append(class_nodes,node);
1463 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1465 Type *type = pop_type();
1466 g_free(yyvsp[-3].id);
1467 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1468 NULL,0,(yyvsp[-1].cbuf)->str,
1469 yyvsp[-2].line, yyvsp[-7].line);
1470 g_string_free(yyvsp[-1].cbuf,FALSE);
1471 class_nodes = g_list_append(class_nodes,node);
1473 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1474 g_free(yyvsp[-4].id);
1475 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1476 g_string_free(yyvsp[-1].cbuf,TRUE);
1477 yyerror(_("parse error"));
1486 char *get, *set = NULL;
1491 if(strcmp(yyvsp[0].id, "link")!=0 &&
1492 strcmp(yyvsp[0].id, "stringlink")!=0 &&
1493 strcmp(yyvsp[0].id, "objectlink")!=0) {
1494 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1495 g_free(yyvsp[-1].id);
1496 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1497 yyerror(_("parse error"));
1503 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1504 if(var->scope == PRIVATE_SCOPE)
1505 root = "self->_priv";
1506 else if(var->scope == CLASS_SCOPE)
1507 root = "SELF_CLASS(GTK_OBJECT(self)->klass)";
1511 if(strcmp(yyvsp[0].id, "link")==0) {
1512 set = g_strdup_printf("%s->%s = ARG;",
1513 root, yyvsp[-1].id);
1514 } else if(strcmp(yyvsp[0].id, "stringlink")==0) {
1515 set = g_strdup_printf("g_free(%s->%s); "
1516 "%s->%s = g_strdup(ARG);",
1518 root, yyvsp[-1].id);
1519 } else if(strcmp(yyvsp[0].id, "objectlink")==0) {
1520 set = g_strdup_printf(
1522 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1525 "gtk_object_ref(GTK_OBJECT(%s->%s));",
1533 root, yyvsp[-1].id);
1535 g_assert_not_reached();
1538 /* get is the same for everything */
1539 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1541 g_free(yyvsp[0].id);
1545 type = copy_type(var->vtype);
1547 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1548 yyvsp[-1].id, get, yyvsp[-4].line,
1549 set, yyvsp[-4].line, yyvsp[-4].line);
1550 class_nodes = g_list_append(class_nodes,node);
1556 if(strcmp(yyvsp[-2].id,"type")!=0) {
1557 g_free(yyvsp[-4].id);
1558 g_free(yyvsp[-2].id);
1559 yyerror(_("parse error"));
1562 yyval.id = yyvsp[-4].id;
1568 yyval.id = yyvsp[0].id;
1569 typestack = g_list_prepend(typestack,NULL);
1574 { yyval.list = yyvsp[-1].list; ;
1578 { yyval.list = NULL; ;
1583 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1589 yyval.list = g_list_append(NULL,yyvsp[0].id);
1599 Type *type = typestack->data;
1600 char *oldname = type->name;
1601 type->name = g_strconcat("const ",oldname,NULL);
1608 Node *node = new_type(0,yyvsp[0].id,NULL);
1609 typestack = g_list_prepend(typestack,node);
1615 Node *node = new_type(stars,yyvsp[-1].id,NULL);
1617 typestack = g_list_prepend(typestack,node);
1623 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1629 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1635 yyval.id = g_strdup(yyvsp[0].id);
1641 yyval.id = g_strdup("unsigned char");
1647 yyval.id = g_strdup("signed char");
1653 yyval.id = g_strdup("char");
1659 yyval.id = g_strdup("double");
1665 yyval.id = g_strdup("float");
1671 yyval.id = yyvsp[0].id;
1677 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1678 g_free(yyvsp[0].id);
1684 yyval.id = yyvsp[0].id;
1690 yyval.id = g_strdup("void");
1696 yyval.id = "long int";
1708 yyval.id = "short int";
1732 yyval.id = "union ";
1738 yyval.id = "struct ";
1752 if(strcmp(yyvsp[-1].id, "first")==0)
1753 yyval.sigtype = SIGNAL_FIRST_METHOD;
1754 else if(strcmp(yyvsp[-1].id, "last")==0)
1755 yyval.sigtype = SIGNAL_LAST_METHOD;
1757 yyerror(_("signal must be 'first' or 'last'"));
1758 g_free(yyvsp[-1].id);
1761 g_free(yyvsp[-1].id);
1767 yyval.sigtype = SIGNAL_LAST_METHOD;
1773 if(strcmp(yyvsp[-1].id,"first")==0)
1774 yyval.sigtype = SIGNAL_FIRST_METHOD;
1775 else if(strcmp(yyvsp[-1].id,"last")==0)
1776 yyval.sigtype = SIGNAL_LAST_METHOD;
1778 yyerror(_("signal must be 'first' or 'last'"));
1779 g_free(yyvsp[-1].id);
1782 g_free(yyvsp[-1].id);
1788 if(strcmp(yyvsp[-2].id,"first")==0)
1789 yyval.sigtype = SIGNAL_FIRST_METHOD;
1790 else if(strcmp(yyvsp[-2].id,"last")==0)
1791 yyval.sigtype = SIGNAL_LAST_METHOD;
1793 yyerror(_("signal must be 'first' or 'last'"));
1794 g_free(yyvsp[-2].id);
1797 g_free(yyvsp[-2].id);
1803 yyval.sigtype = SIGNAL_LAST_METHOD;
1809 /* the_scope was default thus public */
1810 the_scope = PUBLIC_SCOPE;
1816 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1822 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1828 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1833 { yyval.cbuf = yyvsp[0].cbuf; ;
1837 { yyval.cbuf = NULL; ;
1843 yyerror(_("signal without 'self' as "
1844 "first parameter"));
1845 free_all_global_state();
1848 if(the_scope == CLASS_SCOPE) {
1849 yyerror(_("a method cannot be of class scope"));
1850 free_all_global_state();
1853 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1854 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1855 ccode_line, vararg, yyvsp[-8].list);
1862 yyerror(_("signal without 'self' as "
1863 "first parameter"));
1864 free_all_global_state();
1867 if(the_scope == CLASS_SCOPE) {
1868 yyerror(_("a method cannot be of class scope"));
1869 free_all_global_state();
1872 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1873 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1874 ccode_line, vararg, yyvsp[-8].list);
1881 yyerror(_("virtual method without 'self' as "
1882 "first parameter"));
1883 free_all_global_state();
1886 if(the_scope == CLASS_SCOPE) {
1887 yyerror(_("a method cannot be of class scope"));
1888 free_all_global_state();
1891 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1892 yyvsp[0].cbuf, yyvsp[-8].line,
1893 ccode_line, vararg, NULL);
1900 yyerror(_("virtual method without 'self' as "
1901 "first parameter"));
1902 free_all_global_state();
1905 if(the_scope == CLASS_SCOPE) {
1906 yyerror(_("a method cannot be of class scope"));
1907 free_all_global_state();
1910 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1911 yyvsp[0].cbuf, yyvsp[-7].line,
1912 ccode_line, vararg, NULL);
1919 yyerror(_("virtual method without 'self' as "
1920 "first parameter"));
1921 free_all_global_state();
1924 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1925 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
1926 ccode_line, vararg, NULL);
1932 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
1933 yyvsp[-5].id, yyvsp[0].cbuf,
1934 yyvsp[-10].line, ccode_line,
1941 if(the_scope == CLASS_SCOPE) {
1942 yyerror(_("a method cannot be of class scope"));
1943 free_all_global_state();
1946 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
1947 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
1954 if(strcmp(yyvsp[-4].id, "init")==0) {
1955 push_init_arg(yyvsp[-2].id,FALSE);
1956 push_function(NO_SCOPE, INIT_METHOD, NULL,
1957 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1958 ccode_line, FALSE, NULL);
1959 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
1960 push_init_arg(yyvsp[-2].id,TRUE);
1961 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
1962 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1963 ccode_line, FALSE, NULL);
1965 g_free(yyvsp[-4].id);
1966 g_free(yyvsp[-2].id);
1967 g_string_free(yyvsp[0].cbuf,TRUE);
1968 yyerror(_("parse error "
1969 "(untyped blocks must be init or "
1978 g_free(onerror); onerror = NULL;
1979 g_free(defreturn); defreturn = NULL;
1980 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1981 g_free(yyvsp[-1].id);
1982 g_free(yyvsp[0].id);
1983 yyerror(_("parse error"));
1986 g_free(yyvsp[-1].id);
1992 g_free(onerror); onerror = NULL;
1993 g_free(defreturn); defreturn = NULL;
1994 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
1995 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1996 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1997 yyerror(_("parse error"));
2000 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2001 onerror = defreturn = NULL;
2002 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2003 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2004 yyerror(_("parse error"));
2007 g_free(yyvsp[-3].id);
2008 g_free(yyvsp[-1].id);
2014 g_free(onerror); onerror = NULL;
2015 g_free(defreturn); defreturn = NULL;
2020 { yyval.id = yyvsp[0].id; ;
2025 yyval.id = (yyvsp[1].cbuf)->str;
2026 g_string_free(yyvsp[1].cbuf, FALSE);
2031 { vararg = FALSE; has_self = FALSE; ;
2038 if(strcmp(yyvsp[0].id,"self")==0)
2039 push_self(yyvsp[0].id);
2041 g_free(yyvsp[0].id);
2042 yyerror(_("parse error"));
2051 if(strcmp(yyvsp[-2].id,"self")==0)
2052 push_self(yyvsp[-2].id);
2054 g_free(yyvsp[-2].id);
2055 yyerror(_("parse error"));
2062 { has_self = FALSE; ;
2083 push_funcarg(yyvsp[0].id,NULL);
2089 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2095 if(strcmp(yyvsp[-2].id,"check")!=0) {
2096 yyerror(_("parse error"));
2099 g_free(yyvsp[-2].id);
2100 push_funcarg(yyvsp[-4].id,NULL);
2106 if(strcmp(yyvsp[-2].id,"check")!=0) {
2107 yyerror(_("parse error"));
2110 g_free(yyvsp[-2].id);
2111 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2125 if(strcmp(yyvsp[0].id,"type")==0) {
2126 Node *node = new_check(TYPE_CHECK,NULL);
2127 checks = g_list_append(checks,node);
2128 } else if(strcmp(yyvsp[0].id,"null")==0) {
2129 Node *node = new_check(NULL_CHECK,NULL);
2130 checks = g_list_append(checks,node);
2132 yyerror(_("parse error"));
2135 g_free(yyvsp[0].id);
2139 #line 1000 "parse.y"
2141 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2142 checks = g_list_append(checks,node);
2146 #line 1004 "parse.y"
2148 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2149 checks = g_list_append(checks,node);
2153 #line 1008 "parse.y"
2155 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2156 checks = g_list_append(checks,node);
2160 #line 1012 "parse.y"
2162 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2163 checks = g_list_append(checks,node);
2167 #line 1016 "parse.y"
2169 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2170 checks = g_list_append(checks,node);
2174 #line 1020 "parse.y"
2176 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2177 checks = g_list_append(checks,node);
2181 #line 1026 "parse.y"
2182 { yyval.id = yyvsp[0].id; ;
2185 #line 1027 "parse.y"
2187 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2188 g_free(yyvsp[0].id);
2192 #line 1031 "parse.y"
2193 { yyval.id = yyvsp[0].id; ;
2196 /* the action file gets copied in in place of this dollarsign */
2197 #line 543 "/usr/lib/bison.simple"
2208 short *ssp1 = yyss - 1;
2209 fprintf (stderr, "state stack now");
2210 while (ssp1 != yyssp)
2211 fprintf (stderr, " %d", *++ssp1);
2212 fprintf (stderr, "\n");
2222 yylsp->first_line = yylloc.first_line;
2223 yylsp->first_column = yylloc.first_column;
2224 yylsp->last_line = (yylsp-1)->last_line;
2225 yylsp->last_column = (yylsp-1)->last_column;
2230 yylsp->last_line = (yylsp+yylen-1)->last_line;
2231 yylsp->last_column = (yylsp+yylen-1)->last_column;
2235 /* Now "shift" the result of the reduction.
2236 Determine what state that goes to,
2237 based on the state we popped back to
2238 and the rule number reduced by. */
2242 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2243 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2244 yystate = yytable[yystate];
2246 yystate = yydefgoto[yyn - YYNTBASE];
2250 yyerrlab: /* here on detecting error */
2253 /* If not already recovering from an error, report this error. */
2257 #ifdef YYERROR_VERBOSE
2258 yyn = yypact[yystate];
2260 if (yyn > YYFLAG && yyn < YYLAST)
2267 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2268 for (x = (yyn < 0 ? -yyn : 0);
2269 x < (sizeof(yytname) / sizeof(char *)); x++)
2270 if (yycheck[x + yyn] == x)
2271 size += strlen(yytname[x]) + 15, count++;
2272 msg = (char *) malloc(size + 15);
2275 strcpy(msg, "parse error");
2280 for (x = (yyn < 0 ? -yyn : 0);
2281 x < (sizeof(yytname) / sizeof(char *)); x++)
2282 if (yycheck[x + yyn] == x)
2284 strcat(msg, count == 0 ? ", expecting `" : " or `");
2285 strcat(msg, yytname[x]);
2294 yyerror ("parse error; also virtual memory exceeded");
2297 #endif /* YYERROR_VERBOSE */
2298 yyerror("parse error");
2302 yyerrlab1: /* here on error raised explicitly by an action */
2304 if (yyerrstatus == 3)
2306 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2308 /* return failure if at end of input */
2309 if (yychar == YYEOF)
2314 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2320 /* Else will try to reuse lookahead token
2321 after shifting the error token. */
2323 yyerrstatus = 3; /* Each real token shifted decrements this */
2327 yyerrdefault: /* current state does not do anything special for the error token. */
2330 /* This is wrong; only states that explicitly want error tokens
2331 should shift them. */
2332 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2333 if (yyn) goto yydefault;
2336 yyerrpop: /* pop the current state because it cannot handle the error token */
2338 if (yyssp == yyss) YYABORT;
2348 short *ssp1 = yyss - 1;
2349 fprintf (stderr, "Error: state stack now");
2350 while (ssp1 != yyssp)
2351 fprintf (stderr, " %d", *++ssp1);
2352 fprintf (stderr, "\n");
2358 yyn = yypact[yystate];
2363 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2382 fprintf(stderr, "Shifting error token, ");
2394 /* YYACCEPT comes here. */
2406 /* YYABORT comes here. */
2417 #line 1034 "parse.y"