2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
50 extern char *filename;
54 static GList *class_nodes = NULL;
57 static GList *typestack = NULL;
59 static GList *funcargs = NULL;
60 static GList *checks = NULL;
61 static int has_self = FALSE;
62 static int vararg = FALSE;
64 static GList *gtktypes = NULL;
69 extern int ccode_line;
80 if(strcmp(yytext,"\n")==0) {
81 out=g_strconcat("Error: ",str," before newline",NULL);
82 } else if(yytext[0]=='\0') {
83 out=g_strconcat("Error: ",str," at end of input",NULL);
85 char *tmp = g_strdup(yytext);
86 while((p=strchr(tmp,'\n')))
89 out=g_strconcat("Error: ",str," before '",tmp,"'",NULL);
93 fprintf(stderr,"%s:%d: %s\n",filename,line_no,out);
100 push_variable(char *name, int scope, int line_no)
103 Type *type = typestack->data;
104 typestack = g_list_remove(typestack,typestack->data);
106 var = new_variable(scope,type,name,line_no);
107 class_nodes = g_list_append(class_nodes, var);
111 push_function(int scope, char *oid, char *id, char *onerror,
112 GString *cbuf,int line_no, int ccode_line, int vararg)
117 if(scope!=INIT_METHOD && scope!=CLASS_INIT_METHOD) {
118 type = typestack->data;
119 typestack = g_list_remove(typestack,typestack->data);
121 type = (Type *)new_type(0,g_strdup("void"));
124 node = new_method(scope,type,oid,gtktypes,id,funcargs,
125 onerror,cbuf,line_no,ccode_line,vararg);
129 class_nodes = g_list_append(class_nodes, node);
133 push_funcarg(char *name)
136 Type *type = typestack->data;
137 typestack = g_list_remove(typestack,typestack->data);
139 node = new_funcarg(type,name,checks);
142 funcargs = g_list_append(funcargs, node);
146 push_init_arg(char *name, int is_class)
153 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
155 tn = g_strdup(((Class *)class)->otype);
157 type = new_type(1,tn);
158 node = new_funcarg((Type *)type,name,NULL);
159 funcargs = g_list_prepend(funcargs, node);
168 type = new_type(1,g_strdup(((Class *)class)->otype));
169 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
170 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
171 node = new_funcarg((Type *)type,id,ch);
172 funcargs = g_list_prepend(funcargs, node);
198 #define YYFLAG -32768
201 #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 72)
203 static const char yytranslate[] = { 0,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 2, 2, 43, 2, 2, 2, 2, 2, 2, 34,
208 35, 37, 2, 38, 44, 2, 2, 2, 40, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 33, 42,
210 39, 41, 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, 2, 2, 2, 2, 2, 2, 2, 2,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 2, 2, 31, 36, 32, 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, 2, 2, 2, 2, 2,
228 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
229 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
230 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
231 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
236 static const short yyprhs[] = { 0,
237 0, 4, 7, 10, 12, 15, 18, 20, 22, 27,
238 32, 35, 38, 41, 43, 45, 47, 52, 57, 69,
239 78, 82, 83, 87, 89, 91, 94, 96, 99, 102,
240 105, 107, 110, 113, 115, 117, 119, 121, 124, 126,
241 128, 131, 133, 136, 138, 140, 142, 144, 146, 149,
242 151, 156, 160, 162, 165, 167, 178, 188, 197, 210,
243 220, 230, 236, 243, 246, 250, 253, 254, 256, 258,
244 262, 264, 268, 270, 274, 276, 279, 286, 289, 291,
245 293, 296, 299, 303, 307, 311, 315, 317, 320
248 static const short yyrhs[] = { 46,
249 47, 46, 0, 47, 46, 0, 46, 47, 0, 47,
250 0, 46, 23, 0, 46, 24, 0, 23, 0, 24,
251 0, 48, 31, 49, 32, 0, 3, 22, 4, 22,
252 0, 49, 63, 0, 49, 50, 0, 49, 51, 0,
253 63, 0, 50, 0, 51, 0, 25, 54, 20, 33,
254 0, 26, 54, 20, 33, 0, 27, 52, 20, 20,
255 20, 31, 23, 20, 31, 23, 33, 0, 27, 52,
256 20, 20, 20, 31, 23, 33, 0, 34, 53, 35,
257 0, 0, 20, 36, 53, 0, 20, 0, 55, 0,
258 5, 55, 0, 56, 0, 56, 59, 0, 12, 57,
259 0, 11, 57, 0, 57, 0, 12, 18, 0, 11,
260 18, 0, 18, 0, 17, 0, 16, 0, 20, 0,
261 58, 20, 0, 22, 0, 6, 0, 13, 15, 0,
262 13, 0, 14, 15, 0, 14, 0, 15, 0, 9,
263 0, 8, 0, 7, 0, 37, 59, 0, 37, 0,
264 20, 34, 61, 35, 0, 61, 38, 20, 0, 20,
265 0, 31, 23, 0, 33, 0, 29, 20, 60, 54,
266 20, 34, 65, 35, 64, 62, 0, 29, 60, 54,
267 20, 34, 65, 35, 64, 62, 0, 28, 54, 20,
268 34, 65, 35, 64, 62, 0, 30, 34, 22, 35,
269 54, 20, 34, 65, 35, 64, 31, 23, 0, 25,
270 54, 20, 34, 65, 35, 64, 31, 23, 0, 26,
271 54, 20, 34, 65, 35, 64, 31, 23, 0, 20,
272 34, 20, 35, 33, 0, 20, 34, 20, 35, 31,
273 23, 0, 19, 71, 0, 19, 31, 23, 0, 39,
274 40, 0, 0, 6, 0, 20, 0, 20, 38, 66,
275 0, 66, 0, 67, 38, 10, 0, 67, 0, 67,
276 38, 68, 0, 68, 0, 54, 20, 0, 54, 20,
277 34, 20, 69, 35, 0, 69, 70, 0, 70, 0,
278 20, 0, 41, 71, 0, 42, 71, 0, 41, 39,
279 71, 0, 42, 39, 71, 0, 39, 39, 71, 0,
280 43, 39, 71, 0, 21, 0, 44, 21, 0, 20,
287 static const short yyrline[] = { 0,
288 178, 179, 180, 181, 184, 188, 192, 196, 202, 209,
289 214, 215, 216, 217, 218, 219, 222, 225, 229, 258,
290 284, 285, 288, 291, 297, 298, 306, 310, 317, 320,
291 323, 326, 329, 332, 335, 338, 341, 344, 348, 351,
292 356, 359, 362, 365, 368, 373, 376, 379, 384, 385,
293 388, 393, 396, 401, 402, 406, 428, 438, 448, 454,
294 459, 464, 482, 503, 504, 508, 509, 512, 513, 528,
295 543, 546, 547, 550, 551, 554, 557, 567, 568, 571,
296 584, 588, 592, 596, 600, 604, 610, 611, 615
301 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
303 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
304 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
305 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","ONERROR","TOKEN","NUMBER","TYPETOKEN",
306 "CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE",
307 "'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'","'>'","'<'","'!'",
308 "'-'","prog","ccodes","class","classdec","classcode","variable","argument","argflags",
309 "flaglist","type","type1","type2","integer","tspecifier","stars","sigtype","tokenlist",
310 "codenocode","method","onerror","funcargs","arglist","arglist1","arg","checklist",
311 "check","numtok", NULL
315 static const short yyr1[] = { 0,
316 45, 45, 45, 45, 46, 46, 46, 46, 47, 48,
317 49, 49, 49, 49, 49, 49, 50, 50, 51, 51,
318 52, 52, 53, 53, 54, 54, 55, 55, 56, 56,
319 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
320 57, 57, 57, 57, 57, 58, 58, 58, 59, 59,
321 60, 61, 61, 62, 62, 63, 63, 63, 63, 63,
322 63, 63, 63, 64, 64, 64, 64, 65, 65, 65,
323 65, 66, 66, 67, 67, 68, 68, 69, 69, 70,
324 70, 70, 70, 70, 70, 70, 71, 71, 71
327 static const short yyr2[] = { 0,
328 3, 2, 2, 1, 2, 2, 1, 1, 4, 4,
329 2, 2, 2, 1, 1, 1, 4, 4, 11, 8,
330 3, 0, 3, 1, 1, 2, 1, 2, 2, 2,
331 1, 2, 2, 1, 1, 1, 1, 2, 1, 1,
332 2, 1, 2, 1, 1, 1, 1, 1, 2, 1,
333 4, 3, 1, 2, 1, 10, 9, 8, 12, 9,
334 9, 5, 6, 2, 3, 2, 0, 1, 1, 3,
335 1, 3, 1, 3, 1, 2, 6, 2, 1, 1,
336 2, 2, 3, 3, 3, 3, 1, 2, 1
339 static const short yydefact[] = { 0,
340 0, 7, 8, 0, 4, 0, 0, 5, 6, 3,
341 2, 0, 0, 1, 0, 0, 0, 22, 0, 0,
342 0, 0, 15, 16, 14, 10, 0, 0, 40, 48,
343 47, 46, 0, 0, 42, 44, 45, 36, 35, 34,
344 37, 39, 0, 25, 27, 31, 0, 0, 0, 0,
345 0, 0, 0, 0, 9, 12, 13, 11, 0, 26,
346 33, 30, 32, 29, 41, 43, 0, 50, 28, 38,
347 0, 24, 0, 0, 0, 0, 0, 0, 0, 0,
348 0, 17, 0, 49, 18, 0, 0, 21, 0, 0,
349 53, 0, 0, 0, 0, 0, 62, 40, 37, 0,
350 0, 71, 73, 75, 0, 23, 0, 0, 51, 0,
351 0, 0, 0, 63, 0, 76, 67, 0, 67, 0,
352 67, 52, 0, 0, 0, 70, 0, 0, 0, 0,
353 72, 74, 0, 0, 0, 0, 67, 0, 0, 89,
354 87, 0, 0, 64, 66, 0, 0, 0, 20, 0,
355 55, 58, 67, 0, 0, 80, 0, 0, 0, 0,
356 0, 79, 65, 88, 60, 61, 0, 54, 0, 57,
357 67, 0, 0, 81, 0, 82, 0, 77, 78, 0,
358 56, 0, 85, 83, 84, 86, 19, 0, 59, 0,
362 static const short yydefgoto[] = { 190,
363 4, 5, 6, 22, 23, 24, 50, 73, 100, 44,
364 45, 46, 47, 69, 53, 92, 152, 25, 130, 101,
365 102, 103, 104, 161, 162, 144
368 static const short yypact[] = { 32,
369 81,-32768,-32768, 36, 53, -15, 108,-32768,-32768, 53,
370 137, 138, 92, 137, 87, 93, 93, 96, 93, 3,
371 98, 127,-32768,-32768,-32768,-32768, 118, 128,-32768,-32768,
372 -32768,-32768, 60, 156, 134, 136,-32768,-32768,-32768,-32768,
373 -32768,-32768, 157,-32768, 125,-32768, 158, 159, 160, 161,
374 162, -2, 93, 163,-32768,-32768,-32768,-32768, 148,-32768,
375 -32768,-32768,-32768,-32768,-32768,-32768, 19, 125,-32768,-32768,
376 139, 150, 149, 167, 154, 155, 170, 93, 171, 164,
377 10,-32768, 111,-32768,-32768, 111, 160,-32768, 172, 111,
378 -32768, 23, 173, 166, 93, 174,-32768, 168, 28, 175,
379 169,-32768, 176,-32768, 177,-32768, 165, 178,-32768, 181,
380 182, 111, 185,-32768, 93, 183, -11, 75, -11, 179,
381 -11,-32768, 111, 180, 184,-32768, 186, -14, 187, 188,
382 -32768,-32768, 189, -7, 63, 190, -11, 111, 29,-32768,
383 -32768, 198, 201,-32768,-32768, 200, 203, 193,-32768, 205,
384 -32768,-32768, -11, 63, 194,-32768, 191, -10, -6, 192,
385 5,-32768,-32768,-32768,-32768,-32768, 209,-32768, 63,-32768,
386 -11, 1, 1,-32768, 1,-32768, 1,-32768,-32768, 202,
387 -32768, 206,-32768,-32768,-32768,-32768,-32768, 210,-32768, 207,
391 static const short yypgoto[] = {-32768,
392 14, 230,-32768,-32768, 214, 216,-32768, 107, -16, 211,
393 -32768, 142,-32768, 130, 195,-32768, -142, 218, -117, -81,
394 94,-32768, 123,-32768, 49, -108
401 static const short yytable[] = { 43,
402 48, 133, 51, 135, 105, 140, 141, 128, 108, 140,
403 141, 170, 148, 140, 141, 12, 142, 76, 11, 154,
404 140, 141, 52, 14, 156, 149, 181, 129, 173, 143,
405 124, 77, 175, 143, 1, 169, 79, 143, 1, 178,
406 96, 136, 97, 157, 143, 158, 159, 160, 156, 174,
407 176, 82, 83, 182, 2, 3, 155, 109, 8, 9,
408 110, 93, -69, 183, 184, 115, 185, 157, 186, 158,
409 159, 160, 35, 36, 37, 2, 3, 61, 113, 28,
410 29, 30, 31, 32, 131, 33, 34, 35, 36, 37,
411 38, 39, 40, 150, 41, 151, 42, 28, 29, 30,
412 31, 32, 7, 33, 34, 35, 36, 37, 38, 39,
413 40, 13, 41, 26, 42, 28, 98, 30, 31, 32,
414 27, 33, 34, 35, 36, 37, 38, 39, 40, 49,
415 99, 54, 42, 29, 30, 31, 32, 59, 33, 34,
416 35, 36, 37, 38, 39, 40, 15, 41, 65, 42,
417 66, 16, 17, 18, 19, 20, 21, 15, 55, 8,
418 9, 68, 16, 17, 18, 19, 20, 21, 35, 36,
419 37, 85, 86, 63, 62, 64, 67, 70, 71, 72,
420 74, 75, 81, 88, 80, 87, 89, 90, 77, 91,
421 94, 107, 111, 106, 116, 120, 114, 84, 95, 112,
422 122, 134, -68, 117, 125, 139, 191, 192, 126, 179,
423 0, 119, 121, 118, 137, 123, 127, 138, 146, 147,
424 163, 164, 165, 167, 153, 166, 145, 168, 171, 172,
425 177, 180, 189, 10, 187, 56, 188, 57, 60, 58,
426 132, 0, 0, 0, 0, 0, 78
429 static const short yycheck[] = { 16,
430 17, 119, 19, 121, 86, 20, 21, 19, 90, 20,
431 21, 154, 20, 20, 21, 31, 31, 20, 5, 137,
432 20, 21, 20, 10, 20, 33, 169, 39, 39, 44,
433 112, 34, 39, 44, 3, 153, 53, 44, 3, 35,
434 31, 123, 33, 39, 44, 41, 42, 43, 20, 158,
435 159, 33, 34, 171, 23, 24, 138, 35, 23, 24,
436 38, 78, 35, 172, 173, 38, 175, 39, 177, 41,
437 42, 43, 13, 14, 15, 23, 24, 18, 95, 5,
438 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
439 16, 17, 18, 31, 20, 33, 22, 5, 6, 7,
440 8, 9, 22, 11, 12, 13, 14, 15, 16, 17,
441 18, 4, 20, 22, 22, 5, 6, 7, 8, 9,
442 34, 11, 12, 13, 14, 15, 16, 17, 18, 34,
443 20, 34, 22, 6, 7, 8, 9, 20, 11, 12,
444 13, 14, 15, 16, 17, 18, 20, 20, 15, 22,
445 15, 25, 26, 27, 28, 29, 30, 20, 32, 23,
446 24, 37, 25, 26, 27, 28, 29, 30, 13, 14,
447 15, 33, 34, 18, 33, 34, 20, 20, 20, 20,
448 20, 20, 35, 35, 22, 36, 20, 34, 34, 20,
449 20, 20, 20, 87, 20, 31, 23, 68, 35, 34,
450 20, 23, 35, 35, 20, 20, 0, 0, 115, 161,
451 -1, 35, 35, 38, 35, 34, 34, 34, 31, 31,
452 23, 21, 23, 31, 35, 23, 40, 23, 35, 39,
453 39, 23, 23, 4, 33, 22, 31, 22, 28, 22,
454 118, -1, -1, -1, -1, -1, 52
456 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
457 #line 3 "/usr/lib/bison.simple"
459 /* Skeleton output parser for bison,
460 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
462 This program is free software; you can redistribute it and/or modify
463 it under the terms of the GNU General Public License as published by
464 the Free Software Foundation; either version 2, or (at your option)
467 This program is distributed in the hope that it will be useful,
468 but WITHOUT ANY WARRANTY; without even the implied warranty of
469 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
470 GNU General Public License for more details.
472 You should have received a copy of the GNU General Public License
473 along with this program; if not, write to the Free Software
474 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
476 /* As a special exception, when this file is copied by Bison into a
477 Bison output file, you may use that output file without restriction.
478 This special exception was added by the Free Software Foundation
479 in version 1.24 of Bison. */
483 #define alloca __builtin_alloca
484 #else /* not GNU C. */
485 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
487 #else /* not sparc */
488 #if defined (MSDOS) && !defined (__TURBOC__)
490 #else /* not MSDOS, or __TURBOC__ */
494 #else /* not MSDOS, __TURBOC__, or _AIX */
498 void *alloca (unsigned int);
500 #else /* not __cplusplus */
502 #endif /* not __cplusplus */
504 #endif /* not _AIX */
505 #endif /* not MSDOS, or __TURBOC__ */
506 #endif /* not sparc. */
507 #endif /* not GNU C. */
508 #endif /* alloca not defined. */
510 /* This is the parser code that is written into each bison parser
511 when the %semantic_parser declaration is not specified in the grammar.
512 It was written by Richard Stallman by simplifying the hairy parser
513 used when %semantic_parser is specified. */
515 /* Note: there must be only one dollar sign in this file.
516 It is replaced by the list of actions, each action
517 as one case of the switch. */
519 #define yyerrok (yyerrstatus = 0)
520 #define yyclearin (yychar = YYEMPTY)
523 #define YYACCEPT return(0)
524 #define YYABORT return(1)
525 #define YYERROR goto yyerrlab1
526 /* Like YYERROR except do call yyerror.
527 This remains here temporarily to ease the
528 transition to the new meaning of YYERROR, for GCC.
529 Once GCC version 2 has supplanted version 1, this can go. */
530 #define YYFAIL goto yyerrlab
531 #define YYRECOVERING() (!!yyerrstatus)
532 #define YYBACKUP(token, value) \
534 if (yychar == YYEMPTY && yylen == 1) \
535 { yychar = (token), yylval = (value); \
536 yychar1 = YYTRANSLATE (yychar); \
541 { yyerror ("syntax error: cannot back up"); YYERROR; } \
545 #define YYERRCODE 256
548 #define YYLEX yylex()
554 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
556 #define YYLEX yylex(&yylval, &yylloc)
558 #else /* not YYLSP_NEEDED */
560 #define YYLEX yylex(&yylval, YYLEX_PARAM)
562 #define YYLEX yylex(&yylval)
564 #endif /* not YYLSP_NEEDED */
567 /* If nonreentrant, generate the variables here */
571 int yychar; /* the lookahead symbol */
572 YYSTYPE yylval; /* the semantic value of the */
573 /* lookahead symbol */
576 YYLTYPE yylloc; /* location data for the lookahead */
580 int yynerrs; /* number of parse errors so far */
581 #endif /* not YYPURE */
584 int yydebug; /* nonzero means print parse trace */
585 /* Since this is uninitialized, it does not stop multiple parsers
589 /* YYINITDEPTH indicates the initial size of the parser's stacks */
592 #define YYINITDEPTH 200
595 /* YYMAXDEPTH is the maximum size the stacks can grow to
596 (effective only if the built-in stack extension method is used). */
603 #define YYMAXDEPTH 10000
606 /* Prevent warning if -Wstrict-prototypes. */
611 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
612 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
613 #else /* not GNU C or C++ */
616 /* This is the most reliable way to avoid incompatibilities
617 in available built-in functions on various systems. */
619 __yy_memcpy (to, from, count)
624 register char *f = from;
625 register char *t = to;
626 register int i = count;
632 #else /* __cplusplus */
634 /* This is the most reliable way to avoid incompatibilities
635 in available built-in functions on various systems. */
637 __yy_memcpy (char *to, char *from, int count)
639 register char *f = from;
640 register char *t = to;
641 register int i = count;
650 #line 196 "/usr/lib/bison.simple"
652 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
653 into yyparse. The argument should have type void *.
654 It should actually point to an object.
655 Grammar actions can access the variable by casting it
656 to the proper pointer type. */
660 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
661 #define YYPARSE_PARAM_DECL
662 #else /* not __cplusplus */
663 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
664 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
665 #endif /* not __cplusplus */
666 #else /* not YYPARSE_PARAM */
667 #define YYPARSE_PARAM_ARG
668 #define YYPARSE_PARAM_DECL
669 #endif /* not YYPARSE_PARAM */
672 yyparse(YYPARSE_PARAM_ARG)
675 register int yystate;
677 register short *yyssp;
678 register YYSTYPE *yyvsp;
679 int yyerrstatus; /* number of tokens to shift before error messages enabled */
680 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
682 short yyssa[YYINITDEPTH]; /* the state stack */
683 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
685 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
686 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
689 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
690 YYLTYPE *yyls = yylsa;
693 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
695 #define YYPOPSTACK (yyvsp--, yyssp--)
698 int yystacksize = YYINITDEPTH;
709 YYSTYPE yyval; /* the variable used to return */
710 /* semantic values from the action */
717 fprintf(stderr, "Starting parse\n");
723 yychar = YYEMPTY; /* Cause a token to be read. */
725 /* Initialize stack pointers.
726 Waste one element of value and location stack
727 so that they stay on the same level as the state stack.
728 The wasted elements are never initialized. */
736 /* Push a new state, which is found in yystate . */
737 /* In all cases, when you get here, the value and location stacks
738 have just been pushed. so pushing a state here evens the stacks. */
743 if (yyssp >= yyss + yystacksize - 1)
745 /* Give user a chance to reallocate the stack */
746 /* Use copies of these so that the &'s don't force the real ones into memory. */
747 YYSTYPE *yyvs1 = yyvs;
750 YYLTYPE *yyls1 = yyls;
753 /* Get the current used size of the three stacks, in elements. */
754 int size = yyssp - yyss + 1;
757 /* Each stack pointer address is followed by the size of
758 the data in use in that stack, in bytes. */
760 /* This used to be a conditional around just the two extra args,
761 but that might be undefined if yyoverflow is a macro. */
762 yyoverflow("parser stack overflow",
763 &yyss1, size * sizeof (*yyssp),
764 &yyvs1, size * sizeof (*yyvsp),
765 &yyls1, size * sizeof (*yylsp),
768 yyoverflow("parser stack overflow",
769 &yyss1, size * sizeof (*yyssp),
770 &yyvs1, size * sizeof (*yyvsp),
774 yyss = yyss1; yyvs = yyvs1;
778 #else /* no yyoverflow */
779 /* Extend the stack our own way. */
780 if (yystacksize >= YYMAXDEPTH)
782 yyerror("parser stack overflow");
786 if (yystacksize > YYMAXDEPTH)
787 yystacksize = YYMAXDEPTH;
788 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
789 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
790 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
791 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
793 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
794 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
796 #endif /* no yyoverflow */
798 yyssp = yyss + size - 1;
799 yyvsp = yyvs + size - 1;
801 yylsp = yyls + size - 1;
806 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
809 if (yyssp >= yyss + yystacksize - 1)
815 fprintf(stderr, "Entering state %d\n", yystate);
821 /* Do appropriate processing given the current state. */
822 /* Read a lookahead token if we need one and don't already have one. */
825 /* First try to decide what to do without reference to lookahead token. */
827 yyn = yypact[yystate];
831 /* Not known => get a lookahead token if don't already have one. */
833 /* yychar is either YYEMPTY or YYEOF
834 or a valid token in external form. */
836 if (yychar == YYEMPTY)
840 fprintf(stderr, "Reading a token: ");
845 /* Convert token to internal form (in yychar1) for indexing tables with */
847 if (yychar <= 0) /* This means end of input. */
850 yychar = YYEOF; /* Don't call YYLEX any more */
854 fprintf(stderr, "Now at end of input.\n");
859 yychar1 = YYTRANSLATE(yychar);
864 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
865 /* Give the individual parser a way to print the precise meaning
866 of a token, for further debugging info. */
868 YYPRINT (stderr, yychar, yylval);
870 fprintf (stderr, ")\n");
876 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
881 /* yyn is what to do for this token type in this state.
882 Negative => reduce, -yyn is rule number.
883 Positive => shift, yyn is new state.
884 New state is final state => don't bother to shift,
886 0, or most negative number => error. */
901 /* Shift the lookahead token. */
905 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
908 /* Discard the token being shifted unless it is eof. */
917 /* count tokens shifted since error; after three, turn off error status. */
918 if (yyerrstatus) yyerrstatus--;
923 /* Do the default action for the current state. */
926 yyn = yydefact[yystate];
930 /* Do a reduction. yyn is the number of a rule to reduce with. */
934 yyval = yyvsp[1-yylen]; /* implement default value of the action */
941 fprintf (stderr, "Reducing via rule %d (line %d), ",
944 /* Print the symbols being reduced, and their result. */
945 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
946 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
947 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
973 Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
974 nodes = g_list_append(nodes,node);
980 Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
981 nodes = g_list_append(nodes,node);
987 Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
988 nodes = g_list_append(nodes,node);
994 Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
995 nodes = g_list_append(nodes,node);
1001 ((Class *)class)->nodes = class_nodes;
1003 nodes = g_list_append(nodes,class);
1009 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1039 push_variable(yyvsp[-1].id,PUBLIC_SCOPE,yyvsp[-3].line);
1045 push_variable(yyvsp[-1].id,PRIVATE_SCOPE,yyvsp[-3].line);
1051 if(strcmp(yyvsp[-6].id,"get")==0 &&
1052 strcmp(yyvsp[-3].id,"set")==0) {
1054 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1055 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1056 yyvsp[-4].cbuf,yyvsp[-5].line,
1057 yyvsp[-1].cbuf,yyvsp[-2].line,
1059 class_nodes = g_list_append(class_nodes,node);
1060 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1061 strcmp(yyvsp[-3].id,"get")==0) {
1063 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1064 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1065 yyvsp[-1].cbuf,yyvsp[-2].line,
1066 yyvsp[-4].cbuf,yyvsp[-5].line,
1068 class_nodes = g_list_append(class_nodes,node);
1070 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1071 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1072 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1073 g_string_free(yyvsp[-1].cbuf,TRUE);
1074 g_string_free(yyvsp[-4].cbuf,TRUE);
1075 yyerror(_("parse error"));
1083 if(strcmp(yyvsp[-3].id,"get")==0) {
1085 g_free(yyvsp[-3].id);
1086 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1087 yyvsp[-1].cbuf,yyvsp[-2].line,NULL,0,
1089 class_nodes = g_list_append(class_nodes,node);
1090 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1092 g_free(yyvsp[-3].id);
1093 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1094 NULL,0,yyvsp[-1].cbuf,yyvsp[-2].line,
1096 class_nodes = g_list_append(class_nodes,node);
1098 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1099 g_free(yyvsp[-4].id);
1100 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1101 g_string_free(yyvsp[-1].cbuf,TRUE);
1102 yyerror(_("parse error"));
1109 { yyval.list = yyvsp[-1].list; ;
1113 { yyval.list = NULL; ;
1118 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1124 yyval.list = g_list_append(NULL,yyvsp[0].id);
1134 Type *type = typestack->data;
1135 char *oldname = type->name;
1136 type->name = g_strconcat("const ",oldname,NULL);
1143 Node *node = new_type(0,yyvsp[0].id);
1144 typestack = g_list_prepend(typestack,node);
1150 Node *node = new_type(stars,yyvsp[-1].id);
1152 typestack = g_list_prepend(typestack,node);
1158 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1164 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1170 yyval.id = g_strdup(yyvsp[0].id);
1176 yyval.id = g_strdup("unsigned char");
1182 yyval.id = g_strdup("signed char");
1188 yyval.id = g_strdup("char");
1194 yyval.id = g_strdup("double");
1200 yyval.id = g_strdup("float");
1206 yyval.id = yyvsp[0].id;
1212 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1213 g_free(yyvsp[0].id);
1219 yyval.id = yyvsp[0].id;
1225 yyval.id = g_strdup("void");
1231 yyval.id = "long int";
1243 yyval.id = "short int";
1267 yyval.id = "union ";
1273 yyval.id = "struct ";
1287 gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
1293 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1299 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1304 { yyval.cbuf=yyvsp[0].cbuf; ;
1308 { yyval.cbuf = NULL; ;
1313 int sigtype = SIGNAL_LAST_METHOD;
1314 if(strcmp(yyvsp[-8].id,"first")==0)
1315 sigtype = SIGNAL_FIRST_METHOD;
1316 else if(strcmp(yyvsp[-8].id,"last")==0)
1317 sigtype = SIGNAL_LAST_METHOD;
1319 yyerror(_("signal must be 'first' or 'last'"));
1320 g_free(yyvsp[-8].id);
1323 g_free(yyvsp[-8].id);
1326 yyerror(_("signal without 'self' as "
1327 "first parameter"));
1330 push_function(sigtype,NULL,
1331 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-9].line,
1339 yyerror(_("signal without 'self' as "
1340 "first parameter"));
1343 push_function(SIGNAL_LAST_METHOD, NULL,
1344 yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line,
1352 yyerror(_("virtual method without 'self' as "
1353 "first parameter"));
1356 push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1357 yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line,
1364 push_function(OVERRIDE_METHOD, yyvsp[-9].id,
1365 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,
1366 yyvsp[-11].line,yyvsp[-1].line,
1373 push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id,
1374 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line,
1381 push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id,
1382 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line,
1389 if(strcmp(yyvsp[-4].id,"init")==0) {
1390 push_init_arg(yyvsp[-2].id,FALSE);
1391 push_function(INIT_METHOD, NULL, yyvsp[-4].id,
1392 NULL, NULL,yyvsp[-3].line,0,
1394 } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
1395 push_init_arg(yyvsp[-2].id,TRUE);
1396 push_function(CLASS_INIT_METHOD, NULL,
1397 yyvsp[-4].id, NULL, NULL,yyvsp[-3].line,0,
1400 g_free(yyvsp[-4].id);
1401 g_free(yyvsp[-2].id);
1402 yyerror(_("parse error"));
1410 if(strcmp(yyvsp[-5].id,"init")==0) {
1411 push_init_arg(yyvsp[-3].id,FALSE);
1412 push_function(INIT_METHOD, NULL,
1413 yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line,
1414 yyvsp[-1].line,FALSE);
1415 } else if(strcmp(yyvsp[-5].id,"class_init")==0) {
1416 push_init_arg(yyvsp[-3].id,TRUE);
1417 push_function(CLASS_INIT_METHOD, NULL,
1418 yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line,
1419 yyvsp[-1].line,FALSE);
1421 g_free(yyvsp[-5].id);
1422 g_free(yyvsp[-3].id);
1423 g_string_free(yyvsp[-3].cbuf,TRUE);
1424 yyerror(_("parse error"));
1431 { yyval.id = yyvsp[0].id; ;
1436 yyval.id = (yyvsp[0].cbuf)->str;
1437 g_string_free(yyvsp[0].cbuf,FALSE);
1446 { yyval.id = NULL; ;
1450 { has_self = FALSE; ;
1456 if(strcmp(yyvsp[0].id,"this")==0) {
1457 push_self(yyvsp[0].id);
1458 print_error(TRUE,_("Use of 'this' is "
1459 "depreciated, use 'self' "
1460 "instead"),line_no);
1461 } else if(strcmp(yyvsp[0].id,"self")==0)
1462 push_self(yyvsp[0].id);
1464 g_free(yyvsp[0].id);
1465 yyerror(_("parse error"));
1474 if(strcmp(yyvsp[-2].id,"this")==0) {
1475 push_self(yyvsp[-2].id);
1476 print_error(TRUE,_("Use of 'this' is "
1477 "depreciated, use 'self' "
1478 "instead"),line_no);
1479 } else if(strcmp(yyvsp[-2].id,"self")==0)
1480 push_self(yyvsp[-2].id);
1482 g_free(yyvsp[-2].id);
1483 yyerror(_("parse error"));
1490 { has_self = FALSE; ;
1511 push_funcarg(yyvsp[0].id);
1517 if(strcmp(yyvsp[-2].id,"check")!=0) {
1518 yyerror(_("parse error"));
1521 g_free(yyvsp[-2].id);
1522 push_funcarg(yyvsp[-4].id);
1536 if(strcmp(yyvsp[0].id,"type")==0) {
1537 Node *node = new_check(TYPE_CHECK,NULL);
1538 checks = g_list_append(checks,node);
1539 } else if(strcmp(yyvsp[0].id,"null")==0) {
1540 Node *node = new_check(NULL_CHECK,NULL);
1541 checks = g_list_append(checks,node);
1543 yyerror(_("parse error"));
1546 g_free(yyvsp[0].id);
1552 Node *node = new_check(GT_CHECK,yyvsp[0].id);
1553 checks = g_list_append(checks,node);
1559 Node *node = new_check(LT_CHECK,yyvsp[0].id);
1560 checks = g_list_append(checks,node);
1566 Node *node = new_check(GE_CHECK,yyvsp[0].id);
1567 checks = g_list_append(checks,node);
1573 Node *node = new_check(LE_CHECK,yyvsp[0].id);
1574 checks = g_list_append(checks,node);
1580 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
1581 checks = g_list_append(checks,node);
1587 Node *node = new_check(NE_CHECK,yyvsp[0].id);
1588 checks = g_list_append(checks,node);
1593 { yyval.id = yyvsp[0].id; ;
1598 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
1599 g_free(yyvsp[0].id);
1604 { yyval.id = yyvsp[0].id; ;
1607 /* the action file gets copied in in place of this dollarsign */
1608 #line 498 "/usr/lib/bison.simple"
1619 short *ssp1 = yyss - 1;
1620 fprintf (stderr, "state stack now");
1621 while (ssp1 != yyssp)
1622 fprintf (stderr, " %d", *++ssp1);
1623 fprintf (stderr, "\n");
1633 yylsp->first_line = yylloc.first_line;
1634 yylsp->first_column = yylloc.first_column;
1635 yylsp->last_line = (yylsp-1)->last_line;
1636 yylsp->last_column = (yylsp-1)->last_column;
1641 yylsp->last_line = (yylsp+yylen-1)->last_line;
1642 yylsp->last_column = (yylsp+yylen-1)->last_column;
1646 /* Now "shift" the result of the reduction.
1647 Determine what state that goes to,
1648 based on the state we popped back to
1649 and the rule number reduced by. */
1653 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1654 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1655 yystate = yytable[yystate];
1657 yystate = yydefgoto[yyn - YYNTBASE];
1661 yyerrlab: /* here on detecting error */
1664 /* If not already recovering from an error, report this error. */
1668 #ifdef YYERROR_VERBOSE
1669 yyn = yypact[yystate];
1671 if (yyn > YYFLAG && yyn < YYLAST)
1678 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1679 for (x = (yyn < 0 ? -yyn : 0);
1680 x < (sizeof(yytname) / sizeof(char *)); x++)
1681 if (yycheck[x + yyn] == x)
1682 size += strlen(yytname[x]) + 15, count++;
1683 msg = (char *) malloc(size + 15);
1686 strcpy(msg, "parse error");
1691 for (x = (yyn < 0 ? -yyn : 0);
1692 x < (sizeof(yytname) / sizeof(char *)); x++)
1693 if (yycheck[x + yyn] == x)
1695 strcat(msg, count == 0 ? ", expecting `" : " or `");
1696 strcat(msg, yytname[x]);
1705 yyerror ("parse error; also virtual memory exceeded");
1708 #endif /* YYERROR_VERBOSE */
1709 yyerror("parse error");
1713 yyerrlab1: /* here on error raised explicitly by an action */
1715 if (yyerrstatus == 3)
1717 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1719 /* return failure if at end of input */
1720 if (yychar == YYEOF)
1725 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1731 /* Else will try to reuse lookahead token
1732 after shifting the error token. */
1734 yyerrstatus = 3; /* Each real token shifted decrements this */
1738 yyerrdefault: /* current state does not do anything special for the error token. */
1741 /* This is wrong; only states that explicitly want error tokens
1742 should shift them. */
1743 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1744 if (yyn) goto yydefault;
1747 yyerrpop: /* pop the current state because it cannot handle the error token */
1749 if (yyssp == yyss) YYABORT;
1759 short *ssp1 = yyss - 1;
1760 fprintf (stderr, "Error: state stack now");
1761 while (ssp1 != yyssp)
1762 fprintf (stderr, " %d", *++ssp1);
1763 fprintf (stderr, "\n");
1769 yyn = yypact[yystate];
1774 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1793 fprintf(stderr, "Shifting error token, ");