2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
51 extern char *filename;
55 static GList *class_nodes = NULL;
58 static GList *typestack = NULL;
60 static GList *funcargs = NULL;
61 static GList *checks = NULL;
62 static int has_self = FALSE;
63 static int vararg = FALSE;
65 static GList *gtktypes = NULL;
67 /* this can be a global as we will only do one function at a time
69 static int the_scope = NO_SCOPE;
74 extern int ccode_line;
85 if(strcmp(yytext,"\n")==0) {
86 out=g_strconcat("Error: ",str," before newline",NULL);
87 } else if(yytext[0]=='\0') {
88 out=g_strconcat("Error: ",str," at end of input",NULL);
90 char *tmp = g_strdup(yytext);
91 while((p=strchr(tmp,'\n')))
94 out=g_strconcat("Error: ",str," before '",tmp,"'",NULL);
98 fprintf(stderr,"%s:%d: %s\n",filename,line_no,out);
105 push_variable(char *name, int scope, int line_no, char *postfix)
108 Type *type = typestack->data;
109 typestack = g_list_remove(typestack,typestack->data);
111 type->postfix = postfix;
113 var = new_variable(scope,type,name,line_no);
114 class_nodes = g_list_append(class_nodes, var);
118 push_function(int scope, int method, char *oid, char *id, char *onerror,
119 GString *cbuf,int line_no, int ccode_line, int vararg)
125 if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) {
126 type = typestack->data;
127 typestack = g_list_remove(typestack,typestack->data);
129 type = (Type *)new_type(0,g_strdup("void"),NULL);
132 /* a complicated and ugly test to figure out if we have
133 the wrong number of types for a signal */
134 if((method == SIGNAL_FIRST_METHOD ||
135 method == SIGNAL_LAST_METHOD) &&
136 g_list_length(gtktypes) != g_list_length(funcargs) &&
137 !(g_list_length(funcargs) == 1 &&
138 g_list_length(gtktypes) == 2 &&
139 strcmp(gtktypes->next->data,"NONE")==0)) {
140 print_error(TRUE, _("The number of GTK arguments and "
141 "function arguments for a signal "
142 "don't seem to match"),line_no);
146 c_cbuf = p = cbuf->str;
147 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
154 node = new_method(scope,method,type,oid,gtktypes,id,funcargs,
155 onerror,c_cbuf,line_no,ccode_line,vararg);
159 /*only free segment if we haven't passed it
165 class_nodes = g_list_append(class_nodes, node);
169 push_funcarg(char *name, char *postfix)
172 Type *type = typestack->data;
173 typestack = g_list_remove(typestack,typestack->data);
175 type->postfix = postfix;
177 node = new_funcarg(type,name,checks);
180 funcargs = g_list_append(funcargs, node);
184 push_init_arg(char *name, int is_class)
191 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
193 tn = g_strdup(((Class *)class)->otype);
195 type = new_type(1,tn,NULL);
196 node = new_funcarg((Type *)type,name,NULL);
197 funcargs = g_list_prepend(funcargs, node);
206 type = new_type(1,g_strdup(((Class *)class)->otype),NULL);
207 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
208 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
209 node = new_funcarg((Type *)type,id,ch);
210 funcargs = g_list_prepend(funcargs, node);
237 #define YYFLAG -32768
240 #define YYTRANSLATE(x) ((unsigned)(x) <= 286 ? yytranslate[x] : 76)
242 static const char yytranslate[] = { 0,
243 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
244 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
245 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
246 2, 2, 44, 2, 2, 2, 2, 2, 2, 36,
247 37, 39, 2, 40, 45, 2, 2, 2, 2, 2,
248 2, 2, 2, 2, 2, 2, 2, 2, 35, 42,
249 43, 41, 2, 2, 2, 2, 2, 2, 2, 2,
250 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
251 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
252 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
253 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
254 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
255 2, 2, 33, 38, 34, 2, 2, 2, 2, 2,
256 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
257 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
258 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
259 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
260 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
261 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
262 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
263 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
264 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
265 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
266 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
267 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
268 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
269 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
270 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
271 27, 28, 29, 30, 31, 32
275 static const short yyprhs[] = { 0,
276 0, 4, 7, 10, 12, 15, 18, 20, 22, 27,
277 31, 36, 39, 42, 45, 47, 49, 51, 53, 55,
278 57, 62, 68, 80, 89, 93, 94, 98, 100, 102,
279 105, 107, 110, 113, 116, 118, 121, 124, 126, 128,
280 130, 132, 135, 137, 139, 142, 144, 147, 149, 151,
281 153, 155, 157, 160, 162, 165, 167, 171, 175, 178,
282 180, 185, 189, 191, 194, 196, 206, 217, 227, 237,
283 246, 258, 267, 273, 276, 280, 281, 283, 285, 289,
284 291, 295, 297, 301, 303, 306, 310, 317, 325, 328,
285 330, 332, 335, 338, 342, 346, 350, 354, 356, 359
288 static const short yyrhs[] = { 47,
289 48, 47, 0, 48, 47, 0, 47, 48, 0, 48,
290 0, 47, 24, 0, 47, 25, 0, 24, 0, 25,
291 0, 49, 33, 50, 34, 0, 49, 33, 34, 0,
292 3, 22, 4, 22, 0, 50, 67, 0, 50, 52,
293 0, 50, 53, 0, 67, 0, 52, 0, 53, 0,
294 26, 0, 27, 0, 28, 0, 51, 56, 20, 35,
295 0, 51, 56, 20, 23, 35, 0, 29, 54, 20,
296 20, 20, 33, 24, 20, 33, 24, 35, 0, 29,
297 54, 20, 20, 20, 33, 24, 35, 0, 36, 55,
298 37, 0, 0, 20, 38, 55, 0, 20, 0, 57,
299 0, 5, 57, 0, 58, 0, 58, 61, 0, 12,
300 59, 0, 11, 59, 0, 59, 0, 12, 18, 0,
301 11, 18, 0, 18, 0, 17, 0, 16, 0, 20,
302 0, 60, 20, 0, 22, 0, 6, 0, 13, 15,
303 0, 13, 0, 14, 15, 0, 14, 0, 15, 0,
304 9, 0, 8, 0, 7, 0, 39, 61, 0, 39,
305 0, 20, 64, 0, 64, 0, 51, 20, 64, 0,
306 20, 51, 64, 0, 51, 64, 0, 62, 0, 20,
307 36, 65, 37, 0, 65, 40, 20, 0, 20, 0,
308 33, 24, 0, 35, 0, 31, 63, 56, 20, 36,
309 69, 37, 68, 66, 0, 51, 31, 62, 56, 20,
310 36, 69, 37, 68, 66, 0, 30, 51, 56, 20,
311 36, 69, 37, 68, 66, 0, 51, 30, 56, 20,
312 36, 69, 37, 68, 66, 0, 30, 56, 20, 36,
313 69, 37, 68, 66, 0, 32, 36, 22, 37, 56,
314 20, 36, 69, 37, 68, 66, 0, 51, 56, 20,
315 36, 69, 37, 68, 66, 0, 20, 36, 20, 37,
316 66, 0, 19, 75, 0, 19, 33, 24, 0, 0,
317 6, 0, 20, 0, 20, 40, 70, 0, 70, 0,
318 71, 40, 10, 0, 71, 0, 71, 40, 72, 0,
319 72, 0, 56, 20, 0, 56, 20, 23, 0, 56,
320 20, 36, 20, 73, 37, 0, 56, 20, 23, 36,
321 20, 73, 37, 0, 73, 74, 0, 74, 0, 20,
322 0, 41, 75, 0, 42, 75, 0, 41, 43, 75,
323 0, 42, 43, 75, 0, 43, 43, 75, 0, 44,
324 43, 75, 0, 21, 0, 45, 21, 0, 20, 0
330 static const short yyrline[] = { 0,
331 216, 217, 218, 219, 222, 228, 233, 239, 246, 251,
332 258, 263, 264, 265, 266, 267, 268, 271, 272, 273,
333 276, 279, 283, 316, 344, 345, 348, 351, 357, 358,
334 366, 370, 377, 380, 383, 386, 389, 392, 395, 398,
335 401, 404, 408, 411, 416, 419, 422, 425, 428, 433,
336 436, 439, 444, 445, 449, 461, 467, 479, 491, 494,
337 500, 505, 508, 513, 514, 518, 528, 538, 548, 558,
338 568, 574, 579, 600, 601, 605, 608, 609, 620, 630,
339 633, 634, 637, 638, 641, 644, 647, 655, 665, 666,
340 669, 682, 686, 690, 694, 698, 702, 708, 709, 713
345 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
347 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
348 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
349 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","ONERROR","TOKEN","NUMBER","TYPETOKEN",
350 "ARRAY_DIM","CCODE","HCODE","PUBLIC","PRIVATE","PROTECTED","ARGUMENT","VIRTUAL",
351 "SIGNAL","OVERRIDE","'{'","'}'","';'","'('","')'","'|'","'*'","','","'>'","'<'",
352 "'='","'!'","'-'","prog","ccodes","class","classdec","classcode","scope","variable",
353 "argument","argflags","flaglist","type","type1","type2","integer","tspecifier",
354 "stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode","method",
355 "onerror","funcargs","arglist","arglist1","arg","checklist","check","numtok", NULL
359 static const short yyr1[] = { 0,
360 46, 46, 46, 46, 47, 47, 47, 47, 48, 48,
361 49, 50, 50, 50, 50, 50, 50, 51, 51, 51,
362 52, 52, 53, 53, 54, 54, 55, 55, 56, 56,
363 57, 57, 58, 58, 58, 58, 58, 58, 58, 58,
364 58, 58, 58, 58, 59, 59, 59, 59, 59, 60,
365 60, 60, 61, 61, 62, 62, 63, 63, 63, 63,
366 64, 65, 65, 66, 66, 67, 67, 67, 67, 67,
367 67, 67, 67, 68, 68, 68, 69, 69, 69, 69,
368 70, 70, 71, 71, 72, 72, 72, 72, 73, 73,
369 74, 74, 74, 74, 74, 74, 74, 75, 75, 75
372 static const short yyr2[] = { 0,
373 3, 2, 2, 1, 2, 2, 1, 1, 4, 3,
374 4, 2, 2, 2, 1, 1, 1, 1, 1, 1,
375 4, 5, 11, 8, 3, 0, 3, 1, 1, 2,
376 1, 2, 2, 2, 1, 2, 2, 1, 1, 1,
377 1, 2, 1, 1, 2, 1, 2, 1, 1, 1,
378 1, 1, 2, 1, 2, 1, 3, 3, 2, 1,
379 4, 3, 1, 2, 1, 9, 10, 9, 9, 8,
380 11, 8, 5, 2, 3, 0, 1, 1, 3, 1,
381 3, 1, 3, 1, 2, 3, 6, 7, 2, 1,
382 1, 2, 2, 3, 3, 3, 3, 1, 2, 1
385 static const short yydefact[] = { 0,
386 0, 7, 8, 0, 4, 0, 0, 5, 6, 3,
387 2, 0, 0, 1, 0, 18, 19, 20, 26, 0,
388 0, 0, 10, 0, 0, 16, 17, 15, 11, 0,
389 0, 0, 0, 44, 52, 51, 50, 0, 0, 46,
390 48, 49, 40, 39, 38, 41, 43, 0, 0, 29,
391 31, 35, 0, 0, 0, 60, 0, 56, 0, 9,
392 13, 14, 12, 0, 0, 0, 0, 28, 0, 0,
393 30, 37, 34, 36, 33, 45, 47, 0, 0, 54,
394 32, 42, 0, 0, 0, 55, 0, 59, 0, 0,
395 0, 0, 0, 0, 0, 0, 25, 0, 0, 0,
396 53, 63, 0, 58, 57, 0, 0, 0, 0, 0,
397 21, 0, 0, 65, 73, 27, 0, 0, 44, 41,
398 0, 0, 80, 82, 84, 61, 0, 0, 0, 0,
399 0, 22, 0, 64, 0, 0, 0, 85, 76, 0,
400 62, 0, 0, 0, 0, 76, 0, 76, 79, 86,
401 0, 0, 0, 81, 83, 76, 0, 76, 0, 0,
402 0, 24, 0, 0, 0, 100, 98, 0, 0, 74,
403 70, 0, 0, 0, 76, 72, 0, 68, 0, 91,
404 0, 0, 0, 0, 0, 90, 75, 99, 66, 76,
405 69, 0, 0, 0, 0, 92, 0, 93, 0, 0,
406 87, 89, 0, 67, 23, 88, 94, 95, 96, 97,
410 static const short yydefgoto[] = { 212,
411 4, 5, 6, 24, 25, 26, 27, 32, 69, 121,
412 50, 51, 52, 53, 81, 56, 57, 58, 103, 115,
413 28, 153, 122, 123, 124, 125, 185, 186, 170
416 static const short yypact[] = { 77,
417 -16,-32768,-32768, 85, 65, 6, 51,-32768,-32768, 65,
418 120, 216, 42, 120, 46,-32768,-32768,-32768, 62, 115,
419 15, 89,-32768, 229, 54,-32768,-32768,-32768,-32768, 91,
420 116, 131, 206,-32768,-32768,-32768,-32768, 79, 135, 125,
421 140,-32768,-32768,-32768,-32768,-32768,-32768, 171, 161,-32768,
422 151,-32768, 172, 205, 179,-32768, 171,-32768, 186,-32768,
423 -32768,-32768,-32768, 171, 190, 196, 197, 199, 198, 207,
424 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 218, 203, 151,
425 -32768,-32768, 204, 231, 232,-32768, -7,-32768, 233, 217,
426 242, -7, 171, 111, 139, 116,-32768, 244, 230, 189,
427 -32768,-32768, -30,-32768,-32768, 234, 171, 235, 245, 237,
428 -32768, 189, 243,-32768,-32768,-32768, 236, 189, 238, 59,
429 248, 239,-32768, 240,-32768,-32768, 253, 189, 254, 189,
430 241,-32768, 246,-32768, 255, 247, 171, 9, 259, 153,
431 -32768, 249, 251, 252, 189, 259, -5, 259,-32768, 256,
432 261, 5, 139,-32768,-32768, 259, 189, 259, 257, 139,
433 258,-32768, 139, 262, 75,-32768,-32768, 264, 269,-32768,
434 -32768, 139, 260, 139, 259,-32768, 271,-32768, 75,-32768,
435 13, 32, 250, 263, 63,-32768,-32768,-32768,-32768, 259,
436 -32768, 139, 265, 71, 58,-32768, 58,-32768, 58, 58,
437 -32768,-32768, 139,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
438 -32768, 285, 296,-32768
441 static const short yypgoto[] = {-32768,
442 76, 294,-32768,-32768, 3, 275, 277,-32768, 208, -20,
443 270,-32768, 191,-32768, 222, 266,-32768, -38,-32768, -152,
444 281, -144, -109, 170,-32768, 168, 130, -167, -43
451 static const short yytable[] = { 49,
452 171, 160, 133, 163, 66, 7, 126, 176, 136, 127,
453 178, 172, 83, 174, 161, 86, 88, 202, 142, 189,
454 144, 191, 48, 55, 166, 167, 202, 78, 84, 162,
455 192, 150, 166, 167, 54, 159, 89, 168, 12, 204,
456 16, 17, 18, 91, 151, 203, 104, 173, 105, 169,
457 211, 166, 167, 86, 13, 195, 85, 169, 33, 34,
458 35, 36, 37, 29, 38, 39, 40, 41, 42, 43,
459 44, 45, 109, 46, 197, 47, 169, 166, 167, 1,
460 11, 30, 180, 64, 65, 14, 129, 1, 2, 3,
461 180, 40, 41, 42, 180, -78, 72, 31, 137, 201,
462 2, 3, 169, 181, 182, 183, 184, 206, 8, 9,
463 67, 181, 182, 183, 184, 181, 182, 183, 184, 33,
464 34, 35, 36, 37, 59, 38, 39, 40, 41, 42,
465 43, 44, 45, 110, 46, 68, 47, 196, 198, 76,
466 16, 17, 18, 8, 9, 111, 112, 40, 41, 42,
467 70, 207, 74, 208, 77, 209, 210, 33, 34, 35,
468 36, 37, 154, 38, 39, 40, 41, 42, 43, 44,
469 45, 113, 46, 114, 47, 33, 34, 35, 36, 37,
470 79, 38, 39, 40, 41, 42, 43, 44, 45, 80,
471 46, 82, 47, 33, 119, 35, 36, 37, 87, 38,
472 39, 40, 41, 42, 43, 44, 45, 90, 120, 92,
473 47, 34, 35, 36, 37, 94, 38, 39, 40, 41,
474 42, 43, 44, 45, 83, 46, 98, 47, 73, 75,
475 16, 17, 18, 95, 97, 15, 96, 99, 100, 84,
476 84, 16, 17, 18, 19, 20, 21, 22, 15, 23,
477 102, 83, 106, 107, 16, 17, 18, 19, 20, 21,
478 22, 108, 60, 117, 131, 118, 134, 138, 135, 128,
479 130, 132, 141, 143, -77, 139, 145, 152, 147, 140,
480 165, 179, 146, 148, 213, 156, 157, 187, 158, 188,
481 177, 164, 199, 175, 193, 214, 190, 10, 61, 205,
482 62, 101, 71, 116, 63, 200, 149, 155, 194, 0,
483 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
484 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
488 static const short yycheck[] = { 20,
489 153, 146, 112, 148, 25, 22, 37, 160, 118, 40,
490 163, 156, 20, 158, 20, 54, 55, 185, 128, 172,
491 130, 174, 20, 21, 20, 21, 194, 48, 36, 35,
492 175, 23, 20, 21, 20, 145, 57, 33, 33, 192,
493 26, 27, 28, 64, 36, 190, 85, 157, 87, 45,
494 203, 20, 21, 92, 4, 43, 54, 45, 5, 6,
495 7, 8, 9, 22, 11, 12, 13, 14, 15, 16,
496 17, 18, 93, 20, 43, 22, 45, 20, 21, 3,
497 5, 36, 20, 30, 31, 10, 107, 3, 24, 25,
498 20, 13, 14, 15, 20, 37, 18, 36, 40, 37,
499 24, 25, 45, 41, 42, 43, 44, 37, 24, 25,
500 20, 41, 42, 43, 44, 41, 42, 43, 44, 5,
501 6, 7, 8, 9, 36, 11, 12, 13, 14, 15,
502 16, 17, 18, 23, 20, 20, 22, 181, 182, 15,
503 26, 27, 28, 24, 25, 35, 36, 13, 14, 15,
504 20, 195, 18, 197, 15, 199, 200, 5, 6, 7,
505 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
506 18, 33, 20, 35, 22, 5, 6, 7, 8, 9,
507 20, 11, 12, 13, 14, 15, 16, 17, 18, 39,
508 20, 20, 22, 5, 6, 7, 8, 9, 20, 11,
509 12, 13, 14, 15, 16, 17, 18, 22, 20, 20,
510 22, 6, 7, 8, 9, 20, 11, 12, 13, 14,
511 15, 16, 17, 18, 20, 20, 20, 22, 38, 39,
512 26, 27, 28, 37, 37, 20, 38, 20, 36, 36,
513 36, 26, 27, 28, 29, 30, 31, 32, 20, 34,
514 20, 20, 20, 37, 26, 27, 28, 29, 30, 31,
515 32, 20, 34, 20, 20, 36, 24, 20, 33, 36,
516 36, 35, 20, 20, 37, 37, 36, 19, 24, 40,
517 20, 20, 37, 37, 0, 37, 36, 24, 37, 21,
518 33, 36, 43, 37, 24, 0, 37, 4, 24, 35,
519 24, 80, 33, 96, 24, 43, 137, 140, 179, -1,
520 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
521 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
524 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
525 #line 3 "/usr/lib/bison.simple"
526 /* This file comes from bison-1.28. */
528 /* Skeleton output parser for bison,
529 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
531 This program is free software; you can redistribute it and/or modify
532 it under the terms of the GNU General Public License as published by
533 the Free Software Foundation; either version 2, or (at your option)
536 This program is distributed in the hope that it will be useful,
537 but WITHOUT ANY WARRANTY; without even the implied warranty of
538 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
539 GNU General Public License for more details.
541 You should have received a copy of the GNU General Public License
542 along with this program; if not, write to the Free Software
543 Foundation, Inc., 59 Temple Place - Suite 330,
544 Boston, MA 02111-1307, USA. */
546 /* As a special exception, when this file is copied by Bison into a
547 Bison output file, you may use that output file without restriction.
548 This special exception was added by the Free Software Foundation
549 in version 1.24 of Bison. */
551 /* This is the parser code that is written into each bison parser
552 when the %semantic_parser declaration is not specified in the grammar.
553 It was written by Richard Stallman by simplifying the hairy parser
554 used when %semantic_parser is specified. */
556 #ifndef YYSTACK_USE_ALLOCA
558 #define YYSTACK_USE_ALLOCA
559 #else /* alloca not defined */
561 #define YYSTACK_USE_ALLOCA
562 #define alloca __builtin_alloca
563 #else /* not GNU C. */
564 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
565 #define YYSTACK_USE_ALLOCA
567 #else /* not sparc */
568 /* We think this test detects Watcom and Microsoft C. */
569 /* This used to test MSDOS, but that is a bad idea
570 since that symbol is in the user namespace. */
571 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
572 #if 0 /* No need for malloc.h, which pollutes the namespace;
573 instead, just don't use alloca. */
576 #else /* not MSDOS, or __TURBOC__ */
578 /* I don't know what this was needed for, but it pollutes the namespace.
579 So I turned it off. rms, 2 May 1997. */
580 /* #include <malloc.h> */
582 #define YYSTACK_USE_ALLOCA
583 #else /* not MSDOS, or __TURBOC__, or _AIX */
585 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
586 and on HPUX 10. Eventually we can turn this on. */
587 #define YYSTACK_USE_ALLOCA
588 #define alloca __builtin_alloca
591 #endif /* not _AIX */
592 #endif /* not MSDOS, or __TURBOC__ */
593 #endif /* not sparc */
594 #endif /* not GNU C */
595 #endif /* alloca not defined */
596 #endif /* YYSTACK_USE_ALLOCA not defined */
598 #ifdef YYSTACK_USE_ALLOCA
599 #define YYSTACK_ALLOC alloca
601 #define YYSTACK_ALLOC malloc
604 /* Note: there must be only one dollar sign in this file.
605 It is replaced by the list of actions, each action
606 as one case of the switch. */
608 #define yyerrok (yyerrstatus = 0)
609 #define yyclearin (yychar = YYEMPTY)
612 #define YYACCEPT goto yyacceptlab
613 #define YYABORT goto yyabortlab
614 #define YYERROR goto yyerrlab1
615 /* Like YYERROR except do call yyerror.
616 This remains here temporarily to ease the
617 transition to the new meaning of YYERROR, for GCC.
618 Once GCC version 2 has supplanted version 1, this can go. */
619 #define YYFAIL goto yyerrlab
620 #define YYRECOVERING() (!!yyerrstatus)
621 #define YYBACKUP(token, value) \
623 if (yychar == YYEMPTY && yylen == 1) \
624 { yychar = (token), yylval = (value); \
625 yychar1 = YYTRANSLATE (yychar); \
630 { yyerror ("syntax error: cannot back up"); YYERROR; } \
634 #define YYERRCODE 256
637 #define YYLEX yylex()
643 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
645 #define YYLEX yylex(&yylval, &yylloc)
647 #else /* not YYLSP_NEEDED */
649 #define YYLEX yylex(&yylval, YYLEX_PARAM)
651 #define YYLEX yylex(&yylval)
653 #endif /* not YYLSP_NEEDED */
656 /* If nonreentrant, generate the variables here */
660 int yychar; /* the lookahead symbol */
661 YYSTYPE yylval; /* the semantic value of the */
662 /* lookahead symbol */
665 YYLTYPE yylloc; /* location data for the lookahead */
669 int yynerrs; /* number of parse errors so far */
670 #endif /* not YYPURE */
673 int yydebug; /* nonzero means print parse trace */
674 /* Since this is uninitialized, it does not stop multiple parsers
678 /* YYINITDEPTH indicates the initial size of the parser's stacks */
681 #define YYINITDEPTH 200
684 /* YYMAXDEPTH is the maximum size the stacks can grow to
685 (effective only if the built-in stack extension method is used). */
692 #define YYMAXDEPTH 10000
695 /* Define __yy_memcpy. Note that the size argument
696 should be passed with type unsigned int, because that is what the non-GCC
697 definitions require. With GCC, __builtin_memcpy takes an arg
698 of type size_t, but it can handle unsigned int. */
700 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
701 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
702 #else /* not GNU C or C++ */
705 /* This is the most reliable way to avoid incompatibilities
706 in available built-in functions on various systems. */
708 __yy_memcpy (to, from, count)
713 register char *f = from;
714 register char *t = to;
715 register int i = count;
721 #else /* __cplusplus */
723 /* This is the most reliable way to avoid incompatibilities
724 in available built-in functions on various systems. */
726 __yy_memcpy (char *to, char *from, unsigned int count)
728 register char *t = to;
729 register char *f = from;
730 register int i = count;
739 #line 217 "/usr/lib/bison.simple"
741 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
742 into yyparse. The argument should have type void *.
743 It should actually point to an object.
744 Grammar actions can access the variable by casting it
745 to the proper pointer type. */
749 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
750 #define YYPARSE_PARAM_DECL
751 #else /* not __cplusplus */
752 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
753 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
754 #endif /* not __cplusplus */
755 #else /* not YYPARSE_PARAM */
756 #define YYPARSE_PARAM_ARG
757 #define YYPARSE_PARAM_DECL
758 #endif /* not YYPARSE_PARAM */
760 /* Prevent warning if -Wstrict-prototypes. */
763 int yyparse (void *);
770 yyparse(YYPARSE_PARAM_ARG)
773 register int yystate;
775 register short *yyssp;
776 register YYSTYPE *yyvsp;
777 int yyerrstatus; /* number of tokens to shift before error messages enabled */
778 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
780 short yyssa[YYINITDEPTH]; /* the state stack */
781 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
783 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
784 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
787 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
788 YYLTYPE *yyls = yylsa;
791 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
793 #define YYPOPSTACK (yyvsp--, yyssp--)
796 int yystacksize = YYINITDEPTH;
797 int yyfree_stacks = 0;
808 YYSTYPE yyval; /* the variable used to return */
809 /* semantic values from the action */
816 fprintf(stderr, "Starting parse\n");
822 yychar = YYEMPTY; /* Cause a token to be read. */
824 /* Initialize stack pointers.
825 Waste one element of value and location stack
826 so that they stay on the same level as the state stack.
827 The wasted elements are never initialized. */
835 /* Push a new state, which is found in yystate . */
836 /* In all cases, when you get here, the value and location stacks
837 have just been pushed. so pushing a state here evens the stacks. */
842 if (yyssp >= yyss + yystacksize - 1)
844 /* Give user a chance to reallocate the stack */
845 /* Use copies of these so that the &'s don't force the real ones into memory. */
846 YYSTYPE *yyvs1 = yyvs;
849 YYLTYPE *yyls1 = yyls;
852 /* Get the current used size of the three stacks, in elements. */
853 int size = yyssp - yyss + 1;
856 /* Each stack pointer address is followed by the size of
857 the data in use in that stack, in bytes. */
859 /* This used to be a conditional around just the two extra args,
860 but that might be undefined if yyoverflow is a macro. */
861 yyoverflow("parser stack overflow",
862 &yyss1, size * sizeof (*yyssp),
863 &yyvs1, size * sizeof (*yyvsp),
864 &yyls1, size * sizeof (*yylsp),
867 yyoverflow("parser stack overflow",
868 &yyss1, size * sizeof (*yyssp),
869 &yyvs1, size * sizeof (*yyvsp),
873 yyss = yyss1; yyvs = yyvs1;
877 #else /* no yyoverflow */
878 /* Extend the stack our own way. */
879 if (yystacksize >= YYMAXDEPTH)
881 yyerror("parser stack overflow");
893 if (yystacksize > YYMAXDEPTH)
894 yystacksize = YYMAXDEPTH;
895 #ifndef YYSTACK_USE_ALLOCA
898 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
899 __yy_memcpy ((char *)yyss, (char *)yyss1,
900 size * (unsigned int) sizeof (*yyssp));
901 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
902 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
903 size * (unsigned int) sizeof (*yyvsp));
905 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
906 __yy_memcpy ((char *)yyls, (char *)yyls1,
907 size * (unsigned int) sizeof (*yylsp));
909 #endif /* no yyoverflow */
911 yyssp = yyss + size - 1;
912 yyvsp = yyvs + size - 1;
914 yylsp = yyls + size - 1;
919 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
922 if (yyssp >= yyss + yystacksize - 1)
928 fprintf(stderr, "Entering state %d\n", yystate);
934 /* Do appropriate processing given the current state. */
935 /* Read a lookahead token if we need one and don't already have one. */
938 /* First try to decide what to do without reference to lookahead token. */
940 yyn = yypact[yystate];
944 /* Not known => get a lookahead token if don't already have one. */
946 /* yychar is either YYEMPTY or YYEOF
947 or a valid token in external form. */
949 if (yychar == YYEMPTY)
953 fprintf(stderr, "Reading a token: ");
958 /* Convert token to internal form (in yychar1) for indexing tables with */
960 if (yychar <= 0) /* This means end of input. */
963 yychar = YYEOF; /* Don't call YYLEX any more */
967 fprintf(stderr, "Now at end of input.\n");
972 yychar1 = YYTRANSLATE(yychar);
977 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
978 /* Give the individual parser a way to print the precise meaning
979 of a token, for further debugging info. */
981 YYPRINT (stderr, yychar, yylval);
983 fprintf (stderr, ")\n");
989 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
994 /* yyn is what to do for this token type in this state.
995 Negative => reduce, -yyn is rule number.
996 Positive => shift, yyn is new state.
997 New state is final state => don't bother to shift,
999 0, or most negative number => error. */
1014 /* Shift the lookahead token. */
1018 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1021 /* Discard the token being shifted unless it is eof. */
1022 if (yychar != YYEOF)
1030 /* count tokens shifted since error; after three, turn off error status. */
1031 if (yyerrstatus) yyerrstatus--;
1036 /* Do the default action for the current state. */
1039 yyn = yydefact[yystate];
1043 /* Do a reduction. yyn is the number of a rule to reduce with. */
1047 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1054 fprintf (stderr, "Reducing via rule %d (line %d), ",
1057 /* Print the symbols being reduced, and their result. */
1058 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1059 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1060 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1086 Node *node = new_ccode(FALSE,(yyvsp[0].cbuf)->str,
1088 nodes = g_list_append(nodes,node);
1089 g_string_free(yyvsp[0].cbuf,FALSE);
1095 Node *node = new_ccode(TRUE,(yyvsp[0].cbuf)->str,ccode_line);
1096 nodes = g_list_append(nodes,node);
1097 g_string_free(yyvsp[0].cbuf,FALSE);
1103 Node *node = new_ccode(FALSE,(yyvsp[0].cbuf)->str,
1105 nodes = g_list_append(nodes,node);
1106 g_string_free(yyvsp[0].cbuf,FALSE);
1112 Node *node = new_ccode(TRUE,(yyvsp[0].cbuf)->str,ccode_line);
1113 nodes = g_list_append(nodes,node);
1114 g_string_free(yyvsp[0].cbuf,FALSE);
1120 ((Class *)class)->nodes = class_nodes;
1122 nodes = g_list_append(nodes,class);
1128 ((Class *)class)->nodes = NULL;
1130 nodes = g_list_append(nodes,class);
1136 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1165 { the_scope = PUBLIC_SCOPE; ;
1169 { the_scope = PRIVATE_SCOPE; ;
1173 { the_scope = PROTECTED_SCOPE; ;
1178 push_variable(yyvsp[-1].id,the_scope,yyvsp[-3].line,NULL);
1184 push_variable(yyvsp[-2].id,the_scope,yyvsp[-4].line,yyvsp[-1].id);
1190 if(strcmp(yyvsp[-6].id,"get")==0 &&
1191 strcmp(yyvsp[-3].id,"set")==0) {
1193 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1194 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1195 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1196 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1198 g_string_free(yyvsp[-4].cbuf,FALSE);
1199 g_string_free(yyvsp[-1].cbuf,FALSE);
1200 class_nodes = g_list_append(class_nodes,node);
1201 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1202 strcmp(yyvsp[-3].id,"get")==0) {
1204 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1205 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1206 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1207 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1209 g_string_free(yyvsp[-1].cbuf,FALSE);
1210 g_string_free(yyvsp[-4].cbuf,FALSE);
1211 class_nodes = g_list_append(class_nodes,node);
1213 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1214 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1215 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1216 g_string_free(yyvsp[-1].cbuf,TRUE);
1217 g_string_free(yyvsp[-4].cbuf,TRUE);
1218 yyerror(_("parse error"));
1226 if(strcmp(yyvsp[-3].id,"get")==0) {
1228 g_free(yyvsp[-3].id);
1229 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1230 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1231 NULL,0, yyvsp[-7].line);
1232 g_string_free(yyvsp[-1].cbuf,FALSE);
1233 class_nodes = g_list_append(class_nodes,node);
1234 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1236 g_free(yyvsp[-3].id);
1237 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1238 NULL,0,(yyvsp[-1].cbuf)->str,
1239 yyvsp[-2].line, yyvsp[-7].line);
1240 g_string_free(yyvsp[-1].cbuf,FALSE);
1241 class_nodes = g_list_append(class_nodes,node);
1243 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1244 g_free(yyvsp[-4].id);
1245 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1246 g_string_free(yyvsp[-1].cbuf,TRUE);
1247 yyerror(_("parse error"));
1254 { yyval.list = yyvsp[-1].list; ;
1258 { yyval.list = NULL; ;
1263 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1269 yyval.list = g_list_append(NULL,yyvsp[0].id);
1279 Type *type = typestack->data;
1280 char *oldname = type->name;
1281 type->name = g_strconcat("const ",oldname,NULL);
1288 Node *node = new_type(0,yyvsp[0].id,NULL);
1289 typestack = g_list_prepend(typestack,node);
1295 Node *node = new_type(stars,yyvsp[-1].id,NULL);
1297 typestack = g_list_prepend(typestack,node);
1303 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1309 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1315 yyval.id = g_strdup(yyvsp[0].id);
1321 yyval.id = g_strdup("unsigned char");
1327 yyval.id = g_strdup("signed char");
1333 yyval.id = g_strdup("char");
1339 yyval.id = g_strdup("double");
1345 yyval.id = g_strdup("float");
1351 yyval.id = yyvsp[0].id;
1357 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1358 g_free(yyvsp[0].id);
1364 yyval.id = yyvsp[0].id;
1370 yyval.id = g_strdup("void");
1376 yyval.id = "long int";
1388 yyval.id = "short int";
1412 yyval.id = "union ";
1418 yyval.id = "struct ";
1432 if(strcmp(yyvsp[-1].id,"first")==0)
1433 yyval.sigtype = SIGNAL_FIRST_METHOD;
1434 else if(strcmp(yyvsp[-1].id,"last")==0)
1435 yyval.sigtype = SIGNAL_LAST_METHOD;
1437 yyerror(_("signal must be 'first' or 'last'"));
1438 g_free(yyvsp[-1].id);
1441 g_free(yyvsp[-1].id);
1447 yyval.sigtype = SIGNAL_LAST_METHOD;
1453 if(strcmp(yyvsp[-1].id,"first")==0)
1454 yyval.sigtype = SIGNAL_FIRST_METHOD;
1455 else if(strcmp(yyvsp[-1].id,"last")==0)
1456 yyval.sigtype = SIGNAL_LAST_METHOD;
1458 yyerror(_("signal must be 'first' or 'last'"));
1459 g_free(yyvsp[-1].id);
1462 g_free(yyvsp[-1].id);
1468 if(strcmp(yyvsp[-2].id,"first")==0)
1469 yyval.sigtype = SIGNAL_FIRST_METHOD;
1470 else if(strcmp(yyvsp[-2].id,"last")==0)
1471 yyval.sigtype = SIGNAL_LAST_METHOD;
1473 yyerror(_("signal must be 'first' or 'last'"));
1474 g_free(yyvsp[-2].id);
1477 g_free(yyvsp[-2].id);
1483 yyval.sigtype = SIGNAL_LAST_METHOD;
1489 /* the_scope was default thus public */
1490 the_scope = PUBLIC_SCOPE;
1496 gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
1502 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1508 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1513 { yyval.cbuf = yyvsp[0].cbuf; ;
1517 { yyval.cbuf = NULL; ;
1523 yyerror(_("signal without 'self' as "
1524 "first parameter"));
1527 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1528 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line,
1536 yyerror(_("signal without 'self' as "
1537 "first parameter"));
1540 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1541 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line,
1549 yyerror(_("virtual method without 'self' as "
1550 "first parameter"));
1553 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1554 yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line,
1562 yyerror(_("virtual method without 'self' as "
1563 "first parameter"));
1566 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1567 yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line,
1575 yyerror(_("virtual method without 'self' as "
1576 "first parameter"));
1579 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1580 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line,
1587 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
1588 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,
1589 yyvsp[-10].line,ccode_line,
1596 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
1597 yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line,ccode_line,
1604 if(strcmp(yyvsp[-4].id,"init")==0) {
1605 push_init_arg(yyvsp[-2].id,FALSE);
1606 push_function(NO_SCOPE, INIT_METHOD, NULL,
1607 yyvsp[-4].id, NULL, yyvsp[0].cbuf,yyvsp[-3].line,
1609 } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
1610 push_init_arg(yyvsp[-2].id,TRUE);
1611 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
1612 yyvsp[-4].id, NULL, yyvsp[0].cbuf,yyvsp[-3].line,
1615 g_free(yyvsp[-4].id);
1616 g_free(yyvsp[-2].id);
1617 g_string_free(yyvsp[-2].cbuf,TRUE);
1618 yyerror(_("parse error"));
1625 { yyval.id = yyvsp[0].id; ;
1630 yyval.id = (yyvsp[0].cbuf)->str;
1631 g_string_free(yyvsp[0].cbuf,FALSE);
1636 { yyval.id = NULL; ;
1640 { vararg = FALSE; has_self = FALSE; ;
1647 if(strcmp(yyvsp[0].id,"self")==0)
1648 push_self(yyvsp[0].id);
1650 g_free(yyvsp[0].id);
1651 yyerror(_("parse error"));
1660 if(strcmp(yyvsp[-2].id,"self")==0)
1661 push_self(yyvsp[-2].id);
1663 g_free(yyvsp[-2].id);
1664 yyerror(_("parse error"));
1671 { has_self = FALSE; ;
1692 push_funcarg(yyvsp[0].id,NULL);
1698 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
1704 if(strcmp(yyvsp[-2].id,"check")!=0) {
1705 yyerror(_("parse error"));
1708 g_free(yyvsp[-2].id);
1709 push_funcarg(yyvsp[-4].id,NULL);
1715 if(strcmp(yyvsp[-2].id,"check")!=0) {
1716 yyerror(_("parse error"));
1719 g_free(yyvsp[-2].id);
1720 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
1734 if(strcmp(yyvsp[0].id,"type")==0) {
1735 Node *node = new_check(TYPE_CHECK,NULL);
1736 checks = g_list_append(checks,node);
1737 } else if(strcmp(yyvsp[0].id,"null")==0) {
1738 Node *node = new_check(NULL_CHECK,NULL);
1739 checks = g_list_append(checks,node);
1741 yyerror(_("parse error"));
1744 g_free(yyvsp[0].id);
1750 Node *node = new_check(GT_CHECK,yyvsp[0].id);
1751 checks = g_list_append(checks,node);
1757 Node *node = new_check(LT_CHECK,yyvsp[0].id);
1758 checks = g_list_append(checks,node);
1764 Node *node = new_check(GE_CHECK,yyvsp[0].id);
1765 checks = g_list_append(checks,node);
1771 Node *node = new_check(LE_CHECK,yyvsp[0].id);
1772 checks = g_list_append(checks,node);
1778 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
1779 checks = g_list_append(checks,node);
1785 Node *node = new_check(NE_CHECK,yyvsp[0].id);
1786 checks = g_list_append(checks,node);
1791 { yyval.id = yyvsp[0].id; ;
1796 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
1797 g_free(yyvsp[0].id);
1802 { yyval.id = yyvsp[0].id; ;
1805 /* the action file gets copied in in place of this dollarsign */
1806 #line 543 "/usr/lib/bison.simple"
1817 short *ssp1 = yyss - 1;
1818 fprintf (stderr, "state stack now");
1819 while (ssp1 != yyssp)
1820 fprintf (stderr, " %d", *++ssp1);
1821 fprintf (stderr, "\n");
1831 yylsp->first_line = yylloc.first_line;
1832 yylsp->first_column = yylloc.first_column;
1833 yylsp->last_line = (yylsp-1)->last_line;
1834 yylsp->last_column = (yylsp-1)->last_column;
1839 yylsp->last_line = (yylsp+yylen-1)->last_line;
1840 yylsp->last_column = (yylsp+yylen-1)->last_column;
1844 /* Now "shift" the result of the reduction.
1845 Determine what state that goes to,
1846 based on the state we popped back to
1847 and the rule number reduced by. */
1851 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1852 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1853 yystate = yytable[yystate];
1855 yystate = yydefgoto[yyn - YYNTBASE];
1859 yyerrlab: /* here on detecting error */
1862 /* If not already recovering from an error, report this error. */
1866 #ifdef YYERROR_VERBOSE
1867 yyn = yypact[yystate];
1869 if (yyn > YYFLAG && yyn < YYLAST)
1876 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1877 for (x = (yyn < 0 ? -yyn : 0);
1878 x < (sizeof(yytname) / sizeof(char *)); x++)
1879 if (yycheck[x + yyn] == x)
1880 size += strlen(yytname[x]) + 15, count++;
1881 msg = (char *) malloc(size + 15);
1884 strcpy(msg, "parse error");
1889 for (x = (yyn < 0 ? -yyn : 0);
1890 x < (sizeof(yytname) / sizeof(char *)); x++)
1891 if (yycheck[x + yyn] == x)
1893 strcat(msg, count == 0 ? ", expecting `" : " or `");
1894 strcat(msg, yytname[x]);
1903 yyerror ("parse error; also virtual memory exceeded");
1906 #endif /* YYERROR_VERBOSE */
1907 yyerror("parse error");
1911 yyerrlab1: /* here on error raised explicitly by an action */
1913 if (yyerrstatus == 3)
1915 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1917 /* return failure if at end of input */
1918 if (yychar == YYEOF)
1923 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1929 /* Else will try to reuse lookahead token
1930 after shifting the error token. */
1932 yyerrstatus = 3; /* Each real token shifted decrements this */
1936 yyerrdefault: /* current state does not do anything special for the error token. */
1939 /* This is wrong; only states that explicitly want error tokens
1940 should shift them. */
1941 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1942 if (yyn) goto yydefault;
1945 yyerrpop: /* pop the current state because it cannot handle the error token */
1947 if (yyssp == yyss) YYABORT;
1957 short *ssp1 = yyss - 1;
1958 fprintf (stderr, "Error: state stack now");
1959 while (ssp1 != yyssp)
1960 fprintf (stderr, " %d", *++ssp1);
1961 fprintf (stderr, "\n");
1967 yyn = yypact[yystate];
1972 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1991 fprintf(stderr, "Shifting error token, ");
2003 /* YYACCEPT comes here. */
2015 /* YYABORT comes here. */