2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
49 extern char *filename;
53 static GList *class_nodes = NULL;
56 static GList *typestack = NULL;
58 static GList *funcargs = NULL;
59 static GList *checks = NULL;
60 static int has_this = FALSE;
62 static GList *gtktypes = NULL;
67 extern int ccode_line;
78 if(strcmp(yytext,"\n")==0) {
79 out=g_strconcat("Error: ",str," before newline",NULL);
80 } else if(yytext[0]=='\0') {
81 out=g_strconcat("Error: ",str," at end of input",NULL);
83 char *tmp = g_strdup(yytext);
84 while((p=strchr(tmp,'\n')))
87 out=g_strconcat("Error: ",str," before '",tmp,"'",NULL);
91 fprintf(stderr,"%s:%d: %s\n",filename,line_no,out);
98 push_variable(char *name, int scope)
101 Type *type = typestack->data;
102 typestack = g_list_remove(typestack,typestack->data);
104 var = new_variable(scope,type,name);
105 class_nodes = g_list_append(class_nodes, var);
109 push_function(int scope, char *oid, char *id, char *onerror,
110 GString *cbuf,int line_no, int ccode_line)
115 if(scope!=INIT_METHOD && scope!=CLASS_INIT_METHOD) {
116 type = typestack->data;
117 typestack = g_list_remove(typestack,typestack->data);
119 type = (Type *)new_type(0,g_strdup("void"));
122 node = new_method(scope,type,oid,gtktypes,id,funcargs,
123 onerror,cbuf,line_no,ccode_line);
127 class_nodes = g_list_append(class_nodes, node);
131 push_funcarg(char *name)
134 Type *type = typestack->data;
135 typestack = g_list_remove(typestack,typestack->data);
137 node = new_funcarg(type,name,checks);
140 funcargs = g_list_append(funcargs, node);
144 push_init_arg(char *name, int is_class)
151 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
153 tn = g_strdup(((Class *)class)->otype);
155 type = new_type(1,tn);
156 node = new_funcarg((Type *)type,name,NULL);
157 funcargs = g_list_prepend(funcargs, node);
161 push_this(char *this)
166 type = new_type(1,g_strdup(((Class *)class)->otype));
167 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
168 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
169 node = new_funcarg((Type *)type,this,ch);
170 funcargs = g_list_prepend(funcargs, node);
196 #define YYFLAG -32768
199 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 69)
201 static const char yytranslate[] = { 0,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 43, 2, 2, 2, 2, 2, 2, 34,
206 35, 37, 2, 38, 44, 2, 2, 2, 40, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 33, 42,
208 39, 41, 2, 2, 2, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 31, 36, 32, 2, 2, 2, 2, 2,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
217 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
218 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
219 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
220 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
221 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
222 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
223 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
224 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
225 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
226 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
227 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
228 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
229 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
234 static const short yyprhs[] = { 0,
235 0, 4, 7, 10, 12, 15, 18, 20, 22, 27,
236 32, 35, 38, 41, 43, 45, 47, 52, 57, 69,
237 78, 82, 83, 87, 89, 91, 94, 97, 100, 102,
238 105, 108, 110, 112, 114, 116, 119, 121, 123, 126,
239 128, 131, 133, 135, 137, 139, 141, 144, 146, 151,
240 155, 157, 169, 180, 191, 201, 211, 220, 233, 243,
241 253, 259, 266, 269, 273, 276, 277, 279, 281, 285,
242 287, 291, 293, 296, 303, 306, 308, 310, 313, 316,
243 320, 324, 328, 332, 334, 337
246 static const short yyrhs[] = { 46,
247 47, 46, 0, 47, 46, 0, 46, 47, 0, 47,
248 0, 46, 23, 0, 46, 24, 0, 23, 0, 24,
249 0, 48, 31, 49, 32, 0, 3, 22, 4, 22,
250 0, 49, 61, 0, 49, 50, 0, 49, 51, 0,
251 61, 0, 50, 0, 51, 0, 25, 54, 20, 33,
252 0, 26, 54, 20, 33, 0, 27, 52, 20, 20,
253 20, 31, 23, 20, 31, 23, 33, 0, 27, 52,
254 20, 20, 20, 31, 23, 33, 0, 34, 53, 35,
255 0, 0, 20, 36, 53, 0, 20, 0, 55, 0,
256 55, 58, 0, 10, 56, 0, 9, 56, 0, 56,
257 0, 10, 16, 0, 9, 16, 0, 16, 0, 15,
258 0, 14, 0, 20, 0, 57, 20, 0, 22, 0,
259 5, 0, 11, 13, 0, 11, 0, 12, 13, 0,
260 12, 0, 13, 0, 8, 0, 7, 0, 6, 0,
261 37, 58, 0, 37, 0, 20, 34, 60, 35, 0,
262 60, 38, 20, 0, 20, 0, 29, 20, 59, 54,
263 20, 34, 63, 35, 62, 31, 23, 0, 29, 20,
264 59, 54, 20, 34, 63, 35, 62, 33, 0, 29,
265 59, 54, 20, 34, 63, 35, 62, 31, 23, 0,
266 29, 59, 54, 20, 34, 63, 35, 62, 33, 0,
267 28, 54, 20, 34, 63, 35, 62, 31, 23, 0,
268 28, 54, 20, 34, 63, 35, 62, 33, 0, 30,
269 34, 22, 35, 54, 20, 34, 63, 35, 62, 31,
270 23, 0, 25, 54, 20, 34, 63, 35, 62, 31,
271 23, 0, 26, 54, 20, 34, 63, 35, 62, 31,
272 23, 0, 20, 34, 20, 35, 33, 0, 20, 34,
273 20, 35, 31, 23, 0, 19, 68, 0, 19, 31,
274 23, 0, 39, 40, 0, 0, 5, 0, 20, 0,
275 20, 38, 64, 0, 64, 0, 64, 38, 65, 0,
276 65, 0, 54, 20, 0, 54, 20, 34, 20, 66,
277 35, 0, 66, 67, 0, 67, 0, 20, 0, 41,
278 68, 0, 42, 68, 0, 41, 39, 68, 0, 42,
279 39, 68, 0, 39, 39, 68, 0, 43, 39, 68,
280 0, 21, 0, 44, 21, 0, 20, 0
286 static const short yyrline[] = { 0,
287 176, 177, 178, 179, 182, 186, 190, 194, 200, 207,
288 212, 213, 214, 215, 216, 217, 220, 223, 227, 254,
289 278, 279, 282, 285, 291, 295, 302, 305, 308, 311,
290 314, 317, 320, 323, 326, 329, 333, 336, 341, 344,
291 347, 350, 353, 358, 361, 364, 369, 370, 373, 378,
292 381, 387, 408, 428, 437, 446, 450, 454, 458, 462,
293 466, 482, 503, 504, 508, 509, 514, 515, 525, 535,
294 538, 539, 542, 545, 555, 556, 559, 572, 576, 580,
295 584, 588, 592, 598, 599, 603
300 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
302 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
303 "FROM","VOID","STRUCT","UNION","ENUM","SIGNED","UNSIGNED","LONG","SHORT","INT",
304 "FLOAT","DOUBLE","CHAR","FIRST","LAST","ONERROR","TOKEN","NUMBER","TYPETOKEN",
305 "CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE",
306 "'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'","'>'","'<'","'!'",
307 "'-'","prog","ccodes","class","classdec","classcode","variable","argument","argflags",
308 "flaglist","type","type1","integer","tspecifier","stars","sigtype","tokenlist",
309 "method","onerror","funcargs","arglist","arg","checklist","check","numtok", NULL
313 static const short yyr1[] = { 0,
314 45, 45, 45, 45, 46, 46, 46, 46, 47, 48,
315 49, 49, 49, 49, 49, 49, 50, 50, 51, 51,
316 52, 52, 53, 53, 54, 54, 55, 55, 55, 55,
317 55, 55, 55, 55, 55, 55, 55, 55, 56, 56,
318 56, 56, 56, 57, 57, 57, 58, 58, 59, 60,
319 60, 61, 61, 61, 61, 61, 61, 61, 61, 61,
320 61, 61, 62, 62, 62, 62, 63, 63, 63, 63,
321 64, 64, 65, 65, 66, 66, 67, 67, 67, 67,
322 67, 67, 67, 68, 68, 68
325 static const short yyr2[] = { 0,
326 3, 2, 2, 1, 2, 2, 1, 1, 4, 4,
327 2, 2, 2, 1, 1, 1, 4, 4, 11, 8,
328 3, 0, 3, 1, 1, 2, 2, 2, 1, 2,
329 2, 1, 1, 1, 1, 2, 1, 1, 2, 1,
330 2, 1, 1, 1, 1, 1, 2, 1, 4, 3,
331 1, 11, 10, 10, 9, 9, 8, 12, 9, 9,
332 5, 6, 2, 3, 2, 0, 1, 1, 3, 1,
333 3, 1, 2, 6, 2, 1, 1, 2, 2, 3,
337 static const short yydefact[] = { 0,
338 0, 7, 8, 0, 4, 0, 0, 5, 6, 3,
339 2, 0, 0, 1, 0, 0, 0, 22, 0, 0,
340 0, 0, 15, 16, 14, 10, 0, 38, 46, 45,
341 44, 0, 0, 40, 42, 43, 34, 33, 32, 35,
342 37, 0, 25, 29, 0, 0, 0, 0, 0, 0,
343 0, 0, 9, 12, 13, 11, 0, 31, 28, 30,
344 27, 39, 41, 0, 48, 26, 36, 0, 24, 0,
345 0, 0, 0, 0, 0, 0, 0, 0, 17, 0,
346 47, 18, 0, 0, 21, 0, 0, 51, 0, 0,
347 0, 0, 0, 61, 38, 35, 0, 0, 70, 72,
348 0, 23, 0, 0, 49, 0, 0, 0, 0, 62,
349 0, 73, 66, 0, 66, 0, 66, 50, 0, 0,
350 0, 69, 0, 0, 0, 0, 71, 0, 0, 0,
351 0, 66, 0, 0, 86, 84, 0, 0, 63, 65,
352 0, 0, 0, 20, 0, 57, 66, 0, 0, 77,
353 0, 0, 0, 0, 0, 76, 64, 85, 59, 60,
354 0, 56, 0, 0, 55, 66, 0, 0, 78, 0,
355 79, 0, 74, 75, 0, 0, 53, 54, 0, 82,
356 80, 81, 83, 19, 52, 0, 58, 0, 0, 0
359 static const short yydefgoto[] = { 188,
360 4, 5, 6, 22, 23, 24, 48, 70, 97, 43,
361 44, 45, 66, 51, 89, 25, 126, 98, 99, 100,
365 static const short yypact[] = { 33,
366 11,-32768,-32768, 44, 51, -19, 18,-32768,-32768, 51,
367 79, 52, 61, 79, 4, 85, 85, 70, 85, 9,
368 72, 101,-32768,-32768,-32768,-32768, 32,-32768,-32768,-32768,
369 -32768, 123, 129, 107, 109,-32768,-32768,-32768,-32768,-32768,
370 -32768, 112, 87,-32768, 128, 130, 131, 132, 133, -10,
371 85, 127,-32768,-32768,-32768,-32768, 119,-32768,-32768,-32768,
372 -32768,-32768,-32768, 104, 87,-32768,-32768, 110, 120, 122,
373 135, 124, 125, 140, 85, 141, 134, 27,-32768, 103,
374 -32768,-32768, 103, 131,-32768, 142, 103,-32768, -12, 143,
375 136, 85, 144,-32768, 137, 16, 145, 138, 126,-32768,
376 139,-32768, 146, 147,-32768, 148, 149, 103, 151,-32768,
377 85, 150, 6, 85, 6, 152, 6,-32768, 103, 153,
378 155, 126, 156, -13, 154, 159,-32768, 160, -5, 30,
379 157, 6, 103, 23,-32768,-32768, 158, 164,-32768,-32768,
380 163, 170, 165,-32768, 172,-32768, 6, 40, 162,-32768,
381 161, -7, 0, 166, 7,-32768,-32768,-32768,-32768,-32768,
382 175,-32768, 55, 176,-32768, 6, -4, -4,-32768, -4,
383 -32768, -4,-32768,-32768, 168, 179,-32768,-32768, 173,-32768,
384 -32768,-32768,-32768,-32768,-32768, 180,-32768, 178, 187,-32768
387 static const short yypgoto[] = {-32768,
388 1, 202,-32768,-32768, 185, 186,-32768, 82, -16,-32768,
389 114,-32768, 115, 167,-32768, 188, -113, -78, 68, 95,
397 static const short yytable[] = { 42,
398 46, 128, 49, 130, 101, 11, 135, 136, 104, 73,
399 14, 12, 135, 136, 143, 135, 136, 137, 148, 135,
400 136, 13, 105, 74, 124, 106, 150, 144, 50, 120,
401 138, 168, 7, 163, 76, 1, 138, 27, 170, 138,
402 131, 173, 150, 138, 125, 151, 1, 152, 153, 154,
403 -68, 57, 179, 111, 149, 2, 3, 93, 90, 94,
404 145, 151, 146, 152, 153, 154, 8, 9, 169, 171,
405 164, 15, 165, 2, 3, 109, 16, 17, 18, 19,
406 20, 21, 26, 180, 181, 176, 182, 177, 183, 28,
407 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
408 39, 8, 9, 47, 40, 52, 41, 95, 29, 30,
409 31, 32, 33, 34, 35, 36, 37, 38, 39, 62,
410 15, 63, 96, 65, 41, 16, 17, 18, 19, 20,
411 21, 64, 53, 34, 35, 36, 79, 80, 58, 34,
412 35, 36, 82, 83, 60, 59, 61, 67, 77, 68,
413 69, 71, 72, 78, 86, 84, 85, 87, 74, 88,
414 91, 103, 107, 114, 112, 102, 110, 118, 92, 108,
415 121, -67, 113, 115, 129, 134, 116, 189, 122, 81,
416 157, 117, 119, 123, 158, 159, 190, 132, 133, 141,
417 142, 147, 160, 140, 162, 161, 166, 175, 178, 167,
418 184, 185, 187, 186, 172, 10, 54, 55, 127, 56,
419 174, 0, 0, 0, 0, 0, 75
422 static const short yycheck[] = { 16,
423 17, 115, 19, 117, 83, 5, 20, 21, 87, 20,
424 10, 31, 20, 21, 20, 20, 21, 31, 132, 20,
425 21, 4, 35, 34, 19, 38, 20, 33, 20, 108,
426 44, 39, 22, 147, 51, 3, 44, 34, 39, 44,
427 119, 35, 20, 44, 39, 39, 3, 41, 42, 43,
428 35, 20, 166, 38, 133, 23, 24, 31, 75, 33,
429 31, 39, 33, 41, 42, 43, 23, 24, 152, 153,
430 31, 20, 33, 23, 24, 92, 25, 26, 27, 28,
431 29, 30, 22, 167, 168, 31, 170, 33, 172, 5,
432 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
433 16, 23, 24, 34, 20, 34, 22, 5, 6, 7,
434 8, 9, 10, 11, 12, 13, 14, 15, 16, 13,
435 20, 13, 20, 37, 22, 25, 26, 27, 28, 29,
436 30, 20, 32, 11, 12, 13, 33, 34, 16, 11,
437 12, 13, 33, 34, 16, 32, 33, 20, 22, 20,
438 20, 20, 20, 35, 20, 36, 35, 34, 34, 20,
439 20, 20, 20, 38, 20, 84, 23, 20, 35, 34,
440 20, 35, 35, 35, 23, 20, 31, 0, 111, 65,
441 23, 35, 34, 34, 21, 23, 0, 35, 34, 31,
442 31, 35, 23, 40, 23, 31, 35, 23, 23, 39,
443 33, 23, 23, 31, 39, 4, 22, 22, 114, 22,
444 155, -1, -1, -1, -1, -1, 50
446 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
447 #line 3 "/usr/lib/bison.simple"
449 /* Skeleton output parser for bison,
450 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
452 This program is free software; you can redistribute it and/or modify
453 it under the terms of the GNU General Public License as published by
454 the Free Software Foundation; either version 2, or (at your option)
457 This program is distributed in the hope that it will be useful,
458 but WITHOUT ANY WARRANTY; without even the implied warranty of
459 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
460 GNU General Public License for more details.
462 You should have received a copy of the GNU General Public License
463 along with this program; if not, write to the Free Software
464 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
466 /* As a special exception, when this file is copied by Bison into a
467 Bison output file, you may use that output file without restriction.
468 This special exception was added by the Free Software Foundation
469 in version 1.24 of Bison. */
473 #define alloca __builtin_alloca
474 #else /* not GNU C. */
475 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
477 #else /* not sparc */
478 #if defined (MSDOS) && !defined (__TURBOC__)
480 #else /* not MSDOS, or __TURBOC__ */
484 #else /* not MSDOS, __TURBOC__, or _AIX */
488 void *alloca (unsigned int);
490 #else /* not __cplusplus */
492 #endif /* not __cplusplus */
494 #endif /* not _AIX */
495 #endif /* not MSDOS, or __TURBOC__ */
496 #endif /* not sparc. */
497 #endif /* not GNU C. */
498 #endif /* alloca not defined. */
500 /* This is the parser code that is written into each bison parser
501 when the %semantic_parser declaration is not specified in the grammar.
502 It was written by Richard Stallman by simplifying the hairy parser
503 used when %semantic_parser is specified. */
505 /* Note: there must be only one dollar sign in this file.
506 It is replaced by the list of actions, each action
507 as one case of the switch. */
509 #define yyerrok (yyerrstatus = 0)
510 #define yyclearin (yychar = YYEMPTY)
513 #define YYACCEPT return(0)
514 #define YYABORT return(1)
515 #define YYERROR goto yyerrlab1
516 /* Like YYERROR except do call yyerror.
517 This remains here temporarily to ease the
518 transition to the new meaning of YYERROR, for GCC.
519 Once GCC version 2 has supplanted version 1, this can go. */
520 #define YYFAIL goto yyerrlab
521 #define YYRECOVERING() (!!yyerrstatus)
522 #define YYBACKUP(token, value) \
524 if (yychar == YYEMPTY && yylen == 1) \
525 { yychar = (token), yylval = (value); \
526 yychar1 = YYTRANSLATE (yychar); \
531 { yyerror ("syntax error: cannot back up"); YYERROR; } \
535 #define YYERRCODE 256
538 #define YYLEX yylex()
544 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
546 #define YYLEX yylex(&yylval, &yylloc)
548 #else /* not YYLSP_NEEDED */
550 #define YYLEX yylex(&yylval, YYLEX_PARAM)
552 #define YYLEX yylex(&yylval)
554 #endif /* not YYLSP_NEEDED */
557 /* If nonreentrant, generate the variables here */
561 int yychar; /* the lookahead symbol */
562 YYSTYPE yylval; /* the semantic value of the */
563 /* lookahead symbol */
566 YYLTYPE yylloc; /* location data for the lookahead */
570 int yynerrs; /* number of parse errors so far */
571 #endif /* not YYPURE */
574 int yydebug; /* nonzero means print parse trace */
575 /* Since this is uninitialized, it does not stop multiple parsers
579 /* YYINITDEPTH indicates the initial size of the parser's stacks */
582 #define YYINITDEPTH 200
585 /* YYMAXDEPTH is the maximum size the stacks can grow to
586 (effective only if the built-in stack extension method is used). */
593 #define YYMAXDEPTH 10000
596 /* Prevent warning if -Wstrict-prototypes. */
601 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
602 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
603 #else /* not GNU C or C++ */
606 /* This is the most reliable way to avoid incompatibilities
607 in available built-in functions on various systems. */
609 __yy_memcpy (to, from, count)
614 register char *f = from;
615 register char *t = to;
616 register int i = count;
622 #else /* __cplusplus */
624 /* This is the most reliable way to avoid incompatibilities
625 in available built-in functions on various systems. */
627 __yy_memcpy (char *to, char *from, int count)
629 register char *f = from;
630 register char *t = to;
631 register int i = count;
640 #line 196 "/usr/lib/bison.simple"
642 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
643 into yyparse. The argument should have type void *.
644 It should actually point to an object.
645 Grammar actions can access the variable by casting it
646 to the proper pointer type. */
650 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
651 #define YYPARSE_PARAM_DECL
652 #else /* not __cplusplus */
653 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
654 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
655 #endif /* not __cplusplus */
656 #else /* not YYPARSE_PARAM */
657 #define YYPARSE_PARAM_ARG
658 #define YYPARSE_PARAM_DECL
659 #endif /* not YYPARSE_PARAM */
662 yyparse(YYPARSE_PARAM_ARG)
665 register int yystate;
667 register short *yyssp;
668 register YYSTYPE *yyvsp;
669 int yyerrstatus; /* number of tokens to shift before error messages enabled */
670 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
672 short yyssa[YYINITDEPTH]; /* the state stack */
673 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
675 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
676 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
679 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
680 YYLTYPE *yyls = yylsa;
683 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
685 #define YYPOPSTACK (yyvsp--, yyssp--)
688 int yystacksize = YYINITDEPTH;
699 YYSTYPE yyval; /* the variable used to return */
700 /* semantic values from the action */
707 fprintf(stderr, "Starting parse\n");
713 yychar = YYEMPTY; /* Cause a token to be read. */
715 /* Initialize stack pointers.
716 Waste one element of value and location stack
717 so that they stay on the same level as the state stack.
718 The wasted elements are never initialized. */
726 /* Push a new state, which is found in yystate . */
727 /* In all cases, when you get here, the value and location stacks
728 have just been pushed. so pushing a state here evens the stacks. */
733 if (yyssp >= yyss + yystacksize - 1)
735 /* Give user a chance to reallocate the stack */
736 /* Use copies of these so that the &'s don't force the real ones into memory. */
737 YYSTYPE *yyvs1 = yyvs;
740 YYLTYPE *yyls1 = yyls;
743 /* Get the current used size of the three stacks, in elements. */
744 int size = yyssp - yyss + 1;
747 /* Each stack pointer address is followed by the size of
748 the data in use in that stack, in bytes. */
750 /* This used to be a conditional around just the two extra args,
751 but that might be undefined if yyoverflow is a macro. */
752 yyoverflow("parser stack overflow",
753 &yyss1, size * sizeof (*yyssp),
754 &yyvs1, size * sizeof (*yyvsp),
755 &yyls1, size * sizeof (*yylsp),
758 yyoverflow("parser stack overflow",
759 &yyss1, size * sizeof (*yyssp),
760 &yyvs1, size * sizeof (*yyvsp),
764 yyss = yyss1; yyvs = yyvs1;
768 #else /* no yyoverflow */
769 /* Extend the stack our own way. */
770 if (yystacksize >= YYMAXDEPTH)
772 yyerror("parser stack overflow");
776 if (yystacksize > YYMAXDEPTH)
777 yystacksize = YYMAXDEPTH;
778 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
779 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
780 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
781 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
783 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
784 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
786 #endif /* no yyoverflow */
788 yyssp = yyss + size - 1;
789 yyvsp = yyvs + size - 1;
791 yylsp = yyls + size - 1;
796 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
799 if (yyssp >= yyss + yystacksize - 1)
805 fprintf(stderr, "Entering state %d\n", yystate);
811 /* Do appropriate processing given the current state. */
812 /* Read a lookahead token if we need one and don't already have one. */
815 /* First try to decide what to do without reference to lookahead token. */
817 yyn = yypact[yystate];
821 /* Not known => get a lookahead token if don't already have one. */
823 /* yychar is either YYEMPTY or YYEOF
824 or a valid token in external form. */
826 if (yychar == YYEMPTY)
830 fprintf(stderr, "Reading a token: ");
835 /* Convert token to internal form (in yychar1) for indexing tables with */
837 if (yychar <= 0) /* This means end of input. */
840 yychar = YYEOF; /* Don't call YYLEX any more */
844 fprintf(stderr, "Now at end of input.\n");
849 yychar1 = YYTRANSLATE(yychar);
854 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
855 /* Give the individual parser a way to print the precise meaning
856 of a token, for further debugging info. */
858 YYPRINT (stderr, yychar, yylval);
860 fprintf (stderr, ")\n");
866 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
871 /* yyn is what to do for this token type in this state.
872 Negative => reduce, -yyn is rule number.
873 Positive => shift, yyn is new state.
874 New state is final state => don't bother to shift,
876 0, or most negative number => error. */
891 /* Shift the lookahead token. */
895 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
898 /* Discard the token being shifted unless it is eof. */
907 /* count tokens shifted since error; after three, turn off error status. */
908 if (yyerrstatus) yyerrstatus--;
913 /* Do the default action for the current state. */
916 yyn = yydefact[yystate];
920 /* Do a reduction. yyn is the number of a rule to reduce with. */
924 yyval = yyvsp[1-yylen]; /* implement default value of the action */
931 fprintf (stderr, "Reducing via rule %d (line %d), ",
934 /* Print the symbols being reduced, and their result. */
935 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
936 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
937 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
963 Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
964 nodes = g_list_append(nodes,node);
970 Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
971 nodes = g_list_append(nodes,node);
977 Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
978 nodes = g_list_append(nodes,node);
984 Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
985 nodes = g_list_append(nodes,node);
991 ((Class *)class)->nodes = class_nodes;
993 nodes = g_list_append(nodes,class);
999 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1029 push_variable(yyvsp[-1].id,PUBLIC_SCOPE);
1035 push_variable(yyvsp[-1].id,PRIVATE_SCOPE);
1041 if(strcmp(yyvsp[-6].id,"get")==0 &&
1042 strcmp(yyvsp[-3].id,"set")==0) {
1044 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1045 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1046 yyvsp[-4].cbuf,yyvsp[-5].line,
1047 yyvsp[-1].cbuf,yyvsp[-2].line);
1048 class_nodes = g_list_append(class_nodes,node);
1049 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1050 strcmp(yyvsp[-3].id,"get")==0) {
1052 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1053 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1054 yyvsp[-1].cbuf,yyvsp[-2].line,
1055 yyvsp[-4].cbuf,yyvsp[-5].line);
1056 class_nodes = g_list_append(class_nodes,node);
1058 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1059 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1060 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1061 g_string_free(yyvsp[-1].cbuf,TRUE);
1062 g_string_free(yyvsp[-4].cbuf,TRUE);
1063 yyerror(_("parse error"));
1071 if(strcmp(yyvsp[-3].id,"get")==0) {
1073 g_free(yyvsp[-3].id);
1074 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1075 yyvsp[-1].cbuf,yyvsp[-2].line,NULL,0);
1076 class_nodes = g_list_append(class_nodes,node);
1077 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1079 g_free(yyvsp[-3].id);
1080 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1081 NULL,0,yyvsp[-1].cbuf,yyvsp[-2].line);
1082 class_nodes = g_list_append(class_nodes,node);
1084 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1085 g_free(yyvsp[-4].id);
1086 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1087 g_string_free(yyvsp[-1].cbuf,TRUE);
1088 yyerror(_("parse error"));
1095 { yyval.list = yyvsp[-1].list; ;
1099 { yyval.list = NULL; ;
1104 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1110 yyval.list = g_list_append(NULL,yyvsp[0].id);
1116 Node *node = new_type(0,yyvsp[0].id);
1117 typestack = g_list_prepend(typestack,node);
1123 Node *node = new_type(stars,yyvsp[-1].id);
1125 typestack = g_list_prepend(typestack,node);
1131 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1137 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1143 yyval.id = g_strdup(yyvsp[0].id);
1149 yyval.id = g_strdup("unsigned char");
1155 yyval.id = g_strdup("signed char");
1161 yyval.id = g_strdup("char");
1167 yyval.id = g_strdup("double");
1173 yyval.id = g_strdup("float");
1179 yyval.id = yyvsp[0].id;
1185 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1186 g_free(yyvsp[0].id);
1192 yyval.id = yyvsp[0].id;
1198 yyval.id = g_strdup("void");
1204 yyval.id = "long int";
1216 yyval.id = "short int";
1240 yyval.id = "union ";
1246 yyval.id = "struct ";
1260 gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
1266 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1272 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1278 int sigtype = SIGNAL_LAST_METHOD;
1279 if(strcmp(yyvsp[-9].id,"first")==0)
1280 sigtype = SIGNAL_FIRST_METHOD;
1281 else if(strcmp(yyvsp[-9].id,"last")==0)
1282 sigtype = SIGNAL_LAST_METHOD;
1284 yyerror(_("signal must be 'first' or 'last'"));
1285 g_free(yyvsp[-9].id);
1288 g_free(yyvsp[-9].id);
1291 yyerror(_("signal without 'this' as "
1292 "first parameter"));
1295 push_function(sigtype,NULL,
1296 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line,yyvsp[-1].line);
1302 int sigtype = SIGNAL_LAST_METHOD;
1303 if(strcmp(yyvsp[-8].id,"first")==0)
1304 sigtype = SIGNAL_FIRST_METHOD;
1305 else if(strcmp(yyvsp[-8].id,"last")==0)
1306 sigtype = SIGNAL_LAST_METHOD;
1308 yyerror(_("signal must be 'first' or 'last'"));
1309 g_free(yyvsp[-8].id);
1312 g_free(yyvsp[-8].id);
1314 yyerror(_("signal without 'this' as "
1315 "first parameter"));
1318 push_function(sigtype, NULL,
1319 yyvsp[-5].id, yyvsp[-1].id, NULL,yyvsp[-9].line,0);
1326 yyerror(_("signal without 'this' as "
1327 "first parameter"));
1330 push_function(SIGNAL_LAST_METHOD, NULL,
1331 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-9].line,yyvsp[-1].line);
1338 yyerror(_("signal without 'this' as "
1339 "first parameter"));
1342 push_function(SIGNAL_LAST_METHOD, NULL, yyvsp[-5].id,
1343 yyvsp[-1].id, NULL,yyvsp[-8].line,0);
1349 push_function(VIRTUAL_METHOD, NULL, yyvsp[-6].id,
1350 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
1356 push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1357 yyvsp[-1].id, NULL,yyvsp[-7].line,0);
1363 push_function(OVERRIDE_METHOD, yyvsp[-9].id,
1364 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line,yyvsp[-1].line);
1370 push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id,
1371 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
1377 push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id,
1378 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
1384 if(strcmp(yyvsp[-4].id,"init")==0) {
1385 push_init_arg(yyvsp[-2].id,FALSE);
1386 push_function(INIT_METHOD, NULL, yyvsp[-4].id,
1387 NULL, NULL,yyvsp[-3].line,0);
1388 } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
1389 push_init_arg(yyvsp[-2].id,TRUE);
1390 push_function(CLASS_INIT_METHOD, NULL,
1391 yyvsp[-4].id, NULL, NULL,yyvsp[-3].line,0);
1393 g_free(yyvsp[-4].id);
1394 g_free(yyvsp[-2].id);
1395 yyerror(_("parse error"));
1403 if(strcmp(yyvsp[-5].id,"init")==0) {
1404 push_init_arg(yyvsp[-3].id,FALSE);
1405 push_function(INIT_METHOD, NULL,
1406 yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line,
1408 } else if(strcmp(yyvsp[-5].id,"class_init")==0) {
1409 push_init_arg(yyvsp[-3].id,TRUE);
1410 push_function(CLASS_INIT_METHOD, NULL,
1411 yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line,
1414 g_free(yyvsp[-5].id);
1415 g_free(yyvsp[-3].id);
1416 g_string_free(yyvsp[-3].cbuf,TRUE);
1417 yyerror(_("parse error"));
1424 { yyval.id = yyvsp[0].id; ;
1429 yyval.id = (yyvsp[0].cbuf)->str;
1430 g_string_free(yyvsp[0].cbuf,FALSE);
1439 { yyval.id = NULL; ;
1443 { has_this = FALSE; ;
1449 if(strcmp(yyvsp[0].id,"this")==0)
1450 push_this(yyvsp[0].id);
1452 g_free(yyvsp[0].id);
1453 yyerror(_("parse error"));
1462 if(strcmp(yyvsp[-2].id,"this")==0)
1463 push_this(yyvsp[-2].id);
1465 g_free(yyvsp[-2].id);
1466 yyerror(_("parse error"));
1473 { has_this = FALSE; ;
1486 push_funcarg(yyvsp[0].id);
1492 if(strcmp(yyvsp[-2].id,"check")!=0) {
1493 yyerror(_("parse error"));
1496 g_free(yyvsp[-2].id);
1497 push_funcarg(yyvsp[-4].id);
1511 if(strcmp(yyvsp[0].id,"type")==0) {
1512 Node *node = new_check(TYPE_CHECK,NULL);
1513 checks = g_list_append(checks,node);
1514 } else if(strcmp(yyvsp[0].id,"null")==0) {
1515 Node *node = new_check(NULL_CHECK,NULL);
1516 checks = g_list_append(checks,node);
1518 yyerror(_("parse error"));
1521 g_free(yyvsp[0].id);
1527 Node *node = new_check(GT_CHECK,yyvsp[0].id);
1528 checks = g_list_append(checks,node);
1534 Node *node = new_check(LT_CHECK,yyvsp[0].id);
1535 checks = g_list_append(checks,node);
1541 Node *node = new_check(GE_CHECK,yyvsp[0].id);
1542 checks = g_list_append(checks,node);
1548 Node *node = new_check(LE_CHECK,yyvsp[0].id);
1549 checks = g_list_append(checks,node);
1555 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
1556 checks = g_list_append(checks,node);
1562 Node *node = new_check(NE_CHECK,yyvsp[0].id);
1563 checks = g_list_append(checks,node);
1568 { yyval.id = yyvsp[0].id; ;
1573 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
1574 g_free(yyvsp[0].id);
1579 { yyval.id = yyvsp[0].id; ;
1582 /* the action file gets copied in in place of this dollarsign */
1583 #line 498 "/usr/lib/bison.simple"
1594 short *ssp1 = yyss - 1;
1595 fprintf (stderr, "state stack now");
1596 while (ssp1 != yyssp)
1597 fprintf (stderr, " %d", *++ssp1);
1598 fprintf (stderr, "\n");
1608 yylsp->first_line = yylloc.first_line;
1609 yylsp->first_column = yylloc.first_column;
1610 yylsp->last_line = (yylsp-1)->last_line;
1611 yylsp->last_column = (yylsp-1)->last_column;
1616 yylsp->last_line = (yylsp+yylen-1)->last_line;
1617 yylsp->last_column = (yylsp+yylen-1)->last_column;
1621 /* Now "shift" the result of the reduction.
1622 Determine what state that goes to,
1623 based on the state we popped back to
1624 and the rule number reduced by. */
1628 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1629 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1630 yystate = yytable[yystate];
1632 yystate = yydefgoto[yyn - YYNTBASE];
1636 yyerrlab: /* here on detecting error */
1639 /* If not already recovering from an error, report this error. */
1643 #ifdef YYERROR_VERBOSE
1644 yyn = yypact[yystate];
1646 if (yyn > YYFLAG && yyn < YYLAST)
1653 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1654 for (x = (yyn < 0 ? -yyn : 0);
1655 x < (sizeof(yytname) / sizeof(char *)); x++)
1656 if (yycheck[x + yyn] == x)
1657 size += strlen(yytname[x]) + 15, count++;
1658 msg = (char *) malloc(size + 15);
1661 strcpy(msg, "parse error");
1666 for (x = (yyn < 0 ? -yyn : 0);
1667 x < (sizeof(yytname) / sizeof(char *)); x++)
1668 if (yycheck[x + yyn] == x)
1670 strcat(msg, count == 0 ? ", expecting `" : " or `");
1671 strcat(msg, yytname[x]);
1680 yyerror ("parse error; also virtual memory exceeded");
1683 #endif /* YYERROR_VERBOSE */
1684 yyerror("parse error");
1688 yyerrlab1: /* here on error raised explicitly by an action */
1690 if (yyerrstatus == 3)
1692 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1694 /* return failure if at end of input */
1695 if (yychar == YYEOF)
1700 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1706 /* Else will try to reuse lookahead token
1707 after shifting the error token. */
1709 yyerrstatus = 3; /* Each real token shifted decrements this */
1713 yyerrdefault: /* current state does not do anything special for the error token. */
1716 /* This is wrong; only states that explicitly want error tokens
1717 should shift them. */
1718 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1719 if (yyn) goto yydefault;
1722 yyerrpop: /* pop the current state because it cannot handle the error token */
1724 if (yyssp == yyss) YYABORT;
1734 short *ssp1 = yyss - 1;
1735 fprintf (stderr, "Error: state stack now");
1736 while (ssp1 != yyssp)
1737 fprintf (stderr, " %d", *++ssp1);
1738 fprintf (stderr, "\n");
1744 yyn = yypact[yystate];
1749 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1768 fprintf(stderr, "Shifting error token, ");