2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.27
6 #define YYBISON 1 /* Identify Bison output. */
52 extern char *filename;
56 static GList *class_nodes = NULL;
59 static GList *typestack = NULL;
61 static GList *funcargs = NULL;
62 static GList *checks = NULL;
63 static int has_this = FALSE;
65 static GList *gtktypes = NULL;
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)
103 Type *type = typestack->data;
104 typestack = g_list_remove(typestack,typestack->data);
106 var = new_variable(scope,type,name);
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)
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);
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);
163 push_this(char *this)
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,this,ch);
172 funcargs = g_list_prepend(funcargs, node);
198 #define YYFLAG -32768
201 #define YYTRANSLATE(x) ((unsigned)(x) <= 287 ? 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, 46, 2, 2, 2, 2, 2, 2, 37,
208 38, 40, 2, 41, 47, 2, 2, 2, 43, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 36, 45,
210 42, 44, 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, 34, 39, 35, 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, 3, 4, 5, 6,
230 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
231 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
232 27, 28, 29, 30, 31, 32, 33
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, 97, 100, 102,
240 105, 108, 110, 112, 114, 116, 119, 121, 123, 126,
241 128, 131, 133, 135, 137, 139, 141, 144, 146, 151,
242 155, 157, 169, 180, 192, 203, 214, 224, 234, 243,
243 256, 266, 276, 282, 289, 292, 295, 299, 302, 303,
244 305, 307, 311, 313, 317, 319, 322, 329, 332, 334,
245 336, 338, 341, 344, 348, 352, 356, 360, 362
248 static const short yyrhs[] = { 49,
249 50, 49, 0, 50, 49, 0, 49, 50, 0, 50,
250 0, 49, 26, 0, 49, 27, 0, 26, 0, 27,
251 0, 51, 34, 52, 35, 0, 3, 25, 4, 25,
252 0, 52, 64, 0, 52, 53, 0, 52, 54, 0,
253 64, 0, 53, 0, 54, 0, 28, 57, 23, 36,
254 0, 29, 57, 23, 36, 0, 30, 55, 23, 23,
255 23, 34, 26, 23, 34, 26, 36, 0, 30, 55,
256 23, 23, 23, 34, 26, 36, 0, 37, 56, 38,
257 0, 0, 23, 39, 56, 0, 23, 0, 58, 0,
258 58, 61, 0, 10, 59, 0, 9, 59, 0, 59,
259 0, 10, 16, 0, 9, 16, 0, 16, 0, 15,
260 0, 14, 0, 23, 0, 60, 23, 0, 25, 0,
261 5, 0, 11, 13, 0, 11, 0, 12, 13, 0,
262 12, 0, 13, 0, 8, 0, 7, 0, 6, 0,
263 40, 61, 0, 40, 0, 23, 37, 63, 38, 0,
264 63, 41, 23, 0, 23, 0, 32, 18, 62, 57,
265 23, 37, 66, 38, 65, 34, 26, 0, 32, 18,
266 62, 57, 23, 37, 66, 38, 65, 36, 0, 32,
267 17, 62, 57, 23, 37, 66, 38, 65, 34, 26,
268 0, 32, 17, 62, 57, 23, 37, 66, 38, 65,
269 36, 0, 32, 62, 57, 23, 37, 66, 38, 65,
270 34, 26, 0, 32, 62, 57, 23, 37, 66, 38,
271 65, 36, 0, 31, 57, 23, 37, 66, 38, 65,
272 34, 26, 0, 31, 57, 23, 37, 66, 38, 65,
273 36, 0, 33, 37, 25, 38, 57, 23, 37, 66,
274 38, 65, 34, 26, 0, 28, 57, 23, 37, 66,
275 38, 65, 34, 26, 0, 29, 57, 23, 37, 66,
276 38, 65, 34, 26, 0, 23, 37, 23, 38, 36,
277 0, 23, 37, 23, 38, 34, 26, 0, 22, 23,
278 0, 22, 71, 0, 22, 34, 26, 0, 42, 43,
279 0, 0, 5, 0, 23, 0, 23, 41, 67, 0,
280 67, 0, 67, 41, 68, 0, 68, 0, 57, 23,
281 0, 57, 23, 37, 19, 69, 38, 0, 69, 70,
282 0, 70, 0, 20, 0, 21, 0, 44, 71, 0,
283 45, 71, 0, 44, 42, 71, 0, 45, 42, 71,
284 0, 42, 42, 71, 0, 46, 42, 71, 0, 24,
291 static const short yyrline[] = { 0,
292 175, 176, 177, 178, 181, 185, 189, 193, 199, 206,
293 211, 212, 213, 214, 215, 216, 219, 222, 226, 251,
294 275, 276, 279, 282, 288, 292, 299, 302, 305, 308,
295 311, 314, 317, 320, 323, 326, 330, 333, 338, 341,
296 344, 347, 350, 355, 358, 361, 366, 367, 370, 375,
297 378, 384, 393, 402, 411, 420, 429, 438, 442, 446,
298 450, 454, 458, 474, 493, 494, 495, 499, 500, 505,
299 506, 516, 526, 529, 530, 533, 536, 541, 542, 545,
300 549, 553, 557, 561, 565, 569, 573, 579, 580
305 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
307 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
308 "FROM","VOID","STRUCT","UNION","ENUM","SIGNED","UNSIGNED","LONG","SHORT","INT",
309 "FLOAT","DOUBLE","CHAR","FIRST","LAST","CHECK","CNULL","TYPE","ONERROR","TOKEN",
310 "NUMBER","TYPETOKEN","CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL",
311 "SIGNAL","OVERRIDE","'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'",
312 "'>'","'<'","'!'","'-'","prog","ccodes","class","classdec","classcode","variable",
313 "argument","argflags","flaglist","type","type1","integer","tspecifier","stars",
314 "sigtype","tokenlist","method","onerror","funcargs","arglist","arg","checklist",
315 "check","number", NULL
319 static const short yyr1[] = { 0,
320 48, 48, 48, 48, 49, 49, 49, 49, 50, 51,
321 52, 52, 52, 52, 52, 52, 53, 53, 54, 54,
322 55, 55, 56, 56, 57, 57, 58, 58, 58, 58,
323 58, 58, 58, 58, 58, 58, 58, 58, 59, 59,
324 59, 59, 59, 60, 60, 60, 61, 61, 62, 63,
325 63, 64, 64, 64, 64, 64, 64, 64, 64, 64,
326 64, 64, 64, 64, 65, 65, 65, 65, 65, 66,
327 66, 66, 66, 67, 67, 68, 68, 69, 69, 70,
328 70, 70, 70, 70, 70, 70, 70, 71, 71
331 static const short yyr2[] = { 0,
332 3, 2, 2, 1, 2, 2, 1, 1, 4, 4,
333 2, 2, 2, 1, 1, 1, 4, 4, 11, 8,
334 3, 0, 3, 1, 1, 2, 2, 2, 1, 2,
335 2, 1, 1, 1, 1, 2, 1, 1, 2, 1,
336 2, 1, 1, 1, 1, 1, 2, 1, 4, 3,
337 1, 11, 10, 11, 10, 10, 9, 9, 8, 12,
338 9, 9, 5, 6, 2, 2, 3, 2, 0, 1,
339 1, 3, 1, 3, 1, 2, 6, 2, 1, 1,
340 1, 2, 2, 3, 3, 3, 3, 1, 2
343 static const short yydefact[] = { 0,
344 0, 7, 8, 0, 4, 0, 0, 5, 6, 3,
345 2, 0, 0, 1, 0, 0, 0, 22, 0, 0,
346 0, 0, 15, 16, 14, 10, 0, 38, 46, 45,
347 44, 0, 0, 40, 42, 43, 34, 33, 32, 35,
348 37, 0, 25, 29, 0, 0, 0, 0, 0, 0,
349 0, 0, 0, 0, 9, 12, 13, 11, 0, 31,
350 28, 30, 27, 39, 41, 0, 48, 26, 36, 0,
351 24, 0, 0, 0, 0, 0, 0, 0, 0, 0,
352 17, 0, 47, 18, 0, 0, 21, 0, 0, 0,
353 0, 51, 0, 0, 0, 0, 63, 38, 35, 0,
354 0, 73, 75, 0, 23, 0, 0, 0, 0, 49,
355 0, 0, 0, 64, 0, 76, 69, 0, 69, 0,
356 69, 0, 0, 50, 0, 0, 72, 0, 0, 0,
357 0, 74, 0, 0, 0, 0, 0, 69, 0, 0,
358 65, 88, 0, 0, 66, 68, 0, 0, 0, 20,
359 0, 59, 69, 69, 0, 0, 80, 81, 0, 0,
360 0, 0, 0, 79, 67, 89, 61, 62, 0, 58,
361 0, 0, 0, 57, 69, 0, 0, 82, 0, 83,
362 0, 77, 78, 0, 0, 55, 0, 53, 56, 0,
363 86, 84, 85, 87, 19, 54, 52, 0, 60, 0,
367 static const short yydefgoto[] = { 200,
368 4, 5, 6, 22, 23, 24, 48, 72, 100, 43,
369 44, 45, 68, 53, 93, 25, 131, 101, 102, 103,
373 static const short yypact[] = { 3,
374 -23,-32768,-32768, 23, 69, -25, 19,-32768,-32768, 69,
375 104, 105, 2, 104, 36, 75, 75, 40, 75, -5,
376 62, 94,-32768,-32768,-32768,-32768, 34,-32768,-32768,-32768,
377 -32768, 81, 102, 126, 132,-32768,-32768,-32768,-32768,-32768,
378 -32768, 93, 80,-32768, 109, 133, 134, 135, 136, 137,
379 137, 118, 75, 138,-32768,-32768,-32768,-32768, 123,-32768,
380 -32768,-32768,-32768,-32768,-32768, 111, 80,-32768,-32768, 113,
381 125, 124, 142, 129, 75, 75, 144, 145, 131, 30,
382 -32768, 96,-32768,-32768, 96, 134,-32768, 147, 96, 148,
383 149,-32768, -22, 139, 75, 151,-32768, 140, -21, 150,
384 141, 143,-32768, 152,-32768, 146, 153, 155, 156,-32768,
385 158, 96, 159,-32768, 75, 157, 33, 75, 33, 160,
386 33, 96, 96,-32768, 161, 163, 143, 164, -9, 154,
387 162,-32768, 167, 29, 42, 165, 166, 33, 96, 1,
388 -32768,-32768, 169, 174,-32768,-32768, 176, 179, 172,-32768,
389 181,-32768, 33, 33, 106, 170,-32768,-32768, 168, 9,
390 20, 171, -10,-32768,-32768,-32768,-32768,-32768, 183,-32768,
391 107, 110, 185,-32768, 33, 24, 24,-32768, 24,-32768,
392 24,-32768,-32768, 178, 186,-32768, 189,-32768,-32768, 182,
393 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 191,-32768, 175,
397 static const short yypgoto[] = {-32768,
398 58, 184,-32768,-32768, 196, 197,-32768, 88, -16,-32768,
399 119,-32768, 122, 103,-32768, 198, -114, -81, 70, 108,
407 static const short yytable[] = { 42,
408 46, 7, 49, 104, 133, 1, 135, 107, 12, 157,
409 158, 50, 51, 141, 142, 110, -71, 52, 111, 115,
410 157, 158, 13, 155, 143, 1, 26, 182, 2, 3,
411 125, 159, 142, 160, 161, 162, 78, 144, 171, 172,
412 136, 137, 159, 142, 160, 161, 162, 142, 8, 9,
413 177, 149, 178, 180, 129, 144, 59, 156, 90, 91,
414 190, 179, 11, 96, 150, 97, 144, 14, 191, 192,
415 144, 193, 27, 194, 130, 151, 47, 152, 113, 28,
416 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
417 39, 34, 35, 36, 2, 3, 60, 40, 54, 41,
418 98, 29, 30, 31, 32, 33, 34, 35, 36, 37,
419 38, 39, 34, 35, 36, 66, 15, 62, 99, 67,
420 41, 16, 17, 18, 19, 20, 21, 15, 55, 8,
421 9, 69, 16, 17, 18, 19, 20, 21, 64, 173,
422 185, 174, 186, 187, 65, 188, 81, 82, 84, 85,
423 61, 63, 75, 76, 77, 70, 71, 73, 74, 52,
424 80, 87, 79, 86, 88, 89, 92, 94, 95, 106,
425 108, 109, 116, 105, 201, 112, 114, -70, 117, 120,
426 124, 126, 140, 118, 127, 134, 202, 10, 83, 119,
427 121, 122, 123, 128, 165, 147, 146, 166, 138, 139,
428 148, 167, 153, 154, 168, 169, 170, 175, 184, 176,
429 189, 196, 181, 195, 197, 198, 199, 56, 57, 58,
433 static const short yycheck[] = { 16,
434 17, 25, 19, 85, 119, 3, 121, 89, 34, 20,
435 21, 17, 18, 23, 24, 38, 38, 23, 41, 41,
436 20, 21, 4, 138, 34, 3, 25, 38, 26, 27,
437 112, 42, 24, 44, 45, 46, 53, 47, 153, 154,
438 122, 123, 42, 24, 44, 45, 46, 24, 26, 27,
439 42, 23, 160, 161, 22, 47, 23, 139, 75, 76,
440 175, 42, 5, 34, 36, 36, 47, 10, 176, 177,
441 47, 179, 37, 181, 42, 34, 37, 36, 95, 5,
442 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
443 16, 11, 12, 13, 26, 27, 16, 23, 37, 25,
444 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
445 15, 16, 11, 12, 13, 23, 23, 16, 23, 40,
446 25, 28, 29, 30, 31, 32, 33, 23, 35, 26,
447 27, 23, 28, 29, 30, 31, 32, 33, 13, 34,
448 34, 36, 36, 34, 13, 36, 36, 37, 36, 37,
449 32, 33, 50, 51, 37, 23, 23, 23, 23, 23,
450 38, 38, 25, 39, 23, 37, 23, 23, 38, 23,
451 23, 23, 23, 86, 0, 37, 26, 38, 38, 34,
452 23, 23, 19, 41, 115, 26, 0, 4, 67, 38,
453 38, 37, 37, 37, 26, 34, 43, 24, 38, 37,
454 34, 26, 38, 38, 26, 34, 26, 38, 26, 42,
455 26, 26, 42, 36, 26, 34, 26, 22, 22, 22,
456 -1, 163, -1, -1, -1, 118
458 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
459 #line 3 "/usr/lib/bison.simple"
460 /* This file comes from bison-1.27. */
462 /* Skeleton output parser for bison,
463 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
465 This program is free software; you can redistribute it and/or modify
466 it under the terms of the GNU General Public License as published by
467 the Free Software Foundation; either version 2, or (at your option)
470 This program is distributed in the hope that it will be useful,
471 but WITHOUT ANY WARRANTY; without even the implied warranty of
472 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
473 GNU General Public License for more details.
475 You should have received a copy of the GNU General Public License
476 along with this program; if not, write to the Free Software
477 Foundation, Inc., 59 Temple Place - Suite 330,
478 Boston, MA 02111-1307, USA. */
480 /* As a special exception, when this file is copied by Bison into a
481 Bison output file, you may use that output file without restriction.
482 This special exception was added by the Free Software Foundation
483 in version 1.24 of Bison. */
485 /* This is the parser code that is written into each bison parser
486 when the %semantic_parser declaration is not specified in the grammar.
487 It was written by Richard Stallman by simplifying the hairy parser
488 used when %semantic_parser is specified. */
490 #ifndef YYSTACK_USE_ALLOCA
492 #define YYSTACK_USE_ALLOCA
493 #else /* alloca not defined */
495 #define YYSTACK_USE_ALLOCA
496 #define alloca __builtin_alloca
497 #else /* not GNU C. */
498 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
499 #define YYSTACK_USE_ALLOCA
501 #else /* not sparc */
502 /* We think this test detects Watcom and Microsoft C. */
503 /* This used to test MSDOS, but that is a bad idea
504 since that symbol is in the user namespace. */
505 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
506 #if 0 /* No need for malloc.h, which pollutes the namespace;
507 instead, just don't use alloca. */
510 #else /* not MSDOS, or __TURBOC__ */
512 /* I don't know what this was needed for, but it pollutes the namespace.
513 So I turned it off. rms, 2 May 1997. */
514 /* #include <malloc.h> */
516 #define YYSTACK_USE_ALLOCA
517 #else /* not MSDOS, or __TURBOC__, or _AIX */
519 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
520 and on HPUX 10. Eventually we can turn this on. */
521 #define YYSTACK_USE_ALLOCA
522 #define alloca __builtin_alloca
525 #endif /* not _AIX */
526 #endif /* not MSDOS, or __TURBOC__ */
527 #endif /* not sparc */
528 #endif /* not GNU C */
529 #endif /* alloca not defined */
530 #endif /* YYSTACK_USE_ALLOCA not defined */
532 #ifdef YYSTACK_USE_ALLOCA
533 #define YYSTACK_ALLOC alloca
535 #define YYSTACK_ALLOC malloc
538 /* Note: there must be only one dollar sign in this file.
539 It is replaced by the list of actions, each action
540 as one case of the switch. */
542 #define yyerrok (yyerrstatus = 0)
543 #define yyclearin (yychar = YYEMPTY)
546 #define YYACCEPT goto yyacceptlab
547 #define YYABORT goto yyabortlab
548 #define YYERROR goto yyerrlab1
549 /* Like YYERROR except do call yyerror.
550 This remains here temporarily to ease the
551 transition to the new meaning of YYERROR, for GCC.
552 Once GCC version 2 has supplanted version 1, this can go. */
553 #define YYFAIL goto yyerrlab
554 #define YYRECOVERING() (!!yyerrstatus)
555 #define YYBACKUP(token, value) \
557 if (yychar == YYEMPTY && yylen == 1) \
558 { yychar = (token), yylval = (value); \
559 yychar1 = YYTRANSLATE (yychar); \
564 { yyerror ("syntax error: cannot back up"); YYERROR; } \
568 #define YYERRCODE 256
571 #define YYLEX yylex()
577 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
579 #define YYLEX yylex(&yylval, &yylloc)
581 #else /* not YYLSP_NEEDED */
583 #define YYLEX yylex(&yylval, YYLEX_PARAM)
585 #define YYLEX yylex(&yylval)
587 #endif /* not YYLSP_NEEDED */
590 /* If nonreentrant, generate the variables here */
594 int yychar; /* the lookahead symbol */
595 YYSTYPE yylval; /* the semantic value of the */
596 /* lookahead symbol */
599 YYLTYPE yylloc; /* location data for the lookahead */
603 int yynerrs; /* number of parse errors so far */
604 #endif /* not YYPURE */
607 int yydebug; /* nonzero means print parse trace */
608 /* Since this is uninitialized, it does not stop multiple parsers
612 /* YYINITDEPTH indicates the initial size of the parser's stacks */
615 #define YYINITDEPTH 200
618 /* YYMAXDEPTH is the maximum size the stacks can grow to
619 (effective only if the built-in stack extension method is used). */
626 #define YYMAXDEPTH 10000
629 /* Define __yy_memcpy. Note that the size argument
630 should be passed with type unsigned int, because that is what the non-GCC
631 definitions require. With GCC, __builtin_memcpy takes an arg
632 of type size_t, but it can handle unsigned int. */
634 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
635 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
636 #else /* not GNU C or C++ */
639 /* This is the most reliable way to avoid incompatibilities
640 in available built-in functions on various systems. */
642 __yy_memcpy (to, from, count)
647 register char *f = from;
648 register char *t = to;
649 register int i = count;
655 #else /* __cplusplus */
657 /* This is the most reliable way to avoid incompatibilities
658 in available built-in functions on various systems. */
660 __yy_memcpy (char *to, char *from, unsigned int count)
662 register char *t = to;
663 register char *f = from;
664 register int i = count;
673 #line 216 "/usr/lib/bison.simple"
675 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
676 into yyparse. The argument should have type void *.
677 It should actually point to an object.
678 Grammar actions can access the variable by casting it
679 to the proper pointer type. */
683 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
684 #define YYPARSE_PARAM_DECL
685 #else /* not __cplusplus */
686 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
687 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
688 #endif /* not __cplusplus */
689 #else /* not YYPARSE_PARAM */
690 #define YYPARSE_PARAM_ARG
691 #define YYPARSE_PARAM_DECL
692 #endif /* not YYPARSE_PARAM */
694 /* Prevent warning if -Wstrict-prototypes. */
697 int yyparse (void *);
704 yyparse(YYPARSE_PARAM_ARG)
707 register int yystate;
709 register short *yyssp;
710 register YYSTYPE *yyvsp;
711 int yyerrstatus; /* number of tokens to shift before error messages enabled */
712 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
714 short yyssa[YYINITDEPTH]; /* the state stack */
715 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
717 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
718 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
721 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
722 YYLTYPE *yyls = yylsa;
725 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
727 #define YYPOPSTACK (yyvsp--, yyssp--)
730 int yystacksize = YYINITDEPTH;
731 int yyfree_stacks = 0;
742 YYSTYPE yyval; /* the variable used to return */
743 /* semantic values from the action */
750 fprintf(stderr, "Starting parse\n");
756 yychar = YYEMPTY; /* Cause a token to be read. */
758 /* Initialize stack pointers.
759 Waste one element of value and location stack
760 so that they stay on the same level as the state stack.
761 The wasted elements are never initialized. */
769 /* Push a new state, which is found in yystate . */
770 /* In all cases, when you get here, the value and location stacks
771 have just been pushed. so pushing a state here evens the stacks. */
776 if (yyssp >= yyss + yystacksize - 1)
778 /* Give user a chance to reallocate the stack */
779 /* Use copies of these so that the &'s don't force the real ones into memory. */
780 YYSTYPE *yyvs1 = yyvs;
783 YYLTYPE *yyls1 = yyls;
786 /* Get the current used size of the three stacks, in elements. */
787 int size = yyssp - yyss + 1;
790 /* Each stack pointer address is followed by the size of
791 the data in use in that stack, in bytes. */
793 /* This used to be a conditional around just the two extra args,
794 but that might be undefined if yyoverflow is a macro. */
795 yyoverflow("parser stack overflow",
796 &yyss1, size * sizeof (*yyssp),
797 &yyvs1, size * sizeof (*yyvsp),
798 &yyls1, size * sizeof (*yylsp),
801 yyoverflow("parser stack overflow",
802 &yyss1, size * sizeof (*yyssp),
803 &yyvs1, size * sizeof (*yyvsp),
807 yyss = yyss1; yyvs = yyvs1;
811 #else /* no yyoverflow */
812 /* Extend the stack our own way. */
813 if (yystacksize >= YYMAXDEPTH)
815 yyerror("parser stack overflow");
827 if (yystacksize > YYMAXDEPTH)
828 yystacksize = YYMAXDEPTH;
829 #ifndef YYSTACK_USE_ALLOCA
832 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
833 __yy_memcpy ((char *)yyss, (char *)yyss1,
834 size * (unsigned int) sizeof (*yyssp));
835 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
836 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
837 size * (unsigned int) sizeof (*yyvsp));
839 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
840 __yy_memcpy ((char *)yyls, (char *)yyls1,
841 size * (unsigned int) sizeof (*yylsp));
843 #endif /* no yyoverflow */
845 yyssp = yyss + size - 1;
846 yyvsp = yyvs + size - 1;
848 yylsp = yyls + size - 1;
853 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
856 if (yyssp >= yyss + yystacksize - 1)
862 fprintf(stderr, "Entering state %d\n", yystate);
868 /* Do appropriate processing given the current state. */
869 /* Read a lookahead token if we need one and don't already have one. */
872 /* First try to decide what to do without reference to lookahead token. */
874 yyn = yypact[yystate];
878 /* Not known => get a lookahead token if don't already have one. */
880 /* yychar is either YYEMPTY or YYEOF
881 or a valid token in external form. */
883 if (yychar == YYEMPTY)
887 fprintf(stderr, "Reading a token: ");
892 /* Convert token to internal form (in yychar1) for indexing tables with */
894 if (yychar <= 0) /* This means end of input. */
897 yychar = YYEOF; /* Don't call YYLEX any more */
901 fprintf(stderr, "Now at end of input.\n");
906 yychar1 = YYTRANSLATE(yychar);
911 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
912 /* Give the individual parser a way to print the precise meaning
913 of a token, for further debugging info. */
915 YYPRINT (stderr, yychar, yylval);
917 fprintf (stderr, ")\n");
923 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
928 /* yyn is what to do for this token type in this state.
929 Negative => reduce, -yyn is rule number.
930 Positive => shift, yyn is new state.
931 New state is final state => don't bother to shift,
933 0, or most negative number => error. */
948 /* Shift the lookahead token. */
952 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
955 /* Discard the token being shifted unless it is eof. */
964 /* count tokens shifted since error; after three, turn off error status. */
965 if (yyerrstatus) yyerrstatus--;
970 /* Do the default action for the current state. */
973 yyn = yydefact[yystate];
977 /* Do a reduction. yyn is the number of a rule to reduce with. */
981 yyval = yyvsp[1-yylen]; /* implement default value of the action */
988 fprintf (stderr, "Reducing via rule %d (line %d), ",
991 /* Print the symbols being reduced, and their result. */
992 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
993 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
994 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1020 Node *node = new_ccode(FALSE,yyvsp[0].cbuf);
1021 nodes = g_list_append(nodes,node);
1027 Node *node = new_ccode(TRUE,yyvsp[0].cbuf);
1028 nodes = g_list_append(nodes,node);
1034 Node *node = new_ccode(FALSE,yyvsp[0].cbuf);
1035 nodes = g_list_append(nodes,node);
1041 Node *node = new_ccode(TRUE,yyvsp[0].cbuf);
1042 nodes = g_list_append(nodes,node);
1048 ((Class *)class)->nodes = class_nodes;
1050 nodes = g_list_append(nodes,class);
1056 class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1086 push_variable(yyvsp[-1].id,PUBLIC_SCOPE);
1092 push_variable(yyvsp[-1].id,PRIVATE_SCOPE);
1098 if(strcmp(yyvsp[-6].id,"get")==0 &&
1099 strcmp(yyvsp[-3].id,"set")==0) {
1101 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1102 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1103 yyvsp[-4].cbuf,yyvsp[-1].cbuf);
1104 class_nodes = g_list_append(class_nodes,node);
1105 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1106 strcmp(yyvsp[-3].id,"get")==0) {
1108 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1109 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1110 yyvsp[-1].cbuf,yyvsp[-4].cbuf);
1111 class_nodes = g_list_append(class_nodes,node);
1113 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1114 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1115 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1116 g_string_free(yyvsp[-1].cbuf,TRUE);
1117 g_string_free(yyvsp[-4].cbuf,TRUE);
1118 yyerror(_("parse error"));
1126 if(strcmp(yyvsp[-3].id,"get")==0) {
1128 g_free(yyvsp[-3].id);
1129 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1130 yyvsp[-1].cbuf,NULL);
1131 class_nodes = g_list_append(class_nodes,node);
1132 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1134 g_free(yyvsp[-3].id);
1135 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1136 NULL,yyvsp[-1].cbuf);
1137 class_nodes = g_list_append(class_nodes,node);
1139 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1140 g_free(yyvsp[-4].id);
1141 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1142 g_string_free(yyvsp[-1].cbuf,TRUE);
1143 yyerror(_("parse error"));
1150 { yyval.list = yyvsp[-1].list; ;
1154 { yyval.list = NULL; ;
1159 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1165 yyval.list = g_list_append(NULL,yyvsp[0].id);
1171 Node *node = new_type(0,yyvsp[0].id);
1172 typestack = g_list_prepend(typestack,node);
1178 Node *node = new_type(stars,yyvsp[-1].id);
1180 typestack = g_list_prepend(typestack,node);
1186 yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1192 yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1198 yyval.id = g_strdup(yyvsp[0].id);
1204 yyval.id = g_strdup("unsigned char");
1210 yyval.id = g_strdup("signed char");
1216 yyval.id = g_strdup("char");
1222 yyval.id = g_strdup("double");
1228 yyval.id = g_strdup("float");
1234 yyval.id = yyvsp[0].id;
1240 yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1241 g_free(yyvsp[0].id);
1247 yyval.id = yyvsp[0].id;
1253 yyval.id = g_strdup("void");
1259 yyval.id = "long int";
1271 yyval.id = "short int";
1295 yyval.id = "union ";
1301 yyval.id = "struct ";
1315 gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
1321 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1327 gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1334 yyerror(_("signal without 'this' as "
1335 "first parameter"));
1338 push_function(SIGNAL_LAST_METHOD,NULL,
1339 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line);
1346 yyerror(_("signal without 'this' as "
1347 "first parameter"));
1350 push_function(SIGNAL_LAST_METHOD, NULL,
1351 yyvsp[-5].id, yyvsp[-1].id, NULL,yyvsp[-9].line);
1358 yyerror(_("signal without 'this' as "
1359 "first parameter"));
1362 push_function(SIGNAL_FIRST_METHOD, NULL,
1363 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line);
1370 yyerror(_("signal without 'this' as "
1371 "first parameter"));
1374 push_function(SIGNAL_FIRST_METHOD, NULL, yyvsp[-5].id,
1375 yyvsp[-1].id, NULL,yyvsp[-9].line);
1382 yyerror(_("signal without 'this' as "
1383 "first parameter"));
1386 push_function(SIGNAL_LAST_METHOD, NULL,
1387 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-9].line);
1394 yyerror(_("signal without 'this' as "
1395 "first parameter"));
1398 push_function(SIGNAL_LAST_METHOD, NULL, yyvsp[-5].id,
1399 yyvsp[-1].id, NULL,yyvsp[-8].line);
1405 push_function(VIRTUAL_METHOD, NULL, yyvsp[-6].id,
1406 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
1412 push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1413 yyvsp[-1].id, NULL,yyvsp[-7].line);
1419 push_function(OVERRIDE_METHOD, yyvsp[-9].id,
1420 yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line);
1426 push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id,
1427 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
1433 push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id,
1434 yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
1440 if(strcmp(yyvsp[-4].id,"init")==0) {
1441 push_init_arg(yyvsp[-2].id,FALSE);
1442 push_function(INIT_METHOD, NULL, yyvsp[-4].id,
1443 NULL, NULL,yyvsp[-3].line);
1444 } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
1445 push_init_arg(yyvsp[-2].id,TRUE);
1446 push_function(CLASS_INIT_METHOD, NULL,
1447 yyvsp[-4].id, NULL, NULL,yyvsp[-3].line);
1449 g_free(yyvsp[-4].id);
1450 g_free(yyvsp[-2].id);
1451 yyerror(_("parse error"));
1459 if(strcmp(yyvsp[-5].id,"init")==0) {
1460 push_init_arg(yyvsp[-3].id,FALSE);
1461 push_function(INIT_METHOD, NULL,
1462 yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line);
1463 } else if(strcmp(yyvsp[-5].id,"class_init")==0) {
1464 push_init_arg(yyvsp[-3].id,TRUE);
1465 push_function(CLASS_INIT_METHOD, NULL,
1466 yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line);
1468 g_free(yyvsp[-5].id);
1469 g_free(yyvsp[-3].id);
1470 g_string_free(yyvsp[-3].cbuf,TRUE);
1471 yyerror(_("parse error"));
1478 { yyval.id = yyvsp[0].id; ;
1482 { yyval.id = yyvsp[0].id; ;
1487 yyval.id = (yyvsp[0].cbuf)->str;
1488 g_string_free(yyvsp[0].cbuf,FALSE);
1497 { yyval.id = NULL; ;
1501 { has_this = FALSE; ;
1507 if(strcmp(yyvsp[0].id,"this")==0)
1508 push_this(yyvsp[0].id);
1510 g_free(yyvsp[0].id);
1511 yyerror(_("parse error"));
1520 if(strcmp(yyvsp[-2].id,"this")==0)
1521 push_this(yyvsp[-2].id);
1523 g_free(yyvsp[-2].id);
1524 yyerror(_("parse error"));
1531 { has_this = FALSE; ;
1544 push_funcarg(yyvsp[0].id);
1550 push_funcarg(yyvsp[-4].id);
1564 Node *node = new_check(NULL_CHECK,NULL);
1565 checks = g_list_append(checks,node);
1571 Node *node = new_check(TYPE_CHECK,NULL);
1572 checks = g_list_append(checks,node);
1578 Node *node = new_check(GT_CHECK,yyvsp[0].id);
1579 checks = g_list_append(checks,node);
1585 Node *node = new_check(LT_CHECK,yyvsp[0].id);
1586 checks = g_list_append(checks,node);
1592 Node *node = new_check(GE_CHECK,yyvsp[0].id);
1593 checks = g_list_append(checks,node);
1599 Node *node = new_check(LE_CHECK,yyvsp[0].id);
1600 checks = g_list_append(checks,node);
1606 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
1607 checks = g_list_append(checks,node);
1613 Node *node = new_check(NE_CHECK,yyvsp[0].id);
1614 checks = g_list_append(checks,node);
1619 { yyval.id = yyvsp[0].id; ;
1624 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
1625 g_free(yyvsp[0].id);
1629 /* the action file gets copied in in place of this dollarsign */
1630 #line 542 "/usr/lib/bison.simple"
1641 short *ssp1 = yyss - 1;
1642 fprintf (stderr, "state stack now");
1643 while (ssp1 != yyssp)
1644 fprintf (stderr, " %d", *++ssp1);
1645 fprintf (stderr, "\n");
1655 yylsp->first_line = yylloc.first_line;
1656 yylsp->first_column = yylloc.first_column;
1657 yylsp->last_line = (yylsp-1)->last_line;
1658 yylsp->last_column = (yylsp-1)->last_column;
1663 yylsp->last_line = (yylsp+yylen-1)->last_line;
1664 yylsp->last_column = (yylsp+yylen-1)->last_column;
1668 /* Now "shift" the result of the reduction.
1669 Determine what state that goes to,
1670 based on the state we popped back to
1671 and the rule number reduced by. */
1675 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1676 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1677 yystate = yytable[yystate];
1679 yystate = yydefgoto[yyn - YYNTBASE];
1683 yyerrlab: /* here on detecting error */
1686 /* If not already recovering from an error, report this error. */
1690 #ifdef YYERROR_VERBOSE
1691 yyn = yypact[yystate];
1693 if (yyn > YYFLAG && yyn < YYLAST)
1700 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1701 for (x = (yyn < 0 ? -yyn : 0);
1702 x < (sizeof(yytname) / sizeof(char *)); x++)
1703 if (yycheck[x + yyn] == x)
1704 size += strlen(yytname[x]) + 15, count++;
1705 msg = (char *) malloc(size + 15);
1708 strcpy(msg, "parse error");
1713 for (x = (yyn < 0 ? -yyn : 0);
1714 x < (sizeof(yytname) / sizeof(char *)); x++)
1715 if (yycheck[x + yyn] == x)
1717 strcat(msg, count == 0 ? ", expecting `" : " or `");
1718 strcat(msg, yytname[x]);
1727 yyerror ("parse error; also virtual memory exceeded");
1730 #endif /* YYERROR_VERBOSE */
1731 yyerror("parse error");
1735 yyerrlab1: /* here on error raised explicitly by an action */
1737 if (yyerrstatus == 3)
1739 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1741 /* return failure if at end of input */
1742 if (yychar == YYEOF)
1747 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1753 /* Else will try to reuse lookahead token
1754 after shifting the error token. */
1756 yyerrstatus = 3; /* Each real token shifted decrements this */
1760 yyerrdefault: /* current state does not do anything special for the error token. */
1763 /* This is wrong; only states that explicitly want error tokens
1764 should shift them. */
1765 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1766 if (yyn) goto yydefault;
1769 yyerrpop: /* pop the current state because it cannot handle the error token */
1771 if (yyssp == yyss) YYABORT;
1781 short *ssp1 = yyss - 1;
1782 fprintf (stderr, "Error: state stack now");
1783 while (ssp1 != yyssp)
1784 fprintf (stderr, " %d", *++ssp1);
1785 fprintf (stderr, "\n");
1791 yyn = yypact[yystate];
1796 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1815 fprintf(stderr, "Shifting error token, ");
1827 /* YYACCEPT comes here. */
1839 /* YYABORT comes here. */