2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
49 #include "treefuncs.h"
57 static GList *class_nodes = NULL;
60 static GList *typestack = NULL;
62 static GList *funcargs = NULL;
63 static GList *checks = NULL;
64 static int has_self = FALSE;
65 static int vararg = FALSE;
67 /* destructor and initializer for variables */
68 static char *destructor = NULL;
69 static int destructor_line = 0;
70 static gboolean destructor_simple = TRUE;
71 static char *initializer = NULL;
72 static int initializer_line = 0;
74 static char *onerror = NULL;
75 static char *defreturn = NULL;
77 static GList *gtktypes = NULL;
79 /* this can be a global as we will only do one function at a time
81 static int the_scope = NO_SCOPE;
86 extern int ccode_line;
97 if(strcmp(yytext,"\n")==0) {
98 out=g_strconcat("Error: ",str," before newline",NULL);
99 } else if(yytext[0]=='\0') {
100 out=g_strconcat("Error: ", str, " at end of input", NULL);
102 char *tmp = g_strdup(yytext);
103 while((p=strchr(tmp, '\n')))
106 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
110 fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
119 Type *type = typestack->data;
120 typestack = g_list_remove(typestack,typestack->data);
125 push_variable(char *name, int scope, int line_no, char *postfix)
128 Type *type = pop_type();
130 type->postfix = postfix;
132 var = new_variable(scope, type, name, line_no,
133 destructor, destructor_line,
135 initializer, initializer_line);
136 class_nodes = g_list_append(class_nodes, var);
140 push_function(int scope, int method, char *oid, char *id,
141 GString *cbuf, int line_no, int ccode_line,
142 gboolean vararg, GList *flags)
148 if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) {
151 type = (Type *)new_type(0,g_strdup("void"),NULL);
154 /* a complicated and ugly test to figure out if we have
155 the wrong number of types for a signal */
156 if((method == SIGNAL_FIRST_METHOD ||
157 method == SIGNAL_LAST_METHOD) &&
158 g_list_length(gtktypes) != g_list_length(funcargs) &&
159 !(g_list_length(funcargs) == 1 &&
160 g_list_length(gtktypes) == 2 &&
161 strcmp(gtktypes->next->data, "NONE")==0)) {
162 print_error(TRUE, _("The number of GTK arguments and "
163 "function arguments for a signal "
164 "don't seem to match"), line_no);
166 if(g_list_length(gtktypes) > 2) {
168 for(li = gtktypes->next; li; li = li->next) {
169 if(strcmp(li->data, "NONE")==0) {
171 _("NONE can only appear in an "
172 "argument list by itself"),
179 c_cbuf = p = cbuf->str;
180 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
187 node = new_method(scope, method, type, oid, gtktypes, flags,
188 id, funcargs, onerror, defreturn, c_cbuf, line_no,
193 /*only free segment if we haven't passed it
202 class_nodes = g_list_append(class_nodes, node);
206 free_all_global_state(void)
213 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
214 g_list_free(gtktypes);
217 free_node_list(funcargs);
222 push_funcarg(char *name, char *postfix)
225 Type *type = pop_type();
227 type->postfix = postfix;
229 node = new_funcarg(type, name, checks);
232 funcargs = g_list_append(funcargs, node);
236 push_init_arg(char *name, int is_class)
243 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
245 tn = g_strdup(((Class *)class)->otype);
247 type = new_type(1,tn,NULL);
248 node = new_funcarg((Type *)type,name,NULL);
249 funcargs = g_list_prepend(funcargs, node);
258 type = new_type(1,g_strdup(((Class *)class)->otype),NULL);
259 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
260 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
261 node = new_funcarg((Type *)type,id,ch);
262 funcargs = g_list_prepend(funcargs, node);
266 find_var_or_die(const char *id, int line)
271 for(li = class_nodes; li != NULL; li = li->next) {
273 Node *node = li->data;
274 if(node->type != VARIABLE_NODE)
277 if(strcmp(var->id, id)==0)
281 s = g_strdup_printf(_("Variable %s not defined here"), id);
282 print_error(FALSE, s, line);
284 g_assert_not_reached();
289 set_return_value(char *type, char *val)
291 if(strcmp(type, "onerror")==0) {
297 } else if(strcmp(type, "defreturn")==0) {
331 #define YYFLAG -32768
334 #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 86)
336 static const char yytranslate[] = { 0,
337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340 2, 2, 47, 2, 2, 2, 2, 2, 2, 40,
341 41, 43, 2, 44, 48, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 38, 46,
343 39, 45, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 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, 36, 42, 37, 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, 2, 2, 2, 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, 1, 3, 4, 5, 6,
363 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
364 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
365 27, 28, 29, 30, 31, 32, 33, 34, 35
369 static const short yyprhs[] = { 0,
370 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
371 24, 27, 29, 34, 38, 43, 46, 48, 50, 52,
372 54, 56, 58, 60, 62, 65, 69, 72, 76, 79,
373 82, 84, 86, 87, 93, 100, 112, 121, 127, 133,
374 135, 139, 140, 144, 146, 148, 151, 153, 156, 159,
375 162, 164, 167, 170, 172, 174, 176, 178, 181, 183,
376 185, 188, 190, 193, 195, 197, 199, 201, 203, 206,
377 208, 211, 213, 217, 221, 224, 226, 231, 235, 237,
378 240, 242, 253, 265, 275, 285, 294, 306, 315, 321,
379 324, 329, 330, 332, 335, 337, 339, 343, 345, 349,
380 351, 355, 357, 360, 364, 371, 379, 382, 384, 386,
381 389, 392, 396, 400, 404, 408, 410, 413
384 static const short yyrhs[] = { 51,
385 52, 51, 0, 52, 51, 0, 51, 52, 0, 52,
386 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
387 0, 28, 0, 51, 50, 0, 50, 0, 53, 36,
388 54, 37, 0, 53, 36, 37, 0, 3, 21, 4,
389 21, 0, 54, 55, 0, 55, 0, 76, 0, 60,
390 0, 61, 0, 38, 0, 29, 0, 30, 0, 31,
391 0, 19, 19, 0, 19, 36, 23, 0, 39, 85,
392 0, 39, 36, 23, 0, 57, 58, 0, 58, 57,
393 0, 58, 0, 57, 0, 0, 56, 65, 19, 59,
394 38, 0, 56, 65, 19, 22, 59, 38, 0, 32,
395 63, 62, 19, 19, 36, 23, 19, 36, 23, 38,
396 0, 32, 63, 62, 19, 19, 36, 23, 38, 0,
397 32, 63, 62, 19, 19, 0, 19, 40, 19, 65,
398 41, 0, 19, 0, 40, 64, 41, 0, 0, 19,
399 42, 64, 0, 19, 0, 66, 0, 5, 66, 0,
400 67, 0, 67, 70, 0, 12, 68, 0, 11, 68,
401 0, 68, 0, 12, 18, 0, 11, 18, 0, 18,
402 0, 17, 0, 16, 0, 19, 0, 69, 19, 0,
403 21, 0, 6, 0, 13, 15, 0, 13, 0, 14,
404 15, 0, 14, 0, 15, 0, 9, 0, 8, 0,
405 7, 0, 43, 70, 0, 43, 0, 19, 73, 0,
406 73, 0, 56, 19, 73, 0, 19, 56, 73, 0,
407 56, 73, 0, 71, 0, 19, 40, 74, 41, 0,
408 74, 44, 19, 0, 19, 0, 36, 23, 0, 38,
409 0, 34, 63, 72, 65, 19, 40, 79, 41, 77,
410 75, 0, 56, 34, 63, 71, 65, 19, 40, 79,
411 41, 77, 75, 0, 33, 56, 65, 19, 40, 79,
412 41, 77, 75, 0, 56, 33, 65, 19, 40, 79,
413 41, 77, 75, 0, 33, 65, 19, 40, 79, 41,
414 77, 75, 0, 35, 40, 21, 41, 65, 19, 40,
415 79, 41, 77, 75, 0, 56, 65, 19, 40, 79,
416 41, 77, 75, 0, 19, 40, 19, 41, 75, 0,
417 19, 78, 0, 19, 78, 19, 78, 0, 0, 85,
418 0, 36, 23, 0, 6, 0, 19, 0, 19, 44,
419 80, 0, 80, 0, 81, 44, 10, 0, 81, 0,
420 81, 44, 82, 0, 82, 0, 65, 19, 0, 65,
421 19, 22, 0, 65, 19, 40, 19, 83, 41, 0,
422 65, 19, 22, 40, 19, 83, 41, 0, 83, 84,
423 0, 84, 0, 19, 0, 45, 85, 0, 46, 85,
424 0, 45, 39, 85, 0, 46, 39, 85, 0, 39,
425 39, 85, 0, 47, 39, 85, 0, 20, 0, 48,
432 static const short yyrline[] = { 0,
433 306, 307, 308, 309, 312, 318, 324, 330, 336, 342,
434 350, 351, 354, 359, 366, 371, 372, 375, 376, 377,
435 378, 381, 382, 383, 386, 399, 415, 419, 427, 428,
436 429, 430, 431, 437, 440, 444, 479, 507, 572, 581,
437 587, 588, 591, 594, 600, 601, 609, 613, 620, 623,
438 626, 629, 632, 635, 638, 641, 644, 647, 651, 654,
439 659, 662, 665, 668, 671, 676, 679, 682, 687, 688,
440 692, 704, 710, 722, 734, 737, 743, 748, 751, 756,
441 757, 761, 772, 783, 794, 805, 816, 822, 827, 848,
442 859, 878, 884, 885, 891, 892, 903, 913, 916, 917,
443 920, 921, 924, 927, 930, 938, 948, 949, 952, 965,
444 969, 973, 977, 981, 985, 991, 992, 996
449 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
451 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
452 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
453 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
454 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
455 "ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='","'('","')'",
456 "'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes","class","classdec",
457 "classcode","thing","scope","destructor","initializer","varoptions","variable",
458 "argument","argtype","flags","flaglist","type","type1","type2","integer","tspecifier",
459 "stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode","method",
460 "returnvals","retcode","funcargs","arglist","arglist1","arg","checklist","check",
465 static const short yyr1[] = { 0,
466 49, 49, 49, 49, 50, 50, 50, 50, 50, 50,
467 51, 51, 52, 52, 53, 54, 54, 55, 55, 55,
468 55, 56, 56, 56, 57, 57, 58, 58, 59, 59,
469 59, 59, 59, 60, 60, 61, 61, 61, 62, 62,
470 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
471 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
472 68, 68, 68, 68, 68, 69, 69, 69, 70, 70,
473 71, 71, 72, 72, 72, 72, 73, 74, 74, 75,
474 75, 76, 76, 76, 76, 76, 76, 76, 76, 77,
475 77, 77, 78, 78, 79, 79, 79, 79, 80, 80,
476 81, 81, 82, 82, 82, 82, 83, 83, 84, 84,
477 84, 84, 84, 84, 84, 85, 85, 85
480 static const short yyr2[] = { 0,
481 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
482 2, 1, 4, 3, 4, 2, 1, 1, 1, 1,
483 1, 1, 1, 1, 2, 3, 2, 3, 2, 2,
484 1, 1, 0, 5, 6, 11, 8, 5, 5, 1,
485 3, 0, 3, 1, 1, 2, 1, 2, 2, 2,
486 1, 2, 2, 1, 1, 1, 1, 2, 1, 1,
487 2, 1, 2, 1, 1, 1, 1, 1, 2, 1,
488 2, 1, 3, 3, 2, 1, 4, 3, 1, 2,
489 1, 10, 11, 9, 9, 8, 11, 8, 5, 2,
490 4, 0, 1, 2, 1, 1, 3, 1, 3, 1,
491 3, 1, 2, 3, 6, 7, 2, 1, 1, 2,
492 2, 3, 3, 3, 3, 1, 2, 1
495 static const short yydefact[] = { 0,
496 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
497 0, 0, 11, 3, 2, 0, 0, 1, 0, 22,
498 23, 24, 42, 0, 42, 0, 14, 21, 0, 17,
499 0, 19, 20, 18, 15, 0, 0, 0, 0, 60,
500 68, 67, 66, 0, 0, 62, 64, 65, 56, 55,
501 54, 57, 59, 0, 0, 45, 47, 51, 0, 0,
502 0, 13, 16, 0, 42, 0, 0, 44, 0, 40,
503 0, 46, 53, 50, 52, 49, 61, 63, 0, 0,
504 70, 48, 58, 0, 0, 76, 0, 72, 0, 0,
505 0, 33, 0, 0, 41, 0, 0, 0, 0, 69,
506 0, 0, 0, 71, 0, 75, 0, 0, 0, 0,
507 0, 0, 33, 0, 0, 32, 31, 0, 0, 81,
508 89, 43, 0, 38, 0, 60, 57, 0, 0, 98,
509 100, 102, 79, 0, 74, 73, 0, 0, 0, 0,
510 25, 0, 0, 118, 116, 0, 0, 27, 0, 29,
511 30, 34, 80, 0, 0, 0, 0, 103, 92, 0,
512 77, 0, 0, 0, 0, 0, 26, 35, 28, 117,
513 92, 39, 0, 92, 97, 104, 0, 0, 0, 99,
514 101, 78, 0, 0, 92, 0, 0, 0, 37, 0,
515 0, 0, 0, 90, 93, 86, 92, 0, 0, 0,
516 88, 0, 84, 0, 109, 0, 0, 0, 0, 0,
517 108, 94, 0, 0, 92, 85, 92, 0, 0, 0,
518 0, 110, 0, 111, 0, 105, 107, 91, 82, 0,
519 0, 36, 106, 114, 112, 113, 115, 87, 83, 0,
523 static const short yydefgoto[] = { 240,
524 8, 9, 10, 11, 29, 30, 31, 116, 117, 118,
525 32, 33, 71, 38, 69, 128, 56, 57, 58, 59,
526 82, 86, 87, 88, 134, 121, 34, 179, 194, 129,
527 130, 131, 132, 210, 211, 195
530 static const short yypact[] = { 136,
531 -17,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 136, 167,
532 -16, 13,-32768, 167, 167, 150, 15, 167, 19,-32768,
533 -32768,-32768, 27, 137, 27, 37,-32768,-32768, 170,-32768,
534 107,-32768,-32768,-32768,-32768, 25, 61, 98, 254,-32768,
535 -32768,-32768,-32768, 263, 269, 114, 118,-32768,-32768,-32768,
536 -32768,-32768,-32768, 221, 116,-32768, 104,-32768, 138, 73,
537 151,-32768,-32768, 221, 27, 154, 133, 155, 157, 156,
538 159,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 187, 184,
539 104,-32768,-32768, 146, 212,-32768, 221,-32768, 200, 229,
540 239, 43, 96, 61,-32768, 245, 255, 240, 238,-32768,
541 246, 260, 266,-32768, -8,-32768, 270, 221, 248, -8,
542 221, 36, 3, -1, 238, 251, 272, 256, 273,-32768,
543 -32768,-32768, 221, 257, 238, 258, 57, 276, 259,-32768,
544 253,-32768,-32768, 64,-32768,-32768, 252, 279, 238, 282,
545 -32768, 280, 264,-32768,-32768, 281, 285,-32768, 265,-32768,
546 -32768,-32768,-32768, 267, 284, 268, 221, 5, 291, 204,
547 -32768, 292, 238, 274, 271, 275,-32768,-32768,-32768,-32768,
548 291,-32768, -10, 291,-32768, 277, 294, 18, 96,-32768,
549 -32768,-32768, 278, 238, 291, 238, 96, 286,-32768, 96,
550 297, 91, 295, 301,-32768,-32768, 291, 283, 96, 287,
551 -32768, 298,-32768, 91,-32768, 288, -5, 10, 290, 29,
552 -32768,-32768, 18, 96, 291,-32768, 291, 293, 50, 4,
553 4,-32768, 4,-32768, 4,-32768,-32768,-32768,-32768, 96,
554 96,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 323,
558 static const short yypgoto[] = {-32768,
559 69, 117, 317,-32768,-32768, 303, -21, 213, 217, 222,
560 -32768,-32768,-32768, -19, 242, -23, 299,-32768, 126,-32768,
561 261, 243,-32768, -24,-32768, -174,-32768, -164, 124, -113,
562 182,-32768, 180, 139, -120, -114
569 static const short yytable[] = { 148,
570 55, 149, 54, 12, 196, 60, 187, 66, 188, 190,
571 101, 156, 201, 144, 145, 203, 17, 144, 145, 16,
572 199, 112, 144, 145, 216, 165, 176, 189, 144, 145,
573 79, 102, 214, 221, 146, 35, 144, 145, 85, 229,
574 90, 114, 147, 67, 177, 91, 147, 205, 223, 183,
575 230, 147, 231, 193, 141, 238, 239, 147, 36, 104,
576 106, 112, 103, 107, 113, 147, 37, 206, 205, 226,
577 198, 142, 200, 207, 208, 209, 61, 13, 135, 68,
578 136, 114, 115, 13, 138, 104, 13, 140, 206, 227,
579 233, 84, 222, 224, 207, 208, 209, -96, 227, 154,
580 157, 20, 21, 22, 161, 234, 235, 162, 236, 205,
581 237, 39, 40, 41, 42, 43, 70, 44, 45, 46,
582 47, 48, 49, 50, 51, 52, 15, 53, 77, 206,
583 18, 119, 78, 120, 80, 207, 208, 209, 1, 64,
584 65, 39, 40, 41, 42, 43, 81, 44, 45, 46,
585 47, 48, 49, 50, 51, 52, 83, 53, 2, 3,
586 4, 5, 6, 7, 101, 20, 21, 22, 19, 74,
587 76, 89, 92, 93, 20, 21, 22, 97, 20, 21,
588 22, 23, 24, 25, 26, 102, 27, 28, 19, 2,
589 3, 4, 5, 6, 7, 96, 94, 95, 20, 21,
590 22, 23, 24, 25, 26, 98, 62, 28, 39, 40,
591 41, 42, 43, 180, 44, 45, 46, 47, 48, 49,
592 50, 51, 52, 99, 53, 39, 40, 41, 42, 43,
593 105, 44, 45, 46, 47, 48, 49, 50, 51, 52,
594 108, 53, 39, 126, 41, 42, 43, 109, 44, 45,
595 46, 47, 48, 49, 50, 51, 127, 110, 53, 40,
596 41, 42, 43, 123, 44, 45, 46, 47, 48, 49,
597 50, 51, 52, 124, 53, 46, 47, 48, 133, 125,
598 73, 46, 47, 48, 101, 102, 75, 139, 137, 114,
599 112, 163, 155, 152, 158, 153, 160, 164, -95, 159,
600 166, 168, 167, 169, 170, 171, 173, 172, 174, 178,
601 182, 185, 192, 184, 186, 204, 191, 212, 197, 213,
602 218, 202, 241, 215, 242, 14, 220, 217, 225, 151,
603 232, 63, 150, 111, 143, 122, 228, 72, 175, 181,
607 static const short yycheck[] = { 114,
608 24, 115, 24, 21, 179, 25, 171, 31, 19, 174,
609 19, 125, 187, 19, 20, 190, 4, 19, 20, 36,
610 185, 19, 19, 20, 199, 139, 22, 38, 19, 20,
611 54, 40, 197, 39, 36, 21, 19, 20, 60, 214,
612 64, 39, 48, 19, 40, 65, 48, 19, 39, 163,
613 215, 48, 217, 36, 19, 230, 231, 48, 40, 84,
614 85, 19, 84, 87, 22, 48, 40, 39, 19, 41,
615 184, 36, 186, 45, 46, 47, 40, 9, 103, 19,
616 105, 39, 40, 15, 108, 110, 18, 111, 39, 210,
617 41, 19, 207, 208, 45, 46, 47, 41, 219, 123,
618 44, 29, 30, 31, 41, 220, 221, 44, 223, 19,
619 225, 5, 6, 7, 8, 9, 19, 11, 12, 13,
620 14, 15, 16, 17, 18, 19, 10, 21, 15, 39,
621 14, 36, 15, 38, 19, 45, 46, 47, 3, 33,
622 34, 5, 6, 7, 8, 9, 43, 11, 12, 13,
623 14, 15, 16, 17, 18, 19, 19, 21, 23, 24,
624 25, 26, 27, 28, 19, 29, 30, 31, 19, 44,
625 45, 21, 19, 41, 29, 30, 31, 19, 29, 30,
626 31, 32, 33, 34, 35, 40, 37, 38, 19, 23,
627 24, 25, 26, 27, 28, 40, 42, 41, 29, 30,
628 31, 32, 33, 34, 35, 19, 37, 38, 5, 6,
629 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
630 17, 18, 19, 40, 21, 5, 6, 7, 8, 9,
631 19, 11, 12, 13, 14, 15, 16, 17, 18, 19,
632 41, 21, 5, 6, 7, 8, 9, 19, 11, 12,
633 13, 14, 15, 16, 17, 18, 19, 19, 21, 6,
634 7, 8, 9, 19, 11, 12, 13, 14, 15, 16,
635 17, 18, 19, 19, 21, 13, 14, 15, 19, 40,
636 18, 13, 14, 15, 19, 40, 18, 40, 19, 39,
637 19, 40, 36, 38, 19, 23, 44, 19, 41, 41,
638 19, 38, 23, 23, 20, 41, 23, 41, 41, 19,
639 19, 41, 19, 40, 40, 19, 40, 23, 41, 19,
640 23, 36, 0, 41, 0, 9, 39, 41, 39, 117,
641 38, 29, 116, 91, 113, 94, 213, 39, 157, 160,
644 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
645 #line 3 "/usr/lib/bison.simple"
646 /* This file comes from bison-1.28. */
648 /* Skeleton output parser for bison,
649 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
651 This program is free software; you can redistribute it and/or modify
652 it under the terms of the GNU General Public License as published by
653 the Free Software Foundation; either version 2, or (at your option)
656 This program is distributed in the hope that it will be useful,
657 but WITHOUT ANY WARRANTY; without even the implied warranty of
658 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
659 GNU General Public License for more details.
661 You should have received a copy of the GNU General Public License
662 along with this program; if not, write to the Free Software
663 Foundation, Inc., 59 Temple Place - Suite 330,
664 Boston, MA 02111-1307, USA. */
666 /* As a special exception, when this file is copied by Bison into a
667 Bison output file, you may use that output file without restriction.
668 This special exception was added by the Free Software Foundation
669 in version 1.24 of Bison. */
671 /* This is the parser code that is written into each bison parser
672 when the %semantic_parser declaration is not specified in the grammar.
673 It was written by Richard Stallman by simplifying the hairy parser
674 used when %semantic_parser is specified. */
676 #ifndef YYSTACK_USE_ALLOCA
678 #define YYSTACK_USE_ALLOCA
679 #else /* alloca not defined */
681 #define YYSTACK_USE_ALLOCA
682 #define alloca __builtin_alloca
683 #else /* not GNU C. */
684 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
685 #define YYSTACK_USE_ALLOCA
687 #else /* not sparc */
688 /* We think this test detects Watcom and Microsoft C. */
689 /* This used to test MSDOS, but that is a bad idea
690 since that symbol is in the user namespace. */
691 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
692 #if 0 /* No need for malloc.h, which pollutes the namespace;
693 instead, just don't use alloca. */
696 #else /* not MSDOS, or __TURBOC__ */
698 /* I don't know what this was needed for, but it pollutes the namespace.
699 So I turned it off. rms, 2 May 1997. */
700 /* #include <malloc.h> */
702 #define YYSTACK_USE_ALLOCA
703 #else /* not MSDOS, or __TURBOC__, or _AIX */
705 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
706 and on HPUX 10. Eventually we can turn this on. */
707 #define YYSTACK_USE_ALLOCA
708 #define alloca __builtin_alloca
711 #endif /* not _AIX */
712 #endif /* not MSDOS, or __TURBOC__ */
713 #endif /* not sparc */
714 #endif /* not GNU C */
715 #endif /* alloca not defined */
716 #endif /* YYSTACK_USE_ALLOCA not defined */
718 #ifdef YYSTACK_USE_ALLOCA
719 #define YYSTACK_ALLOC alloca
721 #define YYSTACK_ALLOC malloc
724 /* Note: there must be only one dollar sign in this file.
725 It is replaced by the list of actions, each action
726 as one case of the switch. */
728 #define yyerrok (yyerrstatus = 0)
729 #define yyclearin (yychar = YYEMPTY)
732 #define YYACCEPT goto yyacceptlab
733 #define YYABORT goto yyabortlab
734 #define YYERROR goto yyerrlab1
735 /* Like YYERROR except do call yyerror.
736 This remains here temporarily to ease the
737 transition to the new meaning of YYERROR, for GCC.
738 Once GCC version 2 has supplanted version 1, this can go. */
739 #define YYFAIL goto yyerrlab
740 #define YYRECOVERING() (!!yyerrstatus)
741 #define YYBACKUP(token, value) \
743 if (yychar == YYEMPTY && yylen == 1) \
744 { yychar = (token), yylval = (value); \
745 yychar1 = YYTRANSLATE (yychar); \
750 { yyerror ("syntax error: cannot back up"); YYERROR; } \
754 #define YYERRCODE 256
757 #define YYLEX yylex()
763 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
765 #define YYLEX yylex(&yylval, &yylloc)
767 #else /* not YYLSP_NEEDED */
769 #define YYLEX yylex(&yylval, YYLEX_PARAM)
771 #define YYLEX yylex(&yylval)
773 #endif /* not YYLSP_NEEDED */
776 /* If nonreentrant, generate the variables here */
780 int yychar; /* the lookahead symbol */
781 YYSTYPE yylval; /* the semantic value of the */
782 /* lookahead symbol */
785 YYLTYPE yylloc; /* location data for the lookahead */
789 int yynerrs; /* number of parse errors so far */
790 #endif /* not YYPURE */
793 int yydebug; /* nonzero means print parse trace */
794 /* Since this is uninitialized, it does not stop multiple parsers
798 /* YYINITDEPTH indicates the initial size of the parser's stacks */
801 #define YYINITDEPTH 200
804 /* YYMAXDEPTH is the maximum size the stacks can grow to
805 (effective only if the built-in stack extension method is used). */
812 #define YYMAXDEPTH 10000
815 /* Define __yy_memcpy. Note that the size argument
816 should be passed with type unsigned int, because that is what the non-GCC
817 definitions require. With GCC, __builtin_memcpy takes an arg
818 of type size_t, but it can handle unsigned int. */
820 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
821 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
822 #else /* not GNU C or C++ */
825 /* This is the most reliable way to avoid incompatibilities
826 in available built-in functions on various systems. */
828 __yy_memcpy (to, from, count)
833 register char *f = from;
834 register char *t = to;
835 register int i = count;
841 #else /* __cplusplus */
843 /* This is the most reliable way to avoid incompatibilities
844 in available built-in functions on various systems. */
846 __yy_memcpy (char *to, char *from, unsigned int count)
848 register char *t = to;
849 register char *f = from;
850 register int i = count;
859 #line 217 "/usr/lib/bison.simple"
861 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
862 into yyparse. The argument should have type void *.
863 It should actually point to an object.
864 Grammar actions can access the variable by casting it
865 to the proper pointer type. */
869 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
870 #define YYPARSE_PARAM_DECL
871 #else /* not __cplusplus */
872 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
873 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
874 #endif /* not __cplusplus */
875 #else /* not YYPARSE_PARAM */
876 #define YYPARSE_PARAM_ARG
877 #define YYPARSE_PARAM_DECL
878 #endif /* not YYPARSE_PARAM */
880 /* Prevent warning if -Wstrict-prototypes. */
883 int yyparse (void *);
890 yyparse(YYPARSE_PARAM_ARG)
893 register int yystate;
895 register short *yyssp;
896 register YYSTYPE *yyvsp;
897 int yyerrstatus; /* number of tokens to shift before error messages enabled */
898 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
900 short yyssa[YYINITDEPTH]; /* the state stack */
901 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
903 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
904 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
907 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
908 YYLTYPE *yyls = yylsa;
911 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
913 #define YYPOPSTACK (yyvsp--, yyssp--)
916 int yystacksize = YYINITDEPTH;
917 int yyfree_stacks = 0;
928 YYSTYPE yyval; /* the variable used to return */
929 /* semantic values from the action */
936 fprintf(stderr, "Starting parse\n");
942 yychar = YYEMPTY; /* Cause a token to be read. */
944 /* Initialize stack pointers.
945 Waste one element of value and location stack
946 so that they stay on the same level as the state stack.
947 The wasted elements are never initialized. */
955 /* Push a new state, which is found in yystate . */
956 /* In all cases, when you get here, the value and location stacks
957 have just been pushed. so pushing a state here evens the stacks. */
962 if (yyssp >= yyss + yystacksize - 1)
964 /* Give user a chance to reallocate the stack */
965 /* Use copies of these so that the &'s don't force the real ones into memory. */
966 YYSTYPE *yyvs1 = yyvs;
969 YYLTYPE *yyls1 = yyls;
972 /* Get the current used size of the three stacks, in elements. */
973 int size = yyssp - yyss + 1;
976 /* Each stack pointer address is followed by the size of
977 the data in use in that stack, in bytes. */
979 /* This used to be a conditional around just the two extra args,
980 but that might be undefined if yyoverflow is a macro. */
981 yyoverflow("parser stack overflow",
982 &yyss1, size * sizeof (*yyssp),
983 &yyvs1, size * sizeof (*yyvsp),
984 &yyls1, size * sizeof (*yylsp),
987 yyoverflow("parser stack overflow",
988 &yyss1, size * sizeof (*yyssp),
989 &yyvs1, size * sizeof (*yyvsp),
993 yyss = yyss1; yyvs = yyvs1;
997 #else /* no yyoverflow */
998 /* Extend the stack our own way. */
999 if (yystacksize >= YYMAXDEPTH)
1001 yyerror("parser stack overflow");
1013 if (yystacksize > YYMAXDEPTH)
1014 yystacksize = YYMAXDEPTH;
1015 #ifndef YYSTACK_USE_ALLOCA
1018 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1019 __yy_memcpy ((char *)yyss, (char *)yyss1,
1020 size * (unsigned int) sizeof (*yyssp));
1021 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1022 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1023 size * (unsigned int) sizeof (*yyvsp));
1025 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1026 __yy_memcpy ((char *)yyls, (char *)yyls1,
1027 size * (unsigned int) sizeof (*yylsp));
1029 #endif /* no yyoverflow */
1031 yyssp = yyss + size - 1;
1032 yyvsp = yyvs + size - 1;
1034 yylsp = yyls + size - 1;
1039 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1042 if (yyssp >= yyss + yystacksize - 1)
1048 fprintf(stderr, "Entering state %d\n", yystate);
1054 /* Do appropriate processing given the current state. */
1055 /* Read a lookahead token if we need one and don't already have one. */
1058 /* First try to decide what to do without reference to lookahead token. */
1060 yyn = yypact[yystate];
1064 /* Not known => get a lookahead token if don't already have one. */
1066 /* yychar is either YYEMPTY or YYEOF
1067 or a valid token in external form. */
1069 if (yychar == YYEMPTY)
1073 fprintf(stderr, "Reading a token: ");
1078 /* Convert token to internal form (in yychar1) for indexing tables with */
1080 if (yychar <= 0) /* This means end of input. */
1083 yychar = YYEOF; /* Don't call YYLEX any more */
1087 fprintf(stderr, "Now at end of input.\n");
1092 yychar1 = YYTRANSLATE(yychar);
1097 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1098 /* Give the individual parser a way to print the precise meaning
1099 of a token, for further debugging info. */
1101 YYPRINT (stderr, yychar, yylval);
1103 fprintf (stderr, ")\n");
1109 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1114 /* yyn is what to do for this token type in this state.
1115 Negative => reduce, -yyn is rule number.
1116 Positive => shift, yyn is new state.
1117 New state is final state => don't bother to shift,
1118 just return success.
1119 0, or most negative number => error. */
1134 /* Shift the lookahead token. */
1138 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1141 /* Discard the token being shifted unless it is eof. */
1142 if (yychar != YYEOF)
1150 /* count tokens shifted since error; after three, turn off error status. */
1151 if (yyerrstatus) yyerrstatus--;
1156 /* Do the default action for the current state. */
1159 yyn = yydefact[yystate];
1163 /* Do a reduction. yyn is the number of a rule to reduce with. */
1167 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1174 fprintf (stderr, "Reducing via rule %d (line %d), ",
1177 /* Print the symbols being reduced, and their result. */
1178 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1179 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1180 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1206 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1208 nodes = g_list_append(nodes,node);
1209 g_string_free(yyvsp[0].cbuf,FALSE);
1215 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1217 nodes = g_list_append(nodes,node);
1218 g_string_free(yyvsp[0].cbuf,FALSE);
1224 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1226 nodes = g_list_append(nodes,node);
1227 g_string_free(yyvsp[0].cbuf,FALSE);
1233 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1235 nodes = g_list_append(nodes,node);
1236 g_string_free(yyvsp[0].cbuf,FALSE);
1242 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1244 nodes = g_list_append(nodes,node);
1245 g_string_free(yyvsp[0].cbuf,FALSE);
1251 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1253 nodes = g_list_append(nodes,node);
1254 g_string_free(yyvsp[0].cbuf,FALSE);
1268 ((Class *)class)->nodes = class_nodes;
1270 nodes = g_list_append(nodes,class);
1276 ((Class *)class)->nodes = NULL;
1278 nodes = g_list_append(nodes,class);
1284 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1313 { the_scope = PUBLIC_SCOPE; ;
1317 { the_scope = PRIVATE_SCOPE; ;
1321 { the_scope = PROTECTED_SCOPE; ;
1326 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1327 g_free(yyvsp[-1].id);
1328 destructor = yyvsp[0].id;
1329 destructor_line = line_no;
1330 destructor_simple = TRUE;
1332 g_free(yyvsp[-1].id);
1333 g_free(yyvsp[0].id);
1334 yyerror(_("parse error"));
1342 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1343 g_free(yyvsp[-2].id);
1344 destructor = (yyvsp[0].cbuf)->str;
1345 g_string_free(yyvsp[0].cbuf, FALSE);
1346 destructor_line = ccode_line;
1347 destructor_simple = FALSE;
1349 g_free(yyvsp[-2].id);
1350 g_string_free(yyvsp[0].cbuf, TRUE);
1351 yyerror(_("parse error"));
1359 initializer = yyvsp[0].id;
1360 initializer_line = ccode_line;
1366 initializer = (yyvsp[0].cbuf)->str;
1367 initializer_line = ccode_line;
1368 g_string_free(yyvsp[0].cbuf, FALSE);
1381 { destructor = NULL; ;
1385 { initializer = NULL; ;
1397 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1403 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1409 if(strcmp(yyvsp[-6].id,"get")==0 &&
1410 strcmp(yyvsp[-3].id,"set")==0) {
1412 Type *type = pop_type();
1413 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1414 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1415 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1416 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1418 g_string_free(yyvsp[-4].cbuf,FALSE);
1419 g_string_free(yyvsp[-1].cbuf,FALSE);
1420 class_nodes = g_list_append(class_nodes,node);
1421 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1422 strcmp(yyvsp[-3].id,"get")==0) {
1424 Type *type = pop_type();
1425 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1426 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1427 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1428 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1430 g_string_free(yyvsp[-1].cbuf,FALSE);
1431 g_string_free(yyvsp[-4].cbuf,FALSE);
1432 class_nodes = g_list_append(class_nodes,node);
1434 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1435 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1436 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1437 g_string_free(yyvsp[-1].cbuf,TRUE);
1438 g_string_free(yyvsp[-4].cbuf,TRUE);
1439 yyerror(_("parse error"));
1447 if(strcmp(yyvsp[-3].id,"get")==0) {
1449 Type *type = pop_type();
1450 g_free(yyvsp[-3].id);
1451 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1452 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1453 NULL,0, yyvsp[-7].line);
1454 g_string_free(yyvsp[-1].cbuf,FALSE);
1455 class_nodes = g_list_append(class_nodes,node);
1456 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1458 Type *type = pop_type();
1459 g_free(yyvsp[-3].id);
1460 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1461 NULL,0,(yyvsp[-1].cbuf)->str,
1462 yyvsp[-2].line, yyvsp[-7].line);
1463 g_string_free(yyvsp[-1].cbuf,FALSE);
1464 class_nodes = g_list_append(class_nodes,node);
1466 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1467 g_free(yyvsp[-4].id);
1468 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1469 g_string_free(yyvsp[-1].cbuf,TRUE);
1470 yyerror(_("parse error"));
1479 char *get, *set = NULL;
1484 if(strcmp(yyvsp[0].id,"link")!=0 &&
1485 strcmp(yyvsp[0].id,"stringlink")!=0 &&
1486 strcmp(yyvsp[0].id,"objectlink")!=0) {
1487 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1488 g_free(yyvsp[-1].id);
1489 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1490 yyerror(_("parse error"));
1496 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1497 if(var->scope == PRIVATE_SCOPE)
1498 root = "self->_priv";
1502 if(strcmp(yyvsp[0].id,"link")==0) {
1503 set = g_strdup_printf("%s->%s = ARG;",
1504 root, yyvsp[-1].id);
1505 } else if(strcmp(yyvsp[0].id,"stringlink")==0) {
1506 set = g_strdup_printf("g_free(%s->%s); "
1507 "%s->%s = g_strdup(ARG);",
1509 root, yyvsp[-1].id);
1510 } else if(strcmp(yyvsp[0].id,"objectlink")==0) {
1511 set = g_strdup_printf(
1513 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1516 "gtk_object_ref(GTK_OBJECT(%s->%s)); ",
1521 root, yyvsp[-1].id);
1523 g_assert_not_reached();
1526 /* get is the same for everything */
1527 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1529 g_free(yyvsp[0].id);
1533 type = copy_type(var->vtype);
1535 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1536 yyvsp[-1].id, get, yyvsp[-4].line,
1537 set, yyvsp[-4].line, yyvsp[-4].line);
1538 class_nodes = g_list_append(class_nodes,node);
1544 if(strcmp(yyvsp[-2].id,"type")!=0) {
1545 g_free(yyvsp[-4].id);
1546 g_free(yyvsp[-2].id);
1547 yyerror(_("parse error"));
1550 yyval.id = yyvsp[-4].id;
1556 yyval.id = yyvsp[0].id;
1557 typestack = g_list_prepend(typestack,NULL);
1562 { yyval.list = yyvsp[-1].list; ;
1566 { yyval.list = NULL; ;
1571 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1577 yyval.list = g_list_append(NULL,yyvsp[0].id);
1587 Type *type = typestack->data;
1588 char *oldname = type->name;
1589 type->name = g_strconcat("const ",oldname,NULL);
1596 Node *node = new_type(0,yyvsp[0].id,NULL);
1597 typestack = g_list_prepend(typestack,node);
1603 Node *node = new_type(stars,yyvsp[-1].id,NULL);
1605 typestack = g_list_prepend(typestack,node);
1611 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1617 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1623 yyval.id = g_strdup(yyvsp[0].id);
1629 yyval.id = g_strdup("unsigned char");
1635 yyval.id = g_strdup("signed char");
1641 yyval.id = g_strdup("char");
1647 yyval.id = g_strdup("double");
1653 yyval.id = g_strdup("float");
1659 yyval.id = yyvsp[0].id;
1665 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1666 g_free(yyvsp[0].id);
1672 yyval.id = yyvsp[0].id;
1678 yyval.id = g_strdup("void");
1684 yyval.id = "long int";
1696 yyval.id = "short int";
1720 yyval.id = "union ";
1726 yyval.id = "struct ";
1740 if(strcmp(yyvsp[-1].id, "first")==0)
1741 yyval.sigtype = SIGNAL_FIRST_METHOD;
1742 else if(strcmp(yyvsp[-1].id, "last")==0)
1743 yyval.sigtype = SIGNAL_LAST_METHOD;
1745 yyerror(_("signal must be 'first' or 'last'"));
1746 g_free(yyvsp[-1].id);
1749 g_free(yyvsp[-1].id);
1755 yyval.sigtype = SIGNAL_LAST_METHOD;
1761 if(strcmp(yyvsp[-1].id,"first")==0)
1762 yyval.sigtype = SIGNAL_FIRST_METHOD;
1763 else if(strcmp(yyvsp[-1].id,"last")==0)
1764 yyval.sigtype = SIGNAL_LAST_METHOD;
1766 yyerror(_("signal must be 'first' or 'last'"));
1767 g_free(yyvsp[-1].id);
1770 g_free(yyvsp[-1].id);
1776 if(strcmp(yyvsp[-2].id,"first")==0)
1777 yyval.sigtype = SIGNAL_FIRST_METHOD;
1778 else if(strcmp(yyvsp[-2].id,"last")==0)
1779 yyval.sigtype = SIGNAL_LAST_METHOD;
1781 yyerror(_("signal must be 'first' or 'last'"));
1782 g_free(yyvsp[-2].id);
1785 g_free(yyvsp[-2].id);
1791 yyval.sigtype = SIGNAL_LAST_METHOD;
1797 /* the_scope was default thus public */
1798 the_scope = PUBLIC_SCOPE;
1804 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1810 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1816 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1821 { yyval.cbuf = yyvsp[0].cbuf; ;
1825 { yyval.cbuf = NULL; ;
1831 yyerror(_("signal without 'self' as "
1832 "first parameter"));
1833 free_all_global_state();
1836 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1837 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1838 ccode_line, vararg, yyvsp[-8].list);
1845 yyerror(_("signal without 'self' as "
1846 "first parameter"));
1847 free_all_global_state();
1850 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1851 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1852 ccode_line, vararg, yyvsp[-8].list);
1859 yyerror(_("virtual method without 'self' as "
1860 "first parameter"));
1861 free_all_global_state();
1864 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1865 yyvsp[0].cbuf, yyvsp[-8].line,
1866 ccode_line, vararg, NULL);
1873 yyerror(_("virtual method without 'self' as "
1874 "first parameter"));
1875 free_all_global_state();
1878 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1879 yyvsp[0].cbuf, yyvsp[-7].line,
1880 ccode_line, vararg, NULL);
1887 yyerror(_("virtual method without 'self' as "
1888 "first parameter"));
1889 free_all_global_state();
1892 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1893 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
1894 ccode_line, vararg, NULL);
1900 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
1901 yyvsp[-5].id, yyvsp[0].cbuf,
1902 yyvsp[-10].line, ccode_line,
1909 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
1910 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
1917 if(strcmp(yyvsp[-4].id, "init")==0) {
1918 push_init_arg(yyvsp[-2].id,FALSE);
1919 push_function(NO_SCOPE, INIT_METHOD, NULL,
1920 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1921 ccode_line, FALSE, NULL);
1922 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
1923 push_init_arg(yyvsp[-2].id,TRUE);
1924 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
1925 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1926 ccode_line, FALSE, NULL);
1928 g_free(yyvsp[-4].id);
1929 g_free(yyvsp[-2].id);
1930 g_string_free(yyvsp[-2].cbuf,TRUE);
1931 yyerror(_("parse error"));
1939 g_free(onerror); onerror = NULL;
1940 g_free(defreturn); defreturn = NULL;
1941 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1942 g_free(yyvsp[-1].id);
1943 g_free(yyvsp[0].id);
1944 yyerror(_("parse error"));
1947 g_free(yyvsp[-1].id);
1953 g_free(onerror); onerror = NULL;
1954 g_free(defreturn); defreturn = NULL;
1955 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
1956 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1957 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1958 yyerror(_("parse error"));
1961 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1962 onerror = defreturn = NULL;
1963 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1964 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1965 yyerror(_("parse error"));
1968 g_free(yyvsp[-3].id);
1969 g_free(yyvsp[-1].id);
1975 g_free(onerror); onerror = NULL;
1976 g_free(defreturn); defreturn = NULL;
1981 { yyval.id = yyvsp[0].id; ;
1986 yyval.id = (yyvsp[1].cbuf)->str;
1987 g_string_free(yyvsp[1].cbuf, FALSE);
1992 { vararg = FALSE; has_self = FALSE; ;
1999 if(strcmp(yyvsp[0].id,"self")==0)
2000 push_self(yyvsp[0].id);
2002 g_free(yyvsp[0].id);
2003 yyerror(_("parse error"));
2012 if(strcmp(yyvsp[-2].id,"self")==0)
2013 push_self(yyvsp[-2].id);
2015 g_free(yyvsp[-2].id);
2016 yyerror(_("parse error"));
2023 { has_self = FALSE; ;
2044 push_funcarg(yyvsp[0].id,NULL);
2050 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2056 if(strcmp(yyvsp[-2].id,"check")!=0) {
2057 yyerror(_("parse error"));
2060 g_free(yyvsp[-2].id);
2061 push_funcarg(yyvsp[-4].id,NULL);
2067 if(strcmp(yyvsp[-2].id,"check")!=0) {
2068 yyerror(_("parse error"));
2071 g_free(yyvsp[-2].id);
2072 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2086 if(strcmp(yyvsp[0].id,"type")==0) {
2087 Node *node = new_check(TYPE_CHECK,NULL);
2088 checks = g_list_append(checks,node);
2089 } else if(strcmp(yyvsp[0].id,"null")==0) {
2090 Node *node = new_check(NULL_CHECK,NULL);
2091 checks = g_list_append(checks,node);
2093 yyerror(_("parse error"));
2096 g_free(yyvsp[0].id);
2102 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2103 checks = g_list_append(checks,node);
2109 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2110 checks = g_list_append(checks,node);
2116 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2117 checks = g_list_append(checks,node);
2123 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2124 checks = g_list_append(checks,node);
2130 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2131 checks = g_list_append(checks,node);
2137 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2138 checks = g_list_append(checks,node);
2143 { yyval.id = yyvsp[0].id; ;
2148 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2149 g_free(yyvsp[0].id);
2154 { yyval.id = yyvsp[0].id; ;
2157 /* the action file gets copied in in place of this dollarsign */
2158 #line 543 "/usr/lib/bison.simple"
2169 short *ssp1 = yyss - 1;
2170 fprintf (stderr, "state stack now");
2171 while (ssp1 != yyssp)
2172 fprintf (stderr, " %d", *++ssp1);
2173 fprintf (stderr, "\n");
2183 yylsp->first_line = yylloc.first_line;
2184 yylsp->first_column = yylloc.first_column;
2185 yylsp->last_line = (yylsp-1)->last_line;
2186 yylsp->last_column = (yylsp-1)->last_column;
2191 yylsp->last_line = (yylsp+yylen-1)->last_line;
2192 yylsp->last_column = (yylsp+yylen-1)->last_column;
2196 /* Now "shift" the result of the reduction.
2197 Determine what state that goes to,
2198 based on the state we popped back to
2199 and the rule number reduced by. */
2203 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2204 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2205 yystate = yytable[yystate];
2207 yystate = yydefgoto[yyn - YYNTBASE];
2211 yyerrlab: /* here on detecting error */
2214 /* If not already recovering from an error, report this error. */
2218 #ifdef YYERROR_VERBOSE
2219 yyn = yypact[yystate];
2221 if (yyn > YYFLAG && yyn < YYLAST)
2228 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2229 for (x = (yyn < 0 ? -yyn : 0);
2230 x < (sizeof(yytname) / sizeof(char *)); x++)
2231 if (yycheck[x + yyn] == x)
2232 size += strlen(yytname[x]) + 15, count++;
2233 msg = (char *) malloc(size + 15);
2236 strcpy(msg, "parse error");
2241 for (x = (yyn < 0 ? -yyn : 0);
2242 x < (sizeof(yytname) / sizeof(char *)); x++)
2243 if (yycheck[x + yyn] == x)
2245 strcat(msg, count == 0 ? ", expecting `" : " or `");
2246 strcat(msg, yytname[x]);
2255 yyerror ("parse error; also virtual memory exceeded");
2258 #endif /* YYERROR_VERBOSE */
2259 yyerror("parse error");
2263 yyerrlab1: /* here on error raised explicitly by an action */
2265 if (yyerrstatus == 3)
2267 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2269 /* return failure if at end of input */
2270 if (yychar == YYEOF)
2275 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2281 /* Else will try to reuse lookahead token
2282 after shifting the error token. */
2284 yyerrstatus = 3; /* Each real token shifted decrements this */
2288 yyerrdefault: /* current state does not do anything special for the error token. */
2291 /* This is wrong; only states that explicitly want error tokens
2292 should shift them. */
2293 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2294 if (yyn) goto yydefault;
2297 yyerrpop: /* pop the current state because it cannot handle the error token */
2299 if (yyssp == yyss) YYABORT;
2309 short *ssp1 = yyss - 1;
2310 fprintf (stderr, "Error: state stack now");
2311 while (ssp1 != yyssp)
2312 fprintf (stderr, " %d", *++ssp1);
2313 fprintf (stderr, "\n");
2319 yyn = yypact[yystate];
2324 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2343 fprintf(stderr, "Shifting error token, ");
2355 /* YYACCEPT comes here. */
2367 /* YYABORT comes here. */