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);
168 c_cbuf = p = cbuf->str;
169 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
176 node = new_method(scope, method, type, oid, gtktypes, flags,
177 id, funcargs, onerror, defreturn, c_cbuf, line_no,
182 /*only free segment if we haven't passed it
191 class_nodes = g_list_append(class_nodes, node);
195 free_all_global_state(void)
202 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
203 g_list_free(gtktypes);
206 free_node_list(funcargs);
211 push_funcarg(char *name, char *postfix)
214 Type *type = pop_type();
216 type->postfix = postfix;
218 node = new_funcarg(type, name, checks);
221 funcargs = g_list_append(funcargs, node);
225 push_init_arg(char *name, int is_class)
232 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
234 tn = g_strdup(((Class *)class)->otype);
236 type = new_type(1,tn,NULL);
237 node = new_funcarg((Type *)type,name,NULL);
238 funcargs = g_list_prepend(funcargs, node);
247 type = new_type(1,g_strdup(((Class *)class)->otype),NULL);
248 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
249 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
250 node = new_funcarg((Type *)type,id,ch);
251 funcargs = g_list_prepend(funcargs, node);
255 find_var_or_die(const char *id, int line)
260 for(li = class_nodes; li != NULL; li = li->next) {
262 Node *node = li->data;
263 if(node->type != VARIABLE_NODE)
266 if(strcmp(var->id, id)==0)
270 s = g_strdup_printf(_("Variable %s not defined here"), id);
271 print_error(FALSE, s, line);
273 g_assert_not_reached();
278 set_return_value(char *type, char *val)
280 if(strcmp(type, "onerror")==0) {
286 } else if(strcmp(type, "defreturn")==0) {
320 #define YYFLAG -32768
323 #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 86)
325 static const char yytranslate[] = { 0,
326 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
328 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
329 2, 2, 47, 2, 2, 2, 2, 2, 2, 40,
330 41, 43, 2, 44, 48, 2, 2, 2, 2, 2,
331 2, 2, 2, 2, 2, 2, 2, 2, 38, 46,
332 39, 45, 2, 2, 2, 2, 2, 2, 2, 2,
333 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
334 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338 2, 2, 36, 42, 37, 2, 2, 2, 2, 2,
339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 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, 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, 1, 3, 4, 5, 6,
352 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
353 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
354 27, 28, 29, 30, 31, 32, 33, 34, 35
358 static const short yyprhs[] = { 0,
359 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
360 24, 27, 29, 34, 38, 43, 46, 48, 50, 52,
361 54, 56, 58, 60, 62, 65, 69, 72, 76, 79,
362 82, 84, 86, 87, 93, 100, 112, 121, 127, 133,
363 135, 139, 140, 144, 146, 148, 151, 153, 156, 159,
364 162, 164, 167, 170, 172, 174, 176, 178, 181, 183,
365 185, 188, 190, 193, 195, 197, 199, 201, 203, 206,
366 208, 211, 213, 217, 221, 224, 226, 231, 235, 237,
367 240, 242, 253, 265, 275, 285, 294, 306, 315, 321,
368 324, 329, 330, 332, 335, 337, 339, 343, 345, 349,
369 351, 355, 357, 360, 364, 371, 379, 382, 384, 386,
370 389, 392, 396, 400, 404, 408, 410, 413
373 static const short yyrhs[] = { 51,
374 52, 51, 0, 52, 51, 0, 51, 52, 0, 52,
375 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
376 0, 28, 0, 51, 50, 0, 50, 0, 53, 36,
377 54, 37, 0, 53, 36, 37, 0, 3, 21, 4,
378 21, 0, 54, 55, 0, 55, 0, 76, 0, 60,
379 0, 61, 0, 38, 0, 29, 0, 30, 0, 31,
380 0, 19, 19, 0, 19, 36, 23, 0, 39, 85,
381 0, 39, 36, 23, 0, 57, 58, 0, 58, 57,
382 0, 58, 0, 57, 0, 0, 56, 65, 19, 59,
383 38, 0, 56, 65, 19, 22, 59, 38, 0, 32,
384 63, 62, 19, 19, 36, 23, 19, 36, 23, 38,
385 0, 32, 63, 62, 19, 19, 36, 23, 38, 0,
386 32, 63, 62, 19, 19, 0, 19, 40, 19, 65,
387 41, 0, 19, 0, 40, 64, 41, 0, 0, 19,
388 42, 64, 0, 19, 0, 66, 0, 5, 66, 0,
389 67, 0, 67, 70, 0, 12, 68, 0, 11, 68,
390 0, 68, 0, 12, 18, 0, 11, 18, 0, 18,
391 0, 17, 0, 16, 0, 19, 0, 69, 19, 0,
392 21, 0, 6, 0, 13, 15, 0, 13, 0, 14,
393 15, 0, 14, 0, 15, 0, 9, 0, 8, 0,
394 7, 0, 43, 70, 0, 43, 0, 19, 73, 0,
395 73, 0, 56, 19, 73, 0, 19, 56, 73, 0,
396 56, 73, 0, 71, 0, 19, 40, 74, 41, 0,
397 74, 44, 19, 0, 19, 0, 36, 23, 0, 38,
398 0, 34, 63, 72, 65, 19, 40, 79, 41, 77,
399 75, 0, 56, 34, 63, 71, 65, 19, 40, 79,
400 41, 77, 75, 0, 33, 56, 65, 19, 40, 79,
401 41, 77, 75, 0, 56, 33, 65, 19, 40, 79,
402 41, 77, 75, 0, 33, 65, 19, 40, 79, 41,
403 77, 75, 0, 35, 40, 21, 41, 65, 19, 40,
404 79, 41, 77, 75, 0, 56, 65, 19, 40, 79,
405 41, 77, 75, 0, 19, 40, 19, 41, 75, 0,
406 19, 78, 0, 19, 78, 19, 78, 0, 0, 85,
407 0, 36, 23, 0, 6, 0, 19, 0, 19, 44,
408 80, 0, 80, 0, 81, 44, 10, 0, 81, 0,
409 81, 44, 82, 0, 82, 0, 65, 19, 0, 65,
410 19, 22, 0, 65, 19, 40, 19, 83, 41, 0,
411 65, 19, 22, 40, 19, 83, 41, 0, 83, 84,
412 0, 84, 0, 19, 0, 45, 85, 0, 46, 85,
413 0, 45, 39, 85, 0, 46, 39, 85, 0, 39,
414 39, 85, 0, 47, 39, 85, 0, 20, 0, 48,
421 static const short yyrline[] = { 0,
422 295, 296, 297, 298, 301, 307, 313, 319, 325, 331,
423 339, 340, 343, 348, 355, 360, 361, 364, 365, 366,
424 367, 370, 371, 372, 375, 388, 404, 408, 416, 417,
425 418, 419, 420, 426, 429, 433, 468, 496, 561, 570,
426 576, 577, 580, 583, 589, 590, 598, 602, 609, 612,
427 615, 618, 621, 624, 627, 630, 633, 636, 640, 643,
428 648, 651, 654, 657, 660, 665, 668, 671, 676, 677,
429 681, 693, 699, 711, 723, 726, 732, 737, 740, 745,
430 746, 750, 761, 772, 783, 794, 805, 811, 816, 837,
431 848, 867, 873, 874, 880, 881, 892, 902, 905, 906,
432 909, 910, 913, 916, 919, 927, 937, 938, 941, 954,
433 958, 962, 966, 970, 974, 980, 981, 985
438 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
440 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
441 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
442 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
443 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
444 "ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='","'('","')'",
445 "'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes","class","classdec",
446 "classcode","thing","scope","destructor","initializer","varoptions","variable",
447 "argument","argtype","flags","flaglist","type","type1","type2","integer","tspecifier",
448 "stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode","method",
449 "returnvals","retcode","funcargs","arglist","arglist1","arg","checklist","check",
454 static const short yyr1[] = { 0,
455 49, 49, 49, 49, 50, 50, 50, 50, 50, 50,
456 51, 51, 52, 52, 53, 54, 54, 55, 55, 55,
457 55, 56, 56, 56, 57, 57, 58, 58, 59, 59,
458 59, 59, 59, 60, 60, 61, 61, 61, 62, 62,
459 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
460 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
461 68, 68, 68, 68, 68, 69, 69, 69, 70, 70,
462 71, 71, 72, 72, 72, 72, 73, 74, 74, 75,
463 75, 76, 76, 76, 76, 76, 76, 76, 76, 77,
464 77, 77, 78, 78, 79, 79, 79, 79, 80, 80,
465 81, 81, 82, 82, 82, 82, 83, 83, 84, 84,
466 84, 84, 84, 84, 84, 85, 85, 85
469 static const short yyr2[] = { 0,
470 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
471 2, 1, 4, 3, 4, 2, 1, 1, 1, 1,
472 1, 1, 1, 1, 2, 3, 2, 3, 2, 2,
473 1, 1, 0, 5, 6, 11, 8, 5, 5, 1,
474 3, 0, 3, 1, 1, 2, 1, 2, 2, 2,
475 1, 2, 2, 1, 1, 1, 1, 2, 1, 1,
476 2, 1, 2, 1, 1, 1, 1, 1, 2, 1,
477 2, 1, 3, 3, 2, 1, 4, 3, 1, 2,
478 1, 10, 11, 9, 9, 8, 11, 8, 5, 2,
479 4, 0, 1, 2, 1, 1, 3, 1, 3, 1,
480 3, 1, 2, 3, 6, 7, 2, 1, 1, 2,
481 2, 3, 3, 3, 3, 1, 2, 1
484 static const short yydefact[] = { 0,
485 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
486 0, 0, 11, 3, 2, 0, 0, 1, 0, 22,
487 23, 24, 42, 0, 42, 0, 14, 21, 0, 17,
488 0, 19, 20, 18, 15, 0, 0, 0, 0, 60,
489 68, 67, 66, 0, 0, 62, 64, 65, 56, 55,
490 54, 57, 59, 0, 0, 45, 47, 51, 0, 0,
491 0, 13, 16, 0, 42, 0, 0, 44, 0, 40,
492 0, 46, 53, 50, 52, 49, 61, 63, 0, 0,
493 70, 48, 58, 0, 0, 76, 0, 72, 0, 0,
494 0, 33, 0, 0, 41, 0, 0, 0, 0, 69,
495 0, 0, 0, 71, 0, 75, 0, 0, 0, 0,
496 0, 0, 33, 0, 0, 32, 31, 0, 0, 81,
497 89, 43, 0, 38, 0, 60, 57, 0, 0, 98,
498 100, 102, 79, 0, 74, 73, 0, 0, 0, 0,
499 25, 0, 0, 118, 116, 0, 0, 27, 0, 29,
500 30, 34, 80, 0, 0, 0, 0, 103, 92, 0,
501 77, 0, 0, 0, 0, 0, 26, 35, 28, 117,
502 92, 39, 0, 92, 97, 104, 0, 0, 0, 99,
503 101, 78, 0, 0, 92, 0, 0, 0, 37, 0,
504 0, 0, 0, 90, 93, 86, 92, 0, 0, 0,
505 88, 0, 84, 0, 109, 0, 0, 0, 0, 0,
506 108, 94, 0, 0, 92, 85, 92, 0, 0, 0,
507 0, 110, 0, 111, 0, 105, 107, 91, 82, 0,
508 0, 36, 106, 114, 112, 113, 115, 87, 83, 0,
512 static const short yydefgoto[] = { 240,
513 8, 9, 10, 11, 29, 30, 31, 116, 117, 118,
514 32, 33, 71, 38, 69, 128, 56, 57, 58, 59,
515 82, 86, 87, 88, 134, 121, 34, 179, 194, 129,
516 130, 131, 132, 210, 211, 195
519 static const short yypact[] = { 136,
520 -17,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 136, 167,
521 -16, 13,-32768, 167, 167, 150, 15, 167, 19,-32768,
522 -32768,-32768, 27, 137, 27, 37,-32768,-32768, 170,-32768,
523 107,-32768,-32768,-32768,-32768, 25, 61, 98, 254,-32768,
524 -32768,-32768,-32768, 263, 269, 114, 118,-32768,-32768,-32768,
525 -32768,-32768,-32768, 221, 116,-32768, 104,-32768, 138, 73,
526 151,-32768,-32768, 221, 27, 154, 133, 155, 157, 156,
527 159,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 187, 184,
528 104,-32768,-32768, 146, 212,-32768, 221,-32768, 200, 229,
529 239, 43, 96, 61,-32768, 245, 255, 240, 238,-32768,
530 246, 260, 266,-32768, -8,-32768, 270, 221, 248, -8,
531 221, 36, 3, -1, 238, 251, 272, 256, 273,-32768,
532 -32768,-32768, 221, 257, 238, 258, 57, 276, 259,-32768,
533 253,-32768,-32768, 64,-32768,-32768, 252, 279, 238, 282,
534 -32768, 280, 264,-32768,-32768, 281, 285,-32768, 265,-32768,
535 -32768,-32768,-32768, 267, 284, 268, 221, 5, 291, 204,
536 -32768, 292, 238, 274, 271, 275,-32768,-32768,-32768,-32768,
537 291,-32768, -10, 291,-32768, 277, 294, 18, 96,-32768,
538 -32768,-32768, 278, 238, 291, 238, 96, 286,-32768, 96,
539 297, 91, 295, 301,-32768,-32768, 291, 283, 96, 287,
540 -32768, 298,-32768, 91,-32768, 288, -5, 10, 290, 29,
541 -32768,-32768, 18, 96, 291,-32768, 291, 293, 50, 4,
542 4,-32768, 4,-32768, 4,-32768,-32768,-32768,-32768, 96,
543 96,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 323,
547 static const short yypgoto[] = {-32768,
548 69, 117, 317,-32768,-32768, 303, -21, 213, 217, 222,
549 -32768,-32768,-32768, -19, 242, -23, 299,-32768, 126,-32768,
550 261, 243,-32768, -24,-32768, -174,-32768, -164, 124, -113,
551 182,-32768, 180, 139, -120, -114
558 static const short yytable[] = { 148,
559 55, 149, 54, 12, 196, 60, 187, 66, 188, 190,
560 101, 156, 201, 144, 145, 203, 17, 144, 145, 16,
561 199, 112, 144, 145, 216, 165, 176, 189, 144, 145,
562 79, 102, 214, 221, 146, 35, 144, 145, 85, 229,
563 90, 114, 147, 67, 177, 91, 147, 205, 223, 183,
564 230, 147, 231, 193, 141, 238, 239, 147, 36, 104,
565 106, 112, 103, 107, 113, 147, 37, 206, 205, 226,
566 198, 142, 200, 207, 208, 209, 61, 13, 135, 68,
567 136, 114, 115, 13, 138, 104, 13, 140, 206, 227,
568 233, 84, 222, 224, 207, 208, 209, -96, 227, 154,
569 157, 20, 21, 22, 161, 234, 235, 162, 236, 205,
570 237, 39, 40, 41, 42, 43, 70, 44, 45, 46,
571 47, 48, 49, 50, 51, 52, 15, 53, 77, 206,
572 18, 119, 78, 120, 80, 207, 208, 209, 1, 64,
573 65, 39, 40, 41, 42, 43, 81, 44, 45, 46,
574 47, 48, 49, 50, 51, 52, 83, 53, 2, 3,
575 4, 5, 6, 7, 101, 20, 21, 22, 19, 74,
576 76, 89, 92, 93, 20, 21, 22, 97, 20, 21,
577 22, 23, 24, 25, 26, 102, 27, 28, 19, 2,
578 3, 4, 5, 6, 7, 96, 94, 95, 20, 21,
579 22, 23, 24, 25, 26, 98, 62, 28, 39, 40,
580 41, 42, 43, 180, 44, 45, 46, 47, 48, 49,
581 50, 51, 52, 99, 53, 39, 40, 41, 42, 43,
582 105, 44, 45, 46, 47, 48, 49, 50, 51, 52,
583 108, 53, 39, 126, 41, 42, 43, 109, 44, 45,
584 46, 47, 48, 49, 50, 51, 127, 110, 53, 40,
585 41, 42, 43, 123, 44, 45, 46, 47, 48, 49,
586 50, 51, 52, 124, 53, 46, 47, 48, 133, 125,
587 73, 46, 47, 48, 101, 102, 75, 139, 137, 114,
588 112, 163, 155, 152, 158, 153, 160, 164, -95, 159,
589 166, 168, 167, 169, 170, 171, 173, 172, 174, 178,
590 182, 185, 192, 184, 186, 204, 191, 212, 197, 213,
591 218, 202, 241, 215, 242, 14, 220, 217, 225, 151,
592 232, 63, 150, 111, 143, 122, 228, 72, 175, 181,
596 static const short yycheck[] = { 114,
597 24, 115, 24, 21, 179, 25, 171, 31, 19, 174,
598 19, 125, 187, 19, 20, 190, 4, 19, 20, 36,
599 185, 19, 19, 20, 199, 139, 22, 38, 19, 20,
600 54, 40, 197, 39, 36, 21, 19, 20, 60, 214,
601 64, 39, 48, 19, 40, 65, 48, 19, 39, 163,
602 215, 48, 217, 36, 19, 230, 231, 48, 40, 84,
603 85, 19, 84, 87, 22, 48, 40, 39, 19, 41,
604 184, 36, 186, 45, 46, 47, 40, 9, 103, 19,
605 105, 39, 40, 15, 108, 110, 18, 111, 39, 210,
606 41, 19, 207, 208, 45, 46, 47, 41, 219, 123,
607 44, 29, 30, 31, 41, 220, 221, 44, 223, 19,
608 225, 5, 6, 7, 8, 9, 19, 11, 12, 13,
609 14, 15, 16, 17, 18, 19, 10, 21, 15, 39,
610 14, 36, 15, 38, 19, 45, 46, 47, 3, 33,
611 34, 5, 6, 7, 8, 9, 43, 11, 12, 13,
612 14, 15, 16, 17, 18, 19, 19, 21, 23, 24,
613 25, 26, 27, 28, 19, 29, 30, 31, 19, 44,
614 45, 21, 19, 41, 29, 30, 31, 19, 29, 30,
615 31, 32, 33, 34, 35, 40, 37, 38, 19, 23,
616 24, 25, 26, 27, 28, 40, 42, 41, 29, 30,
617 31, 32, 33, 34, 35, 19, 37, 38, 5, 6,
618 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
619 17, 18, 19, 40, 21, 5, 6, 7, 8, 9,
620 19, 11, 12, 13, 14, 15, 16, 17, 18, 19,
621 41, 21, 5, 6, 7, 8, 9, 19, 11, 12,
622 13, 14, 15, 16, 17, 18, 19, 19, 21, 6,
623 7, 8, 9, 19, 11, 12, 13, 14, 15, 16,
624 17, 18, 19, 19, 21, 13, 14, 15, 19, 40,
625 18, 13, 14, 15, 19, 40, 18, 40, 19, 39,
626 19, 40, 36, 38, 19, 23, 44, 19, 41, 41,
627 19, 38, 23, 23, 20, 41, 23, 41, 41, 19,
628 19, 41, 19, 40, 40, 19, 40, 23, 41, 19,
629 23, 36, 0, 41, 0, 9, 39, 41, 39, 117,
630 38, 29, 116, 91, 113, 94, 213, 39, 157, 160,
633 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
634 #line 3 "/usr/lib/bison.simple"
635 /* This file comes from bison-1.28. */
637 /* Skeleton output parser for bison,
638 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
640 This program is free software; you can redistribute it and/or modify
641 it under the terms of the GNU General Public License as published by
642 the Free Software Foundation; either version 2, or (at your option)
645 This program is distributed in the hope that it will be useful,
646 but WITHOUT ANY WARRANTY; without even the implied warranty of
647 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
648 GNU General Public License for more details.
650 You should have received a copy of the GNU General Public License
651 along with this program; if not, write to the Free Software
652 Foundation, Inc., 59 Temple Place - Suite 330,
653 Boston, MA 02111-1307, USA. */
655 /* As a special exception, when this file is copied by Bison into a
656 Bison output file, you may use that output file without restriction.
657 This special exception was added by the Free Software Foundation
658 in version 1.24 of Bison. */
660 /* This is the parser code that is written into each bison parser
661 when the %semantic_parser declaration is not specified in the grammar.
662 It was written by Richard Stallman by simplifying the hairy parser
663 used when %semantic_parser is specified. */
665 #ifndef YYSTACK_USE_ALLOCA
667 #define YYSTACK_USE_ALLOCA
668 #else /* alloca not defined */
670 #define YYSTACK_USE_ALLOCA
671 #define alloca __builtin_alloca
672 #else /* not GNU C. */
673 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
674 #define YYSTACK_USE_ALLOCA
676 #else /* not sparc */
677 /* We think this test detects Watcom and Microsoft C. */
678 /* This used to test MSDOS, but that is a bad idea
679 since that symbol is in the user namespace. */
680 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
681 #if 0 /* No need for malloc.h, which pollutes the namespace;
682 instead, just don't use alloca. */
685 #else /* not MSDOS, or __TURBOC__ */
687 /* I don't know what this was needed for, but it pollutes the namespace.
688 So I turned it off. rms, 2 May 1997. */
689 /* #include <malloc.h> */
691 #define YYSTACK_USE_ALLOCA
692 #else /* not MSDOS, or __TURBOC__, or _AIX */
694 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
695 and on HPUX 10. Eventually we can turn this on. */
696 #define YYSTACK_USE_ALLOCA
697 #define alloca __builtin_alloca
700 #endif /* not _AIX */
701 #endif /* not MSDOS, or __TURBOC__ */
702 #endif /* not sparc */
703 #endif /* not GNU C */
704 #endif /* alloca not defined */
705 #endif /* YYSTACK_USE_ALLOCA not defined */
707 #ifdef YYSTACK_USE_ALLOCA
708 #define YYSTACK_ALLOC alloca
710 #define YYSTACK_ALLOC malloc
713 /* Note: there must be only one dollar sign in this file.
714 It is replaced by the list of actions, each action
715 as one case of the switch. */
717 #define yyerrok (yyerrstatus = 0)
718 #define yyclearin (yychar = YYEMPTY)
721 #define YYACCEPT goto yyacceptlab
722 #define YYABORT goto yyabortlab
723 #define YYERROR goto yyerrlab1
724 /* Like YYERROR except do call yyerror.
725 This remains here temporarily to ease the
726 transition to the new meaning of YYERROR, for GCC.
727 Once GCC version 2 has supplanted version 1, this can go. */
728 #define YYFAIL goto yyerrlab
729 #define YYRECOVERING() (!!yyerrstatus)
730 #define YYBACKUP(token, value) \
732 if (yychar == YYEMPTY && yylen == 1) \
733 { yychar = (token), yylval = (value); \
734 yychar1 = YYTRANSLATE (yychar); \
739 { yyerror ("syntax error: cannot back up"); YYERROR; } \
743 #define YYERRCODE 256
746 #define YYLEX yylex()
752 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
754 #define YYLEX yylex(&yylval, &yylloc)
756 #else /* not YYLSP_NEEDED */
758 #define YYLEX yylex(&yylval, YYLEX_PARAM)
760 #define YYLEX yylex(&yylval)
762 #endif /* not YYLSP_NEEDED */
765 /* If nonreentrant, generate the variables here */
769 int yychar; /* the lookahead symbol */
770 YYSTYPE yylval; /* the semantic value of the */
771 /* lookahead symbol */
774 YYLTYPE yylloc; /* location data for the lookahead */
778 int yynerrs; /* number of parse errors so far */
779 #endif /* not YYPURE */
782 int yydebug; /* nonzero means print parse trace */
783 /* Since this is uninitialized, it does not stop multiple parsers
787 /* YYINITDEPTH indicates the initial size of the parser's stacks */
790 #define YYINITDEPTH 200
793 /* YYMAXDEPTH is the maximum size the stacks can grow to
794 (effective only if the built-in stack extension method is used). */
801 #define YYMAXDEPTH 10000
804 /* Define __yy_memcpy. Note that the size argument
805 should be passed with type unsigned int, because that is what the non-GCC
806 definitions require. With GCC, __builtin_memcpy takes an arg
807 of type size_t, but it can handle unsigned int. */
809 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
810 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
811 #else /* not GNU C or C++ */
814 /* This is the most reliable way to avoid incompatibilities
815 in available built-in functions on various systems. */
817 __yy_memcpy (to, from, count)
822 register char *f = from;
823 register char *t = to;
824 register int i = count;
830 #else /* __cplusplus */
832 /* This is the most reliable way to avoid incompatibilities
833 in available built-in functions on various systems. */
835 __yy_memcpy (char *to, char *from, unsigned int count)
837 register char *t = to;
838 register char *f = from;
839 register int i = count;
848 #line 217 "/usr/lib/bison.simple"
850 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
851 into yyparse. The argument should have type void *.
852 It should actually point to an object.
853 Grammar actions can access the variable by casting it
854 to the proper pointer type. */
858 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
859 #define YYPARSE_PARAM_DECL
860 #else /* not __cplusplus */
861 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
862 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
863 #endif /* not __cplusplus */
864 #else /* not YYPARSE_PARAM */
865 #define YYPARSE_PARAM_ARG
866 #define YYPARSE_PARAM_DECL
867 #endif /* not YYPARSE_PARAM */
869 /* Prevent warning if -Wstrict-prototypes. */
872 int yyparse (void *);
879 yyparse(YYPARSE_PARAM_ARG)
882 register int yystate;
884 register short *yyssp;
885 register YYSTYPE *yyvsp;
886 int yyerrstatus; /* number of tokens to shift before error messages enabled */
887 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
889 short yyssa[YYINITDEPTH]; /* the state stack */
890 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
892 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
893 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
896 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
897 YYLTYPE *yyls = yylsa;
900 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
902 #define YYPOPSTACK (yyvsp--, yyssp--)
905 int yystacksize = YYINITDEPTH;
906 int yyfree_stacks = 0;
917 YYSTYPE yyval; /* the variable used to return */
918 /* semantic values from the action */
925 fprintf(stderr, "Starting parse\n");
931 yychar = YYEMPTY; /* Cause a token to be read. */
933 /* Initialize stack pointers.
934 Waste one element of value and location stack
935 so that they stay on the same level as the state stack.
936 The wasted elements are never initialized. */
944 /* Push a new state, which is found in yystate . */
945 /* In all cases, when you get here, the value and location stacks
946 have just been pushed. so pushing a state here evens the stacks. */
951 if (yyssp >= yyss + yystacksize - 1)
953 /* Give user a chance to reallocate the stack */
954 /* Use copies of these so that the &'s don't force the real ones into memory. */
955 YYSTYPE *yyvs1 = yyvs;
958 YYLTYPE *yyls1 = yyls;
961 /* Get the current used size of the three stacks, in elements. */
962 int size = yyssp - yyss + 1;
965 /* Each stack pointer address is followed by the size of
966 the data in use in that stack, in bytes. */
968 /* This used to be a conditional around just the two extra args,
969 but that might be undefined if yyoverflow is a macro. */
970 yyoverflow("parser stack overflow",
971 &yyss1, size * sizeof (*yyssp),
972 &yyvs1, size * sizeof (*yyvsp),
973 &yyls1, size * sizeof (*yylsp),
976 yyoverflow("parser stack overflow",
977 &yyss1, size * sizeof (*yyssp),
978 &yyvs1, size * sizeof (*yyvsp),
982 yyss = yyss1; yyvs = yyvs1;
986 #else /* no yyoverflow */
987 /* Extend the stack our own way. */
988 if (yystacksize >= YYMAXDEPTH)
990 yyerror("parser stack overflow");
1002 if (yystacksize > YYMAXDEPTH)
1003 yystacksize = YYMAXDEPTH;
1004 #ifndef YYSTACK_USE_ALLOCA
1007 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1008 __yy_memcpy ((char *)yyss, (char *)yyss1,
1009 size * (unsigned int) sizeof (*yyssp));
1010 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1011 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1012 size * (unsigned int) sizeof (*yyvsp));
1014 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1015 __yy_memcpy ((char *)yyls, (char *)yyls1,
1016 size * (unsigned int) sizeof (*yylsp));
1018 #endif /* no yyoverflow */
1020 yyssp = yyss + size - 1;
1021 yyvsp = yyvs + size - 1;
1023 yylsp = yyls + size - 1;
1028 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1031 if (yyssp >= yyss + yystacksize - 1)
1037 fprintf(stderr, "Entering state %d\n", yystate);
1043 /* Do appropriate processing given the current state. */
1044 /* Read a lookahead token if we need one and don't already have one. */
1047 /* First try to decide what to do without reference to lookahead token. */
1049 yyn = yypact[yystate];
1053 /* Not known => get a lookahead token if don't already have one. */
1055 /* yychar is either YYEMPTY or YYEOF
1056 or a valid token in external form. */
1058 if (yychar == YYEMPTY)
1062 fprintf(stderr, "Reading a token: ");
1067 /* Convert token to internal form (in yychar1) for indexing tables with */
1069 if (yychar <= 0) /* This means end of input. */
1072 yychar = YYEOF; /* Don't call YYLEX any more */
1076 fprintf(stderr, "Now at end of input.\n");
1081 yychar1 = YYTRANSLATE(yychar);
1086 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1087 /* Give the individual parser a way to print the precise meaning
1088 of a token, for further debugging info. */
1090 YYPRINT (stderr, yychar, yylval);
1092 fprintf (stderr, ")\n");
1098 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1103 /* yyn is what to do for this token type in this state.
1104 Negative => reduce, -yyn is rule number.
1105 Positive => shift, yyn is new state.
1106 New state is final state => don't bother to shift,
1107 just return success.
1108 0, or most negative number => error. */
1123 /* Shift the lookahead token. */
1127 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1130 /* Discard the token being shifted unless it is eof. */
1131 if (yychar != YYEOF)
1139 /* count tokens shifted since error; after three, turn off error status. */
1140 if (yyerrstatus) yyerrstatus--;
1145 /* Do the default action for the current state. */
1148 yyn = yydefact[yystate];
1152 /* Do a reduction. yyn is the number of a rule to reduce with. */
1156 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1163 fprintf (stderr, "Reducing via rule %d (line %d), ",
1166 /* Print the symbols being reduced, and their result. */
1167 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1168 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1169 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1195 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1197 nodes = g_list_append(nodes,node);
1198 g_string_free(yyvsp[0].cbuf,FALSE);
1204 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1206 nodes = g_list_append(nodes,node);
1207 g_string_free(yyvsp[0].cbuf,FALSE);
1213 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1215 nodes = g_list_append(nodes,node);
1216 g_string_free(yyvsp[0].cbuf,FALSE);
1222 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1224 nodes = g_list_append(nodes,node);
1225 g_string_free(yyvsp[0].cbuf,FALSE);
1231 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1233 nodes = g_list_append(nodes,node);
1234 g_string_free(yyvsp[0].cbuf,FALSE);
1240 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1242 nodes = g_list_append(nodes,node);
1243 g_string_free(yyvsp[0].cbuf,FALSE);
1257 ((Class *)class)->nodes = class_nodes;
1259 nodes = g_list_append(nodes,class);
1265 ((Class *)class)->nodes = NULL;
1267 nodes = g_list_append(nodes,class);
1273 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1302 { the_scope = PUBLIC_SCOPE; ;
1306 { the_scope = PRIVATE_SCOPE; ;
1310 { the_scope = PROTECTED_SCOPE; ;
1315 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1316 g_free(yyvsp[-1].id);
1317 destructor = yyvsp[0].id;
1318 destructor_line = line_no;
1319 destructor_simple = TRUE;
1321 g_free(yyvsp[-1].id);
1322 g_free(yyvsp[0].id);
1323 yyerror(_("parse error"));
1331 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1332 g_free(yyvsp[-2].id);
1333 destructor = (yyvsp[0].cbuf)->str;
1334 g_string_free(yyvsp[0].cbuf, FALSE);
1335 destructor_line = ccode_line;
1336 destructor_simple = FALSE;
1338 g_free(yyvsp[-2].id);
1339 g_string_free(yyvsp[0].cbuf, TRUE);
1340 yyerror(_("parse error"));
1348 initializer = yyvsp[0].id;
1349 initializer_line = ccode_line;
1355 initializer = (yyvsp[0].cbuf)->str;
1356 initializer_line = ccode_line;
1357 g_string_free(yyvsp[0].cbuf, FALSE);
1370 { destructor = NULL; ;
1374 { initializer = NULL; ;
1386 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1392 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1398 if(strcmp(yyvsp[-6].id,"get")==0 &&
1399 strcmp(yyvsp[-3].id,"set")==0) {
1401 Type *type = pop_type();
1402 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1403 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1404 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1405 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1407 g_string_free(yyvsp[-4].cbuf,FALSE);
1408 g_string_free(yyvsp[-1].cbuf,FALSE);
1409 class_nodes = g_list_append(class_nodes,node);
1410 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1411 strcmp(yyvsp[-3].id,"get")==0) {
1413 Type *type = pop_type();
1414 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1415 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1416 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1417 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1419 g_string_free(yyvsp[-1].cbuf,FALSE);
1420 g_string_free(yyvsp[-4].cbuf,FALSE);
1421 class_nodes = g_list_append(class_nodes,node);
1423 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1424 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1425 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1426 g_string_free(yyvsp[-1].cbuf,TRUE);
1427 g_string_free(yyvsp[-4].cbuf,TRUE);
1428 yyerror(_("parse error"));
1436 if(strcmp(yyvsp[-3].id,"get")==0) {
1438 Type *type = pop_type();
1439 g_free(yyvsp[-3].id);
1440 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1441 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1442 NULL,0, yyvsp[-7].line);
1443 g_string_free(yyvsp[-1].cbuf,FALSE);
1444 class_nodes = g_list_append(class_nodes,node);
1445 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1447 Type *type = pop_type();
1448 g_free(yyvsp[-3].id);
1449 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1450 NULL,0,(yyvsp[-1].cbuf)->str,
1451 yyvsp[-2].line, yyvsp[-7].line);
1452 g_string_free(yyvsp[-1].cbuf,FALSE);
1453 class_nodes = g_list_append(class_nodes,node);
1455 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1456 g_free(yyvsp[-4].id);
1457 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1458 g_string_free(yyvsp[-1].cbuf,TRUE);
1459 yyerror(_("parse error"));
1468 char *get, *set = NULL;
1473 if(strcmp(yyvsp[0].id,"link")!=0 &&
1474 strcmp(yyvsp[0].id,"stringlink")!=0 &&
1475 strcmp(yyvsp[0].id,"objectlink")!=0) {
1476 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1477 g_free(yyvsp[-1].id);
1478 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1479 yyerror(_("parse error"));
1485 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1486 if(var->scope == PRIVATE_SCOPE)
1487 root = "self->_priv";
1491 if(strcmp(yyvsp[0].id,"link")==0) {
1492 set = g_strdup_printf("%s->%s = ARG;",
1493 root, yyvsp[-1].id);
1494 } else if(strcmp(yyvsp[0].id,"stringlink")==0) {
1495 set = g_strdup_printf("g_free(%s->%s); "
1496 "%s->%s = g_strdup(ARG);",
1498 root, yyvsp[-1].id);
1499 } else if(strcmp(yyvsp[0].id,"objectlink")==0) {
1500 set = g_strdup_printf(
1502 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1505 "gtk_object_ref(GTK_OBJECT(%s->%s)); ",
1510 root, yyvsp[-1].id);
1512 g_assert_not_reached();
1515 /* get is the same for everything */
1516 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1518 g_free(yyvsp[0].id);
1522 type = copy_type(var->vtype);
1524 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1525 yyvsp[-1].id, get, yyvsp[-4].line,
1526 set, yyvsp[-4].line, yyvsp[-4].line);
1527 class_nodes = g_list_append(class_nodes,node);
1533 if(strcmp(yyvsp[-2].id,"type")!=0) {
1534 g_free(yyvsp[-4].id);
1535 g_free(yyvsp[-2].id);
1536 yyerror(_("parse error"));
1539 yyval.id = yyvsp[-4].id;
1545 yyval.id = yyvsp[0].id;
1546 typestack = g_list_prepend(typestack,NULL);
1551 { yyval.list = yyvsp[-1].list; ;
1555 { yyval.list = NULL; ;
1560 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1566 yyval.list = g_list_append(NULL,yyvsp[0].id);
1576 Type *type = typestack->data;
1577 char *oldname = type->name;
1578 type->name = g_strconcat("const ",oldname,NULL);
1585 Node *node = new_type(0,yyvsp[0].id,NULL);
1586 typestack = g_list_prepend(typestack,node);
1592 Node *node = new_type(stars,yyvsp[-1].id,NULL);
1594 typestack = g_list_prepend(typestack,node);
1600 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1606 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1612 yyval.id = g_strdup(yyvsp[0].id);
1618 yyval.id = g_strdup("unsigned char");
1624 yyval.id = g_strdup("signed char");
1630 yyval.id = g_strdup("char");
1636 yyval.id = g_strdup("double");
1642 yyval.id = g_strdup("float");
1648 yyval.id = yyvsp[0].id;
1654 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1655 g_free(yyvsp[0].id);
1661 yyval.id = yyvsp[0].id;
1667 yyval.id = g_strdup("void");
1673 yyval.id = "long int";
1685 yyval.id = "short int";
1709 yyval.id = "union ";
1715 yyval.id = "struct ";
1729 if(strcmp(yyvsp[-1].id, "first")==0)
1730 yyval.sigtype = SIGNAL_FIRST_METHOD;
1731 else if(strcmp(yyvsp[-1].id, "last")==0)
1732 yyval.sigtype = SIGNAL_LAST_METHOD;
1734 yyerror(_("signal must be 'first' or 'last'"));
1735 g_free(yyvsp[-1].id);
1738 g_free(yyvsp[-1].id);
1744 yyval.sigtype = SIGNAL_LAST_METHOD;
1750 if(strcmp(yyvsp[-1].id,"first")==0)
1751 yyval.sigtype = SIGNAL_FIRST_METHOD;
1752 else if(strcmp(yyvsp[-1].id,"last")==0)
1753 yyval.sigtype = SIGNAL_LAST_METHOD;
1755 yyerror(_("signal must be 'first' or 'last'"));
1756 g_free(yyvsp[-1].id);
1759 g_free(yyvsp[-1].id);
1765 if(strcmp(yyvsp[-2].id,"first")==0)
1766 yyval.sigtype = SIGNAL_FIRST_METHOD;
1767 else if(strcmp(yyvsp[-2].id,"last")==0)
1768 yyval.sigtype = SIGNAL_LAST_METHOD;
1770 yyerror(_("signal must be 'first' or 'last'"));
1771 g_free(yyvsp[-2].id);
1774 g_free(yyvsp[-2].id);
1780 yyval.sigtype = SIGNAL_LAST_METHOD;
1786 /* the_scope was default thus public */
1787 the_scope = PUBLIC_SCOPE;
1793 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1799 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1805 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1810 { yyval.cbuf = yyvsp[0].cbuf; ;
1814 { yyval.cbuf = NULL; ;
1820 yyerror(_("signal without 'self' as "
1821 "first parameter"));
1822 free_all_global_state();
1825 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1826 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1827 ccode_line, vararg, yyvsp[-8].list);
1834 yyerror(_("signal without 'self' as "
1835 "first parameter"));
1836 free_all_global_state();
1839 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1840 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1841 ccode_line, vararg, yyvsp[-8].list);
1848 yyerror(_("virtual method without 'self' as "
1849 "first parameter"));
1850 free_all_global_state();
1853 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1854 yyvsp[0].cbuf, yyvsp[-8].line,
1855 ccode_line, vararg, NULL);
1862 yyerror(_("virtual method without 'self' as "
1863 "first parameter"));
1864 free_all_global_state();
1867 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1868 yyvsp[0].cbuf, yyvsp[-7].line,
1869 ccode_line, vararg, NULL);
1876 yyerror(_("virtual method without 'self' as "
1877 "first parameter"));
1878 free_all_global_state();
1881 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1882 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
1883 ccode_line, vararg, NULL);
1889 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
1890 yyvsp[-5].id, yyvsp[0].cbuf,
1891 yyvsp[-10].line, ccode_line,
1898 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
1899 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
1906 if(strcmp(yyvsp[-4].id, "init")==0) {
1907 push_init_arg(yyvsp[-2].id,FALSE);
1908 push_function(NO_SCOPE, INIT_METHOD, NULL,
1909 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1910 ccode_line, FALSE, NULL);
1911 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
1912 push_init_arg(yyvsp[-2].id,TRUE);
1913 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
1914 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1915 ccode_line, FALSE, NULL);
1917 g_free(yyvsp[-4].id);
1918 g_free(yyvsp[-2].id);
1919 g_string_free(yyvsp[-2].cbuf,TRUE);
1920 yyerror(_("parse error"));
1928 g_free(onerror); onerror = NULL;
1929 g_free(defreturn); defreturn = NULL;
1930 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1931 g_free(yyvsp[-1].id);
1932 g_free(yyvsp[0].id);
1933 yyerror(_("parse error"));
1936 g_free(yyvsp[-1].id);
1942 g_free(onerror); onerror = NULL;
1943 g_free(defreturn); defreturn = NULL;
1944 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
1945 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1946 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1947 yyerror(_("parse error"));
1950 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1951 onerror = defreturn = NULL;
1952 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1953 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1954 yyerror(_("parse error"));
1957 g_free(yyvsp[-3].id);
1958 g_free(yyvsp[-1].id);
1964 g_free(onerror); onerror = NULL;
1965 g_free(defreturn); defreturn = NULL;
1970 { yyval.id = yyvsp[0].id; ;
1975 yyval.id = (yyvsp[1].cbuf)->str;
1976 g_string_free(yyvsp[1].cbuf, FALSE);
1981 { vararg = FALSE; has_self = FALSE; ;
1988 if(strcmp(yyvsp[0].id,"self")==0)
1989 push_self(yyvsp[0].id);
1991 g_free(yyvsp[0].id);
1992 yyerror(_("parse error"));
2001 if(strcmp(yyvsp[-2].id,"self")==0)
2002 push_self(yyvsp[-2].id);
2004 g_free(yyvsp[-2].id);
2005 yyerror(_("parse error"));
2012 { has_self = FALSE; ;
2033 push_funcarg(yyvsp[0].id,NULL);
2039 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2045 if(strcmp(yyvsp[-2].id,"check")!=0) {
2046 yyerror(_("parse error"));
2049 g_free(yyvsp[-2].id);
2050 push_funcarg(yyvsp[-4].id,NULL);
2056 if(strcmp(yyvsp[-2].id,"check")!=0) {
2057 yyerror(_("parse error"));
2060 g_free(yyvsp[-2].id);
2061 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2075 if(strcmp(yyvsp[0].id,"type")==0) {
2076 Node *node = new_check(TYPE_CHECK,NULL);
2077 checks = g_list_append(checks,node);
2078 } else if(strcmp(yyvsp[0].id,"null")==0) {
2079 Node *node = new_check(NULL_CHECK,NULL);
2080 checks = g_list_append(checks,node);
2082 yyerror(_("parse error"));
2085 g_free(yyvsp[0].id);
2091 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2092 checks = g_list_append(checks,node);
2098 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2099 checks = g_list_append(checks,node);
2105 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2106 checks = g_list_append(checks,node);
2112 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2113 checks = g_list_append(checks,node);
2119 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2120 checks = g_list_append(checks,node);
2126 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2127 checks = g_list_append(checks,node);
2132 { yyval.id = yyvsp[0].id; ;
2137 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2138 g_free(yyvsp[0].id);
2143 { yyval.id = yyvsp[0].id; ;
2146 /* the action file gets copied in in place of this dollarsign */
2147 #line 543 "/usr/lib/bison.simple"
2158 short *ssp1 = yyss - 1;
2159 fprintf (stderr, "state stack now");
2160 while (ssp1 != yyssp)
2161 fprintf (stderr, " %d", *++ssp1);
2162 fprintf (stderr, "\n");
2172 yylsp->first_line = yylloc.first_line;
2173 yylsp->first_column = yylloc.first_column;
2174 yylsp->last_line = (yylsp-1)->last_line;
2175 yylsp->last_column = (yylsp-1)->last_column;
2180 yylsp->last_line = (yylsp+yylen-1)->last_line;
2181 yylsp->last_column = (yylsp+yylen-1)->last_column;
2185 /* Now "shift" the result of the reduction.
2186 Determine what state that goes to,
2187 based on the state we popped back to
2188 and the rule number reduced by. */
2192 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2193 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2194 yystate = yytable[yystate];
2196 yystate = yydefgoto[yyn - YYNTBASE];
2200 yyerrlab: /* here on detecting error */
2203 /* If not already recovering from an error, report this error. */
2207 #ifdef YYERROR_VERBOSE
2208 yyn = yypact[yystate];
2210 if (yyn > YYFLAG && yyn < YYLAST)
2217 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2218 for (x = (yyn < 0 ? -yyn : 0);
2219 x < (sizeof(yytname) / sizeof(char *)); x++)
2220 if (yycheck[x + yyn] == x)
2221 size += strlen(yytname[x]) + 15, count++;
2222 msg = (char *) malloc(size + 15);
2225 strcpy(msg, "parse error");
2230 for (x = (yyn < 0 ? -yyn : 0);
2231 x < (sizeof(yytname) / sizeof(char *)); x++)
2232 if (yycheck[x + yyn] == x)
2234 strcat(msg, count == 0 ? ", expecting `" : " or `");
2235 strcat(msg, yytname[x]);
2244 yyerror ("parse error; also virtual memory exceeded");
2247 #endif /* YYERROR_VERBOSE */
2248 yyerror("parse error");
2252 yyerrlab1: /* here on error raised explicitly by an action */
2254 if (yyerrstatus == 3)
2256 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2258 /* return failure if at end of input */
2259 if (yychar == YYEOF)
2264 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2270 /* Else will try to reuse lookahead token
2271 after shifting the error token. */
2273 yyerrstatus = 3; /* Each real token shifted decrements this */
2277 yyerrdefault: /* current state does not do anything special for the error token. */
2280 /* This is wrong; only states that explicitly want error tokens
2281 should shift them. */
2282 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2283 if (yyn) goto yydefault;
2286 yyerrpop: /* pop the current state because it cannot handle the error token */
2288 if (yyssp == yyss) YYABORT;
2298 short *ssp1 = yyss - 1;
2299 fprintf (stderr, "Error: state stack now");
2300 while (ssp1 != yyssp)
2301 fprintf (stderr, " %d", *++ssp1);
2302 fprintf (stderr, "\n");
2308 yyn = yypact[yystate];
2313 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2332 fprintf(stderr, "Shifting error token, ");
2344 /* YYACCEPT comes here. */
2356 /* YYABORT comes here. */