]> git.draconx.ca Git - gob-dx.git/blob - src/parse.c
7b6e9ebb38ddef45672c78f546bfd997f0d4b334
[gob-dx.git] / src / parse.c
1
2 /*  A Bison parser, made from parse.y
3     by GNU Bison version 1.28  */
4
5 #define YYBISON 1  /* Identify Bison output.  */
6
7 #define CLASS   257
8 #define FROM    258
9 #define CONST   259
10 #define VOID    260
11 #define STRUCT  261
12 #define UNION   262
13 #define ENUM    263
14 #define THREEDOTS       264
15 #define SIGNED  265
16 #define UNSIGNED        266
17 #define LONG    267
18 #define SHORT   268
19 #define INT     269
20 #define FLOAT   270
21 #define DOUBLE  271
22 #define CHAR    272
23 #define TOKEN   273
24 #define NUMBER  274
25 #define TYPETOKEN       275
26 #define ARRAY_DIM       276
27 #define CCODE   277
28 #define HTCODE  278
29 #define PHCODE  279
30 #define HCODE   280
31 #define ACODE   281
32 #define ATCODE  282
33 #define PUBLIC  283
34 #define PRIVATE 284
35 #define PROTECTED       285
36 #define ARGUMENT        286
37 #define VIRTUAL 287
38 #define SIGNAL  288
39 #define OVERRIDE        289
40
41 #line 21 "parse.y"
42
43
44 #include "config.h"
45 #include <glib.h>
46 #include <stdio.h>
47 #include <string.h>
48
49 #include "treefuncs.h"
50 #include "main.h"
51 #include "util.h"
52
53 #define _(x) (x)
54         
55 GList *nodes = NULL;
56
57 static GList *class_nodes = NULL;
58 Node *class = NULL;
59
60 static GList *typestack = NULL;
61 static int stars = 0;
62 static GList *funcargs = NULL;
63 static GList *checks = NULL;
64 static int has_self = FALSE;
65 static int vararg = FALSE;
66
67 /* destructor and initializer for variables */
68 static char *destructor = NULL;
69 static int destructor_line = 0;
70 static gboolean destructor_simple = TRUE;
71 static char *initializer = NULL;
72 static int initializer_line = 0;
73
74 static char *onerror = NULL;
75 static char *defreturn = NULL;
76
77 static GList *gtktypes = NULL;
78
79 /* this can be a global as we will only do one function at a time
80    anyway */
81 static int the_scope = NO_SCOPE;
82
83 void free(void *ptr);
84 int yylex(void);
85
86 extern int ccode_line;
87 extern int line_no;
88
89 extern char *yytext;
90
91 static void
92 yyerror(char *str)
93 {
94         char *out=NULL;
95         char *p;
96         
97         if(strcmp(yytext,"\n")==0) {
98                 out=g_strconcat("Error: ",str," before newline",NULL);
99         } else if(yytext[0]=='\0') {
100                 out=g_strconcat("Error: ", str, " at end of input", NULL);
101         } else {
102                 char *tmp = g_strdup(yytext);
103                 while((p=strchr(tmp, '\n')))
104                         *p='.';
105
106                 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
107                 g_free(tmp);
108         }
109
110         fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
111         g_free(out);
112         
113         exit(1);
114 }
115
116 static Type *
117 pop_type(void)
118 {
119         Type *type = typestack->data;
120         typestack = g_list_remove(typestack,typestack->data);
121         return type;
122 }
123
124 static void
125 push_variable(char *name, int scope, int line_no, char *postfix)
126 {
127         Node *var;
128         Type *type = pop_type();
129
130         type->postfix = postfix;
131         
132         var = new_variable(scope, type, name, line_no,
133                            destructor, destructor_line,
134                            destructor_simple,
135                            initializer, initializer_line);
136         class_nodes = g_list_append(class_nodes, var);
137 }
138
139 static void
140 push_function(int scope, int method, char *oid, char *id,
141               GString *cbuf, int line_no, int ccode_line,
142               gboolean vararg, GList *flags)
143 {
144         Node *node;
145         Type *type;
146         char *c_cbuf;
147        
148         if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) {
149                 type = pop_type();
150         } else {
151                 type = (Type *)new_type(0,g_strdup("void"),NULL);
152         }
153         
154         /* a complicated and ugly test to figure out if we have
155            the wrong number of types for a signal */
156         if((method == SIGNAL_FIRST_METHOD ||
157             method == SIGNAL_LAST_METHOD) &&
158            g_list_length(gtktypes) != g_list_length(funcargs) &&
159            !(g_list_length(funcargs) == 1 &&
160              g_list_length(gtktypes) == 2 &&
161              strcmp(gtktypes->next->data, "NONE")==0)) {
162                 print_error(TRUE, _("The number of GTK arguments and "
163                                     "function arguments for a signal "
164                                     "don't seem to match"), line_no);
165         }
166         if(g_list_length(gtktypes) > 2) {
167                 GList *li;
168                 for(li = gtktypes->next; li; li = li->next) {
169                         if(strcmp(li->data, "NONE")==0) {
170                                 print_error(FALSE,
171                                             _("NONE can only appear in an "
172                                               "argument list by itself"),
173                                             line_no);
174                         }
175                 }
176         }
177         if(cbuf) {
178                 char *p;
179                 c_cbuf = p = cbuf->str;
180                 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
181                         p++;
182                 if(!p || !*p)
183                         c_cbuf = NULL;
184         } else
185                 c_cbuf = NULL;
186
187         node = new_method(scope, method, type, oid, gtktypes, flags,
188                           id, funcargs, onerror, defreturn, c_cbuf, line_no,
189                           ccode_line, vararg);
190
191         if(cbuf)
192                 g_string_free(cbuf,
193                               /*only free segment if we haven't passed it
194                                 above */
195                               c_cbuf?FALSE:TRUE);
196         gtktypes = NULL;
197         funcargs = NULL;
198
199         onerror = NULL;
200         defreturn = NULL;
201
202         class_nodes = g_list_append(class_nodes, node);
203 }
204
205 static void
206 free_all_global_state(void)
207 {
208         g_free(onerror);
209         onerror = NULL;
210         g_free(defreturn);
211         defreturn = NULL;
212
213         g_list_foreach(gtktypes, (GFunc)g_free, NULL);
214         g_list_free(gtktypes);
215         gtktypes = NULL;
216
217         free_node_list(funcargs);
218         funcargs = NULL;
219 }
220
221 static void
222 push_funcarg(char *name, char *postfix)
223 {
224         Node *node;
225         Type *type = pop_type();
226
227         type->postfix = postfix;
228         
229         node = new_funcarg(type, name, checks);
230         checks = NULL;
231         
232         funcargs = g_list_append(funcargs, node);
233 }
234
235 static void
236 push_init_arg(char *name, int is_class)
237 {
238         Node *node;
239         Node *type;
240         char *tn;
241         
242         if(is_class)
243                 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
244         else
245                 tn = g_strdup(((Class *)class)->otype);
246
247         type = new_type(1,tn,NULL);
248         node = new_funcarg((Type *)type,name,NULL);
249         funcargs = g_list_prepend(funcargs, node);
250 }
251
252 static void
253 push_self(char *id)
254 {
255         Node *node;
256         Node *type;
257         GList *ch = NULL;
258         type = new_type(1,g_strdup(((Class *)class)->otype),NULL);
259         ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
260         ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
261         node = new_funcarg((Type *)type,id,ch);
262         funcargs = g_list_prepend(funcargs, node);
263 }
264
265 static Variable *
266 find_var_or_die(const char *id, int line)
267 {
268         GList *li;
269         char *s;
270
271         for(li = class_nodes; li != NULL; li = li->next) {
272                 Variable *var;
273                 Node *node = li->data;
274                 if(node->type != VARIABLE_NODE)
275                         continue;
276                 var = li->data;
277                 if(strcmp(var->id, id)==0)
278                         return var;
279         }
280
281         s = g_strdup_printf(_("Variable %s not defined here"), id);
282         print_error(FALSE, s, line);
283
284         g_assert_not_reached();
285         return NULL;
286 }
287
288 static gboolean
289 set_return_value(char *type, char *val)
290 {
291         if(strcmp(type, "onerror")==0) {
292                 if(!onerror) {
293                         onerror = val;
294                         return TRUE;
295                 } else
296                         return FALSE;
297         } else if(strcmp(type, "defreturn")==0) {
298                 if(!defreturn) {
299                         defreturn = val;
300                         return TRUE;
301                 } else
302                         return FALSE;
303         }
304         return FALSE;
305 }
306
307
308 #line 288 "parse.y"
309 typedef union {
310         char *id;
311         GString *cbuf;
312         GList *list;
313         int line;
314         int sigtype;
315 } YYSTYPE;
316 #ifndef YYDEBUG
317 #define YYDEBUG 1
318 #endif
319
320 #include <stdio.h>
321
322 #ifndef __cplusplus
323 #ifndef __STDC__
324 #define const
325 #endif
326 #endif
327
328
329
330 #define YYFINAL         242
331 #define YYFLAG          -32768
332 #define YYNTBASE        49
333
334 #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 86)
335
336 static const char yytranslate[] = {     0,
337      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
338      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
339      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
340      2,     2,    47,     2,     2,     2,     2,     2,     2,    40,
341     41,    43,     2,    44,    48,     2,     2,     2,     2,     2,
342      2,     2,     2,     2,     2,     2,     2,     2,    38,    46,
343     39,    45,     2,     2,     2,     2,     2,     2,     2,     2,
344      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
345      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
346      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
347      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
348      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
349      2,     2,    36,    42,    37,     2,     2,     2,     2,     2,
350      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
351      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
352      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
353      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
354      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
355      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
356      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
357      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
358      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
359      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
360      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
361      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
362      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
363      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
364     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
365     27,    28,    29,    30,    31,    32,    33,    34,    35
366 };
367
368 #if YYDEBUG != 0
369 static const short yyprhs[] = {     0,
370      0,     4,     7,    10,    12,    14,    16,    18,    20,    22,
371     24,    27,    29,    34,    38,    43,    46,    48,    50,    52,
372     54,    56,    58,    60,    62,    65,    69,    72,    76,    79,
373     82,    84,    86,    87,    93,   100,   112,   121,   127,   133,
374    135,   139,   140,   144,   146,   148,   151,   153,   156,   159,
375    162,   164,   167,   170,   172,   174,   176,   178,   181,   183,
376    185,   188,   190,   193,   195,   197,   199,   201,   203,   206,
377    208,   211,   213,   217,   221,   224,   226,   231,   235,   237,
378    240,   242,   253,   265,   275,   285,   294,   306,   315,   321,
379    324,   329,   330,   332,   335,   337,   339,   343,   345,   349,
380    351,   355,   357,   360,   364,   371,   379,   382,   384,   386,
381    389,   392,   396,   400,   404,   408,   410,   413
382 };
383
384 static const short yyrhs[] = {    51,
385     52,    51,     0,    52,    51,     0,    51,    52,     0,    52,
386      0,    23,     0,    26,     0,    24,     0,    25,     0,    27,
387      0,    28,     0,    51,    50,     0,    50,     0,    53,    36,
388     54,    37,     0,    53,    36,    37,     0,     3,    21,     4,
389     21,     0,    54,    55,     0,    55,     0,    76,     0,    60,
390      0,    61,     0,    38,     0,    29,     0,    30,     0,    31,
391      0,    19,    19,     0,    19,    36,    23,     0,    39,    85,
392      0,    39,    36,    23,     0,    57,    58,     0,    58,    57,
393      0,    58,     0,    57,     0,     0,    56,    65,    19,    59,
394     38,     0,    56,    65,    19,    22,    59,    38,     0,    32,
395     63,    62,    19,    19,    36,    23,    19,    36,    23,    38,
396      0,    32,    63,    62,    19,    19,    36,    23,    38,     0,
397     32,    63,    62,    19,    19,     0,    19,    40,    19,    65,
398     41,     0,    19,     0,    40,    64,    41,     0,     0,    19,
399     42,    64,     0,    19,     0,    66,     0,     5,    66,     0,
400     67,     0,    67,    70,     0,    12,    68,     0,    11,    68,
401      0,    68,     0,    12,    18,     0,    11,    18,     0,    18,
402      0,    17,     0,    16,     0,    19,     0,    69,    19,     0,
403     21,     0,     6,     0,    13,    15,     0,    13,     0,    14,
404     15,     0,    14,     0,    15,     0,     9,     0,     8,     0,
405      7,     0,    43,    70,     0,    43,     0,    19,    73,     0,
406     73,     0,    56,    19,    73,     0,    19,    56,    73,     0,
407     56,    73,     0,    71,     0,    19,    40,    74,    41,     0,
408     74,    44,    19,     0,    19,     0,    36,    23,     0,    38,
409      0,    34,    63,    72,    65,    19,    40,    79,    41,    77,
410     75,     0,    56,    34,    63,    71,    65,    19,    40,    79,
411     41,    77,    75,     0,    33,    56,    65,    19,    40,    79,
412     41,    77,    75,     0,    56,    33,    65,    19,    40,    79,
413     41,    77,    75,     0,    33,    65,    19,    40,    79,    41,
414     77,    75,     0,    35,    40,    21,    41,    65,    19,    40,
415     79,    41,    77,    75,     0,    56,    65,    19,    40,    79,
416     41,    77,    75,     0,    19,    40,    19,    41,    75,     0,
417     19,    78,     0,    19,    78,    19,    78,     0,     0,    85,
418      0,    36,    23,     0,     6,     0,    19,     0,    19,    44,
419     80,     0,    80,     0,    81,    44,    10,     0,    81,     0,
420     81,    44,    82,     0,    82,     0,    65,    19,     0,    65,
421     19,    22,     0,    65,    19,    40,    19,    83,    41,     0,
422     65,    19,    22,    40,    19,    83,    41,     0,    83,    84,
423      0,    84,     0,    19,     0,    45,    85,     0,    46,    85,
424      0,    45,    39,    85,     0,    46,    39,    85,     0,    39,
425     39,    85,     0,    47,    39,    85,     0,    20,     0,    48,
426     20,     0,    19,     0
427 };
428
429 #endif
430
431 #if YYDEBUG != 0
432 static const short yyrline[] = { 0,
433    306,   307,   308,   309,   312,   318,   324,   330,   336,   342,
434    350,   351,   354,   359,   366,   371,   372,   375,   376,   377,
435    378,   381,   382,   383,   386,   399,   415,   419,   427,   428,
436    429,   430,   431,   437,   440,   444,   479,   507,   572,   581,
437    587,   588,   591,   594,   600,   601,   609,   613,   620,   623,
438    626,   629,   632,   635,   638,   641,   644,   647,   651,   654,
439    659,   662,   665,   668,   671,   676,   679,   682,   687,   688,
440    692,   704,   710,   722,   734,   737,   743,   748,   751,   756,
441    757,   761,   772,   783,   794,   805,   816,   822,   827,   848,
442    859,   878,   884,   885,   891,   892,   903,   913,   916,   917,
443    920,   921,   924,   927,   930,   938,   948,   949,   952,   965,
444    969,   973,   977,   981,   985,   991,   992,   996
445 };
446 #endif
447
448
449 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
450
451 static const char * const yytname[] = {   "$","error","$undefined.","CLASS",
452 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
453 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
454 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
455 "ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='","'('","')'",
456 "'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes","class","classdec",
457 "classcode","thing","scope","destructor","initializer","varoptions","variable",
458 "argument","argtype","flags","flaglist","type","type1","type2","integer","tspecifier",
459 "stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode","method",
460 "returnvals","retcode","funcargs","arglist","arglist1","arg","checklist","check",
461 "numtok", NULL
462 };
463 #endif
464
465 static const short yyr1[] = {     0,
466     49,    49,    49,    49,    50,    50,    50,    50,    50,    50,
467     51,    51,    52,    52,    53,    54,    54,    55,    55,    55,
468     55,    56,    56,    56,    57,    57,    58,    58,    59,    59,
469     59,    59,    59,    60,    60,    61,    61,    61,    62,    62,
470     63,    63,    64,    64,    65,    65,    66,    66,    67,    67,
471     67,    67,    67,    67,    67,    67,    67,    67,    67,    67,
472     68,    68,    68,    68,    68,    69,    69,    69,    70,    70,
473     71,    71,    72,    72,    72,    72,    73,    74,    74,    75,
474     75,    76,    76,    76,    76,    76,    76,    76,    76,    77,
475     77,    77,    78,    78,    79,    79,    79,    79,    80,    80,
476     81,    81,    82,    82,    82,    82,    83,    83,    84,    84,
477     84,    84,    84,    84,    84,    85,    85,    85
478 };
479
480 static const short yyr2[] = {     0,
481      3,     2,     2,     1,     1,     1,     1,     1,     1,     1,
482      2,     1,     4,     3,     4,     2,     1,     1,     1,     1,
483      1,     1,     1,     1,     2,     3,     2,     3,     2,     2,
484      1,     1,     0,     5,     6,    11,     8,     5,     5,     1,
485      3,     0,     3,     1,     1,     2,     1,     2,     2,     2,
486      1,     2,     2,     1,     1,     1,     1,     2,     1,     1,
487      2,     1,     2,     1,     1,     1,     1,     1,     2,     1,
488      2,     1,     3,     3,     2,     1,     4,     3,     1,     2,
489      1,    10,    11,     9,     9,     8,    11,     8,     5,     2,
490      4,     0,     1,     2,     1,     1,     3,     1,     3,     1,
491      3,     1,     2,     3,     6,     7,     2,     1,     1,     2,
492      2,     3,     3,     3,     3,     1,     2,     1
493 };
494
495 static const short yydefact[] = {     0,
496      0,     5,     7,     8,     6,     9,    10,    12,     0,     4,
497      0,     0,    11,     3,     2,     0,     0,     1,     0,    22,
498     23,    24,    42,     0,    42,     0,    14,    21,     0,    17,
499      0,    19,    20,    18,    15,     0,     0,     0,     0,    60,
500     68,    67,    66,     0,     0,    62,    64,    65,    56,    55,
501     54,    57,    59,     0,     0,    45,    47,    51,     0,     0,
502      0,    13,    16,     0,    42,     0,     0,    44,     0,    40,
503      0,    46,    53,    50,    52,    49,    61,    63,     0,     0,
504     70,    48,    58,     0,     0,    76,     0,    72,     0,     0,
505      0,    33,     0,     0,    41,     0,     0,     0,     0,    69,
506      0,     0,     0,    71,     0,    75,     0,     0,     0,     0,
507      0,     0,    33,     0,     0,    32,    31,     0,     0,    81,
508     89,    43,     0,    38,     0,    60,    57,     0,     0,    98,
509    100,   102,    79,     0,    74,    73,     0,     0,     0,     0,
510     25,     0,     0,   118,   116,     0,     0,    27,     0,    29,
511     30,    34,    80,     0,     0,     0,     0,   103,    92,     0,
512     77,     0,     0,     0,     0,     0,    26,    35,    28,   117,
513     92,    39,     0,    92,    97,   104,     0,     0,     0,    99,
514    101,    78,     0,     0,    92,     0,     0,     0,    37,     0,
515      0,     0,     0,    90,    93,    86,    92,     0,     0,     0,
516     88,     0,    84,     0,   109,     0,     0,     0,     0,     0,
517    108,    94,     0,     0,    92,    85,    92,     0,     0,     0,
518      0,   110,     0,   111,     0,   105,   107,    91,    82,     0,
519      0,    36,   106,   114,   112,   113,   115,    87,    83,     0,
520      0,     0
521 };
522
523 static const short yydefgoto[] = {   240,
524      8,     9,    10,    11,    29,    30,    31,   116,   117,   118,
525     32,    33,    71,    38,    69,   128,    56,    57,    58,    59,
526     82,    86,    87,    88,   134,   121,    34,   179,   194,   129,
527    130,   131,   132,   210,   211,   195
528 };
529
530 static const short yypact[] = {   136,
531    -17,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   136,   167,
532    -16,    13,-32768,   167,   167,   150,    15,   167,    19,-32768,
533 -32768,-32768,    27,   137,    27,    37,-32768,-32768,   170,-32768,
534    107,-32768,-32768,-32768,-32768,    25,    61,    98,   254,-32768,
535 -32768,-32768,-32768,   263,   269,   114,   118,-32768,-32768,-32768,
536 -32768,-32768,-32768,   221,   116,-32768,   104,-32768,   138,    73,
537    151,-32768,-32768,   221,    27,   154,   133,   155,   157,   156,
538    159,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   187,   184,
539    104,-32768,-32768,   146,   212,-32768,   221,-32768,   200,   229,
540    239,    43,    96,    61,-32768,   245,   255,   240,   238,-32768,
541    246,   260,   266,-32768,    -8,-32768,   270,   221,   248,    -8,
542    221,    36,     3,    -1,   238,   251,   272,   256,   273,-32768,
543 -32768,-32768,   221,   257,   238,   258,    57,   276,   259,-32768,
544    253,-32768,-32768,    64,-32768,-32768,   252,   279,   238,   282,
545 -32768,   280,   264,-32768,-32768,   281,   285,-32768,   265,-32768,
546 -32768,-32768,-32768,   267,   284,   268,   221,     5,   291,   204,
547 -32768,   292,   238,   274,   271,   275,-32768,-32768,-32768,-32768,
548    291,-32768,   -10,   291,-32768,   277,   294,    18,    96,-32768,
549 -32768,-32768,   278,   238,   291,   238,    96,   286,-32768,    96,
550    297,    91,   295,   301,-32768,-32768,   291,   283,    96,   287,
551 -32768,   298,-32768,    91,-32768,   288,    -5,    10,   290,    29,
552 -32768,-32768,    18,    96,   291,-32768,   291,   293,    50,     4,
553      4,-32768,     4,-32768,     4,-32768,-32768,-32768,-32768,    96,
554     96,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   323,
555    325,-32768
556 };
557
558 static const short yypgoto[] = {-32768,
559     69,   117,   317,-32768,-32768,   303,   -21,   213,   217,   222,
560 -32768,-32768,-32768,   -19,   242,   -23,   299,-32768,   126,-32768,
561    261,   243,-32768,   -24,-32768,  -174,-32768,  -164,   124,  -113,
562    182,-32768,   180,   139,  -120,  -114
563 };
564
565
566 #define YYLAST          343
567
568
569 static const short yytable[] = {   148,
570     55,   149,    54,    12,   196,    60,   187,    66,   188,   190,
571    101,   156,   201,   144,   145,   203,    17,   144,   145,    16,
572    199,   112,   144,   145,   216,   165,   176,   189,   144,   145,
573     79,   102,   214,   221,   146,    35,   144,   145,    85,   229,
574     90,   114,   147,    67,   177,    91,   147,   205,   223,   183,
575    230,   147,   231,   193,   141,   238,   239,   147,    36,   104,
576    106,   112,   103,   107,   113,   147,    37,   206,   205,   226,
577    198,   142,   200,   207,   208,   209,    61,    13,   135,    68,
578    136,   114,   115,    13,   138,   104,    13,   140,   206,   227,
579    233,    84,   222,   224,   207,   208,   209,   -96,   227,   154,
580    157,    20,    21,    22,   161,   234,   235,   162,   236,   205,
581    237,    39,    40,    41,    42,    43,    70,    44,    45,    46,
582     47,    48,    49,    50,    51,    52,    15,    53,    77,   206,
583     18,   119,    78,   120,    80,   207,   208,   209,     1,    64,
584     65,    39,    40,    41,    42,    43,    81,    44,    45,    46,
585     47,    48,    49,    50,    51,    52,    83,    53,     2,     3,
586      4,     5,     6,     7,   101,    20,    21,    22,    19,    74,
587     76,    89,    92,    93,    20,    21,    22,    97,    20,    21,
588     22,    23,    24,    25,    26,   102,    27,    28,    19,     2,
589      3,     4,     5,     6,     7,    96,    94,    95,    20,    21,
590     22,    23,    24,    25,    26,    98,    62,    28,    39,    40,
591     41,    42,    43,   180,    44,    45,    46,    47,    48,    49,
592     50,    51,    52,    99,    53,    39,    40,    41,    42,    43,
593    105,    44,    45,    46,    47,    48,    49,    50,    51,    52,
594    108,    53,    39,   126,    41,    42,    43,   109,    44,    45,
595     46,    47,    48,    49,    50,    51,   127,   110,    53,    40,
596     41,    42,    43,   123,    44,    45,    46,    47,    48,    49,
597     50,    51,    52,   124,    53,    46,    47,    48,   133,   125,
598     73,    46,    47,    48,   101,   102,    75,   139,   137,   114,
599    112,   163,   155,   152,   158,   153,   160,   164,   -95,   159,
600    166,   168,   167,   169,   170,   171,   173,   172,   174,   178,
601    182,   185,   192,   184,   186,   204,   191,   212,   197,   213,
602    218,   202,   241,   215,   242,    14,   220,   217,   225,   151,
603    232,    63,   150,   111,   143,   122,   228,    72,   175,   181,
604      0,   100,   219
605 };
606
607 static const short yycheck[] = {   114,
608     24,   115,    24,    21,   179,    25,   171,    31,    19,   174,
609     19,   125,   187,    19,    20,   190,     4,    19,    20,    36,
610    185,    19,    19,    20,   199,   139,    22,    38,    19,    20,
611     54,    40,   197,    39,    36,    21,    19,    20,    60,   214,
612     64,    39,    48,    19,    40,    65,    48,    19,    39,   163,
613    215,    48,   217,    36,    19,   230,   231,    48,    40,    84,
614     85,    19,    84,    87,    22,    48,    40,    39,    19,    41,
615    184,    36,   186,    45,    46,    47,    40,     9,   103,    19,
616    105,    39,    40,    15,   108,   110,    18,   111,    39,   210,
617     41,    19,   207,   208,    45,    46,    47,    41,   219,   123,
618     44,    29,    30,    31,    41,   220,   221,    44,   223,    19,
619    225,     5,     6,     7,     8,     9,    19,    11,    12,    13,
620     14,    15,    16,    17,    18,    19,    10,    21,    15,    39,
621     14,    36,    15,    38,    19,    45,    46,    47,     3,    33,
622     34,     5,     6,     7,     8,     9,    43,    11,    12,    13,
623     14,    15,    16,    17,    18,    19,    19,    21,    23,    24,
624     25,    26,    27,    28,    19,    29,    30,    31,    19,    44,
625     45,    21,    19,    41,    29,    30,    31,    19,    29,    30,
626     31,    32,    33,    34,    35,    40,    37,    38,    19,    23,
627     24,    25,    26,    27,    28,    40,    42,    41,    29,    30,
628     31,    32,    33,    34,    35,    19,    37,    38,     5,     6,
629      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
630     17,    18,    19,    40,    21,     5,     6,     7,     8,     9,
631     19,    11,    12,    13,    14,    15,    16,    17,    18,    19,
632     41,    21,     5,     6,     7,     8,     9,    19,    11,    12,
633     13,    14,    15,    16,    17,    18,    19,    19,    21,     6,
634      7,     8,     9,    19,    11,    12,    13,    14,    15,    16,
635     17,    18,    19,    19,    21,    13,    14,    15,    19,    40,
636     18,    13,    14,    15,    19,    40,    18,    40,    19,    39,
637     19,    40,    36,    38,    19,    23,    44,    19,    41,    41,
638     19,    38,    23,    23,    20,    41,    23,    41,    41,    19,
639     19,    41,    19,    40,    40,    19,    40,    23,    41,    19,
640     23,    36,     0,    41,     0,     9,    39,    41,    39,   117,
641     38,    29,   116,    91,   113,    94,   213,    39,   157,   160,
642     -1,    81,   204
643 };
644 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
645 #line 3 "/usr/lib/bison.simple"
646 /* This file comes from bison-1.28.  */
647
648 /* Skeleton output parser for bison,
649    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
650
651    This program is free software; you can redistribute it and/or modify
652    it under the terms of the GNU General Public License as published by
653    the Free Software Foundation; either version 2, or (at your option)
654    any later version.
655
656    This program is distributed in the hope that it will be useful,
657    but WITHOUT ANY WARRANTY; without even the implied warranty of
658    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
659    GNU General Public License for more details.
660
661    You should have received a copy of the GNU General Public License
662    along with this program; if not, write to the Free Software
663    Foundation, Inc., 59 Temple Place - Suite 330,
664    Boston, MA 02111-1307, USA.  */
665
666 /* As a special exception, when this file is copied by Bison into a
667    Bison output file, you may use that output file without restriction.
668    This special exception was added by the Free Software Foundation
669    in version 1.24 of Bison.  */
670
671 /* This is the parser code that is written into each bison parser
672   when the %semantic_parser declaration is not specified in the grammar.
673   It was written by Richard Stallman by simplifying the hairy parser
674   used when %semantic_parser is specified.  */
675
676 #ifndef YYSTACK_USE_ALLOCA
677 #ifdef alloca
678 #define YYSTACK_USE_ALLOCA
679 #else /* alloca not defined */
680 #ifdef __GNUC__
681 #define YYSTACK_USE_ALLOCA
682 #define alloca __builtin_alloca
683 #else /* not GNU C.  */
684 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
685 #define YYSTACK_USE_ALLOCA
686 #include <alloca.h>
687 #else /* not sparc */
688 /* We think this test detects Watcom and Microsoft C.  */
689 /* This used to test MSDOS, but that is a bad idea
690    since that symbol is in the user namespace.  */
691 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
692 #if 0 /* No need for malloc.h, which pollutes the namespace;
693          instead, just don't use alloca.  */
694 #include <malloc.h>
695 #endif
696 #else /* not MSDOS, or __TURBOC__ */
697 #if defined(_AIX)
698 /* I don't know what this was needed for, but it pollutes the namespace.
699    So I turned it off.   rms, 2 May 1997.  */
700 /* #include <malloc.h>  */
701  #pragma alloca
702 #define YYSTACK_USE_ALLOCA
703 #else /* not MSDOS, or __TURBOC__, or _AIX */
704 #if 0
705 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
706                  and on HPUX 10.  Eventually we can turn this on.  */
707 #define YYSTACK_USE_ALLOCA
708 #define alloca __builtin_alloca
709 #endif /* __hpux */
710 #endif
711 #endif /* not _AIX */
712 #endif /* not MSDOS, or __TURBOC__ */
713 #endif /* not sparc */
714 #endif /* not GNU C */
715 #endif /* alloca not defined */
716 #endif /* YYSTACK_USE_ALLOCA not defined */
717
718 #ifdef YYSTACK_USE_ALLOCA
719 #define YYSTACK_ALLOC alloca
720 #else
721 #define YYSTACK_ALLOC malloc
722 #endif
723
724 /* Note: there must be only one dollar sign in this file.
725    It is replaced by the list of actions, each action
726    as one case of the switch.  */
727
728 #define yyerrok         (yyerrstatus = 0)
729 #define yyclearin       (yychar = YYEMPTY)
730 #define YYEMPTY         -2
731 #define YYEOF           0
732 #define YYACCEPT        goto yyacceptlab
733 #define YYABORT         goto yyabortlab
734 #define YYERROR         goto yyerrlab1
735 /* Like YYERROR except do call yyerror.
736    This remains here temporarily to ease the
737    transition to the new meaning of YYERROR, for GCC.
738    Once GCC version 2 has supplanted version 1, this can go.  */
739 #define YYFAIL          goto yyerrlab
740 #define YYRECOVERING()  (!!yyerrstatus)
741 #define YYBACKUP(token, value) \
742 do                                                              \
743   if (yychar == YYEMPTY && yylen == 1)                          \
744     { yychar = (token), yylval = (value);                       \
745       yychar1 = YYTRANSLATE (yychar);                           \
746       YYPOPSTACK;                                               \
747       goto yybackup;                                            \
748     }                                                           \
749   else                                                          \
750     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
751 while (0)
752
753 #define YYTERROR        1
754 #define YYERRCODE       256
755
756 #ifndef YYPURE
757 #define YYLEX           yylex()
758 #endif
759
760 #ifdef YYPURE
761 #ifdef YYLSP_NEEDED
762 #ifdef YYLEX_PARAM
763 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
764 #else
765 #define YYLEX           yylex(&yylval, &yylloc)
766 #endif
767 #else /* not YYLSP_NEEDED */
768 #ifdef YYLEX_PARAM
769 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
770 #else
771 #define YYLEX           yylex(&yylval)
772 #endif
773 #endif /* not YYLSP_NEEDED */
774 #endif
775
776 /* If nonreentrant, generate the variables here */
777
778 #ifndef YYPURE
779
780 int     yychar;                 /*  the lookahead symbol                */
781 YYSTYPE yylval;                 /*  the semantic value of the           */
782                                 /*  lookahead symbol                    */
783
784 #ifdef YYLSP_NEEDED
785 YYLTYPE yylloc;                 /*  location data for the lookahead     */
786                                 /*  symbol                              */
787 #endif
788
789 int yynerrs;                    /*  number of parse errors so far       */
790 #endif  /* not YYPURE */
791
792 #if YYDEBUG != 0
793 int yydebug;                    /*  nonzero means print parse trace     */
794 /* Since this is uninitialized, it does not stop multiple parsers
795    from coexisting.  */
796 #endif
797
798 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
799
800 #ifndef YYINITDEPTH
801 #define YYINITDEPTH 200
802 #endif
803
804 /*  YYMAXDEPTH is the maximum size the stacks can grow to
805     (effective only if the built-in stack extension method is used).  */
806
807 #if YYMAXDEPTH == 0
808 #undef YYMAXDEPTH
809 #endif
810
811 #ifndef YYMAXDEPTH
812 #define YYMAXDEPTH 10000
813 #endif
814 \f
815 /* Define __yy_memcpy.  Note that the size argument
816    should be passed with type unsigned int, because that is what the non-GCC
817    definitions require.  With GCC, __builtin_memcpy takes an arg
818    of type size_t, but it can handle unsigned int.  */
819
820 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
821 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
822 #else                           /* not GNU C or C++ */
823 #ifndef __cplusplus
824
825 /* This is the most reliable way to avoid incompatibilities
826    in available built-in functions on various systems.  */
827 static void
828 __yy_memcpy (to, from, count)
829      char *to;
830      char *from;
831      unsigned int count;
832 {
833   register char *f = from;
834   register char *t = to;
835   register int i = count;
836
837   while (i-- > 0)
838     *t++ = *f++;
839 }
840
841 #else /* __cplusplus */
842
843 /* This is the most reliable way to avoid incompatibilities
844    in available built-in functions on various systems.  */
845 static void
846 __yy_memcpy (char *to, char *from, unsigned int count)
847 {
848   register char *t = to;
849   register char *f = from;
850   register int i = count;
851
852   while (i-- > 0)
853     *t++ = *f++;
854 }
855
856 #endif
857 #endif
858 \f
859 #line 217 "/usr/lib/bison.simple"
860
861 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
862    into yyparse.  The argument should have type void *.
863    It should actually point to an object.
864    Grammar actions can access the variable by casting it
865    to the proper pointer type.  */
866
867 #ifdef YYPARSE_PARAM
868 #ifdef __cplusplus
869 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
870 #define YYPARSE_PARAM_DECL
871 #else /* not __cplusplus */
872 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
873 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
874 #endif /* not __cplusplus */
875 #else /* not YYPARSE_PARAM */
876 #define YYPARSE_PARAM_ARG
877 #define YYPARSE_PARAM_DECL
878 #endif /* not YYPARSE_PARAM */
879
880 /* Prevent warning if -Wstrict-prototypes.  */
881 #ifdef __GNUC__
882 #ifdef YYPARSE_PARAM
883 int yyparse (void *);
884 #else
885 int yyparse (void);
886 #endif
887 #endif
888
889 int
890 yyparse(YYPARSE_PARAM_ARG)
891      YYPARSE_PARAM_DECL
892 {
893   register int yystate;
894   register int yyn;
895   register short *yyssp;
896   register YYSTYPE *yyvsp;
897   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
898   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
899
900   short yyssa[YYINITDEPTH];     /*  the state stack                     */
901   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
902
903   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
904   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
905
906 #ifdef YYLSP_NEEDED
907   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
908   YYLTYPE *yyls = yylsa;
909   YYLTYPE *yylsp;
910
911 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
912 #else
913 #define YYPOPSTACK   (yyvsp--, yyssp--)
914 #endif
915
916   int yystacksize = YYINITDEPTH;
917   int yyfree_stacks = 0;
918
919 #ifdef YYPURE
920   int yychar;
921   YYSTYPE yylval;
922   int yynerrs;
923 #ifdef YYLSP_NEEDED
924   YYLTYPE yylloc;
925 #endif
926 #endif
927
928   YYSTYPE yyval;                /*  the variable used to return         */
929                                 /*  semantic values from the action     */
930                                 /*  routines                            */
931
932   int yylen;
933
934 #if YYDEBUG != 0
935   if (yydebug)
936     fprintf(stderr, "Starting parse\n");
937 #endif
938
939   yystate = 0;
940   yyerrstatus = 0;
941   yynerrs = 0;
942   yychar = YYEMPTY;             /* Cause a token to be read.  */
943
944   /* Initialize stack pointers.
945      Waste one element of value and location stack
946      so that they stay on the same level as the state stack.
947      The wasted elements are never initialized.  */
948
949   yyssp = yyss - 1;
950   yyvsp = yyvs;
951 #ifdef YYLSP_NEEDED
952   yylsp = yyls;
953 #endif
954
955 /* Push a new state, which is found in  yystate  .  */
956 /* In all cases, when you get here, the value and location stacks
957    have just been pushed. so pushing a state here evens the stacks.  */
958 yynewstate:
959
960   *++yyssp = yystate;
961
962   if (yyssp >= yyss + yystacksize - 1)
963     {
964       /* Give user a chance to reallocate the stack */
965       /* Use copies of these so that the &'s don't force the real ones into memory. */
966       YYSTYPE *yyvs1 = yyvs;
967       short *yyss1 = yyss;
968 #ifdef YYLSP_NEEDED
969       YYLTYPE *yyls1 = yyls;
970 #endif
971
972       /* Get the current used size of the three stacks, in elements.  */
973       int size = yyssp - yyss + 1;
974
975 #ifdef yyoverflow
976       /* Each stack pointer address is followed by the size of
977          the data in use in that stack, in bytes.  */
978 #ifdef YYLSP_NEEDED
979       /* This used to be a conditional around just the two extra args,
980          but that might be undefined if yyoverflow is a macro.  */
981       yyoverflow("parser stack overflow",
982                  &yyss1, size * sizeof (*yyssp),
983                  &yyvs1, size * sizeof (*yyvsp),
984                  &yyls1, size * sizeof (*yylsp),
985                  &yystacksize);
986 #else
987       yyoverflow("parser stack overflow",
988                  &yyss1, size * sizeof (*yyssp),
989                  &yyvs1, size * sizeof (*yyvsp),
990                  &yystacksize);
991 #endif
992
993       yyss = yyss1; yyvs = yyvs1;
994 #ifdef YYLSP_NEEDED
995       yyls = yyls1;
996 #endif
997 #else /* no yyoverflow */
998       /* Extend the stack our own way.  */
999       if (yystacksize >= YYMAXDEPTH)
1000         {
1001           yyerror("parser stack overflow");
1002           if (yyfree_stacks)
1003             {
1004               free (yyss);
1005               free (yyvs);
1006 #ifdef YYLSP_NEEDED
1007               free (yyls);
1008 #endif
1009             }
1010           return 2;
1011         }
1012       yystacksize *= 2;
1013       if (yystacksize > YYMAXDEPTH)
1014         yystacksize = YYMAXDEPTH;
1015 #ifndef YYSTACK_USE_ALLOCA
1016       yyfree_stacks = 1;
1017 #endif
1018       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1019       __yy_memcpy ((char *)yyss, (char *)yyss1,
1020                    size * (unsigned int) sizeof (*yyssp));
1021       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1022       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1023                    size * (unsigned int) sizeof (*yyvsp));
1024 #ifdef YYLSP_NEEDED
1025       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1026       __yy_memcpy ((char *)yyls, (char *)yyls1,
1027                    size * (unsigned int) sizeof (*yylsp));
1028 #endif
1029 #endif /* no yyoverflow */
1030
1031       yyssp = yyss + size - 1;
1032       yyvsp = yyvs + size - 1;
1033 #ifdef YYLSP_NEEDED
1034       yylsp = yyls + size - 1;
1035 #endif
1036
1037 #if YYDEBUG != 0
1038       if (yydebug)
1039         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1040 #endif
1041
1042       if (yyssp >= yyss + yystacksize - 1)
1043         YYABORT;
1044     }
1045
1046 #if YYDEBUG != 0
1047   if (yydebug)
1048     fprintf(stderr, "Entering state %d\n", yystate);
1049 #endif
1050
1051   goto yybackup;
1052  yybackup:
1053
1054 /* Do appropriate processing given the current state.  */
1055 /* Read a lookahead token if we need one and don't already have one.  */
1056 /* yyresume: */
1057
1058   /* First try to decide what to do without reference to lookahead token.  */
1059
1060   yyn = yypact[yystate];
1061   if (yyn == YYFLAG)
1062     goto yydefault;
1063
1064   /* Not known => get a lookahead token if don't already have one.  */
1065
1066   /* yychar is either YYEMPTY or YYEOF
1067      or a valid token in external form.  */
1068
1069   if (yychar == YYEMPTY)
1070     {
1071 #if YYDEBUG != 0
1072       if (yydebug)
1073         fprintf(stderr, "Reading a token: ");
1074 #endif
1075       yychar = YYLEX;
1076     }
1077
1078   /* Convert token to internal form (in yychar1) for indexing tables with */
1079
1080   if (yychar <= 0)              /* This means end of input. */
1081     {
1082       yychar1 = 0;
1083       yychar = YYEOF;           /* Don't call YYLEX any more */
1084
1085 #if YYDEBUG != 0
1086       if (yydebug)
1087         fprintf(stderr, "Now at end of input.\n");
1088 #endif
1089     }
1090   else
1091     {
1092       yychar1 = YYTRANSLATE(yychar);
1093
1094 #if YYDEBUG != 0
1095       if (yydebug)
1096         {
1097           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1098           /* Give the individual parser a way to print the precise meaning
1099              of a token, for further debugging info.  */
1100 #ifdef YYPRINT
1101           YYPRINT (stderr, yychar, yylval);
1102 #endif
1103           fprintf (stderr, ")\n");
1104         }
1105 #endif
1106     }
1107
1108   yyn += yychar1;
1109   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1110     goto yydefault;
1111
1112   yyn = yytable[yyn];
1113
1114   /* yyn is what to do for this token type in this state.
1115      Negative => reduce, -yyn is rule number.
1116      Positive => shift, yyn is new state.
1117        New state is final state => don't bother to shift,
1118        just return success.
1119      0, or most negative number => error.  */
1120
1121   if (yyn < 0)
1122     {
1123       if (yyn == YYFLAG)
1124         goto yyerrlab;
1125       yyn = -yyn;
1126       goto yyreduce;
1127     }
1128   else if (yyn == 0)
1129     goto yyerrlab;
1130
1131   if (yyn == YYFINAL)
1132     YYACCEPT;
1133
1134   /* Shift the lookahead token.  */
1135
1136 #if YYDEBUG != 0
1137   if (yydebug)
1138     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1139 #endif
1140
1141   /* Discard the token being shifted unless it is eof.  */
1142   if (yychar != YYEOF)
1143     yychar = YYEMPTY;
1144
1145   *++yyvsp = yylval;
1146 #ifdef YYLSP_NEEDED
1147   *++yylsp = yylloc;
1148 #endif
1149
1150   /* count tokens shifted since error; after three, turn off error status.  */
1151   if (yyerrstatus) yyerrstatus--;
1152
1153   yystate = yyn;
1154   goto yynewstate;
1155
1156 /* Do the default action for the current state.  */
1157 yydefault:
1158
1159   yyn = yydefact[yystate];
1160   if (yyn == 0)
1161     goto yyerrlab;
1162
1163 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
1164 yyreduce:
1165   yylen = yyr2[yyn];
1166   if (yylen > 0)
1167     yyval = yyvsp[1-yylen]; /* implement default value of the action */
1168
1169 #if YYDEBUG != 0
1170   if (yydebug)
1171     {
1172       int i;
1173
1174       fprintf (stderr, "Reducing via rule %d (line %d), ",
1175                yyn, yyrline[yyn]);
1176
1177       /* Print the symbols being reduced, and their result.  */
1178       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1179         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1180       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1181     }
1182 #endif
1183
1184
1185   switch (yyn) {
1186
1187 case 1:
1188 #line 306 "parse.y"
1189 { ; ;
1190     break;}
1191 case 2:
1192 #line 307 "parse.y"
1193 { ; ;
1194     break;}
1195 case 3:
1196 #line 308 "parse.y"
1197 { ; ;
1198     break;}
1199 case 4:
1200 #line 309 "parse.y"
1201 { ; ;
1202     break;}
1203 case 5:
1204 #line 312 "parse.y"
1205 {
1206                         Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1207                                                ccode_line);
1208                         nodes = g_list_append(nodes,node);
1209                         g_string_free(yyvsp[0].cbuf,FALSE);
1210                                         ;
1211     break;}
1212 case 6:
1213 #line 318 "parse.y"
1214 {
1215                         Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1216                                                ccode_line);
1217                         nodes = g_list_append(nodes,node);
1218                         g_string_free(yyvsp[0].cbuf,FALSE);
1219                                         ;
1220     break;}
1221 case 7:
1222 #line 324 "parse.y"
1223 {
1224                         Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1225                                                ccode_line);
1226                         nodes = g_list_append(nodes,node);
1227                         g_string_free(yyvsp[0].cbuf,FALSE);
1228                                         ;
1229     break;}
1230 case 8:
1231 #line 330 "parse.y"
1232 {
1233                         Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1234                                                ccode_line);
1235                         nodes = g_list_append(nodes,node);
1236                         g_string_free(yyvsp[0].cbuf,FALSE);
1237                                         ;
1238     break;}
1239 case 9:
1240 #line 336 "parse.y"
1241 {
1242                         Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1243                                                ccode_line);
1244                         nodes = g_list_append(nodes,node);
1245                         g_string_free(yyvsp[0].cbuf,FALSE);
1246                                         ;
1247     break;}
1248 case 10:
1249 #line 342 "parse.y"
1250 {
1251                         Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1252                                                ccode_line);
1253                         nodes = g_list_append(nodes,node);
1254                         g_string_free(yyvsp[0].cbuf,FALSE);
1255                                         ;
1256     break;}
1257 case 11:
1258 #line 350 "parse.y"
1259 { ; ;
1260     break;}
1261 case 12:
1262 #line 351 "parse.y"
1263 { ; ;
1264     break;}
1265 case 13:
1266 #line 354 "parse.y"
1267 {
1268                         ((Class *)class)->nodes = class_nodes;
1269                         class_nodes = NULL;
1270                         nodes = g_list_append(nodes,class);
1271                                                 ;
1272     break;}
1273 case 14:
1274 #line 359 "parse.y"
1275 {
1276                         ((Class *)class)->nodes = NULL;
1277                         class_nodes = NULL;
1278                         nodes = g_list_append(nodes,class);
1279                                                 ;
1280     break;}
1281 case 15:
1282 #line 366 "parse.y"
1283 {
1284                         class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1285                                                 ;
1286     break;}
1287 case 16:
1288 #line 371 "parse.y"
1289 { ; ;
1290     break;}
1291 case 17:
1292 #line 372 "parse.y"
1293 { ; ;
1294     break;}
1295 case 18:
1296 #line 375 "parse.y"
1297 { ; ;
1298     break;}
1299 case 19:
1300 #line 376 "parse.y"
1301 { ; ;
1302     break;}
1303 case 20:
1304 #line 377 "parse.y"
1305 { ; ;
1306     break;}
1307 case 21:
1308 #line 378 "parse.y"
1309 { ; ;
1310     break;}
1311 case 22:
1312 #line 381 "parse.y"
1313 { the_scope = PUBLIC_SCOPE; ;
1314     break;}
1315 case 23:
1316 #line 382 "parse.y"
1317 { the_scope = PRIVATE_SCOPE; ;
1318     break;}
1319 case 24:
1320 #line 383 "parse.y"
1321 { the_scope = PROTECTED_SCOPE; ;
1322     break;}
1323 case 25:
1324 #line 386 "parse.y"
1325 {
1326                         if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1327                                 g_free(yyvsp[-1].id);
1328                                 destructor = yyvsp[0].id;
1329                                 destructor_line = line_no;
1330                                 destructor_simple = TRUE;
1331                         } else {
1332                                 g_free(yyvsp[-1].id);
1333                                 g_free(yyvsp[0].id);
1334                                 yyerror(_("parse error"));
1335                                 YYERROR;
1336                         }
1337                                 ;
1338     break;}
1339 case 26:
1340 #line 399 "parse.y"
1341 {
1342                         if(strcmp(yyvsp[-2].id, "destroy")==0) {
1343                                 g_free(yyvsp[-2].id);
1344                                 destructor = (yyvsp[0].cbuf)->str;
1345                                 g_string_free(yyvsp[0].cbuf, FALSE);
1346                                 destructor_line = ccode_line;
1347                                 destructor_simple = FALSE;
1348                         } else {
1349                                 g_free(yyvsp[-2].id);
1350                                 g_string_free(yyvsp[0].cbuf, TRUE);
1351                                 yyerror(_("parse error"));
1352                                 YYERROR;
1353                         }
1354                                         ;
1355     break;}
1356 case 27:
1357 #line 415 "parse.y"
1358 {
1359                         initializer = yyvsp[0].id;
1360                         initializer_line = ccode_line;
1361                                 ;
1362     break;}
1363 case 28:
1364 #line 419 "parse.y"
1365 {
1366                         initializer = (yyvsp[0].cbuf)->str;
1367                         initializer_line = ccode_line;
1368                         g_string_free(yyvsp[0].cbuf, FALSE);
1369                                 ;
1370     break;}
1371 case 29:
1372 #line 427 "parse.y"
1373 { ; ;
1374     break;}
1375 case 30:
1376 #line 428 "parse.y"
1377 { ; ;
1378     break;}
1379 case 31:
1380 #line 429 "parse.y"
1381 { destructor = NULL; ;
1382     break;}
1383 case 32:
1384 #line 430 "parse.y"
1385 { initializer = NULL; ;
1386     break;}
1387 case 33:
1388 #line 431 "parse.y"
1389 {
1390                         destructor = NULL;
1391                         initializer = NULL;
1392                                         ;
1393     break;}
1394 case 34:
1395 #line 437 "parse.y"
1396 {
1397                         push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1398                                                 ;
1399     break;}
1400 case 35:
1401 #line 440 "parse.y"
1402 {
1403                         push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1404                                                 ;
1405     break;}
1406 case 36:
1407 #line 444 "parse.y"
1408 {
1409                         if(strcmp(yyvsp[-6].id,"get")==0 &&
1410                            strcmp(yyvsp[-3].id,"set")==0) {
1411                                 Node *node;
1412                                 Type *type = pop_type();
1413                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1414                                 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1415                                                     (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1416                                                     (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1417                                                     yyvsp[-10].line);
1418                                 g_string_free(yyvsp[-4].cbuf,FALSE);
1419                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1420                                 class_nodes = g_list_append(class_nodes,node);
1421                         } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1422                                 strcmp(yyvsp[-3].id,"get")==0) {
1423                                 Node *node;
1424                                 Type *type = pop_type();
1425                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1426                                 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1427                                                     (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1428                                                     (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1429                                                     yyvsp[-10].line);
1430                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1431                                 g_string_free(yyvsp[-4].cbuf,FALSE);
1432                                 class_nodes = g_list_append(class_nodes,node);
1433                         } else {
1434                                 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1435                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1436                                 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1437                                 g_string_free(yyvsp[-1].cbuf,TRUE);
1438                                 g_string_free(yyvsp[-4].cbuf,TRUE);
1439                                 yyerror(_("parse error"));
1440                                 YYERROR;
1441                         }
1442                                                 ;
1443     break;}
1444 case 37:
1445 #line 479 "parse.y"
1446 {
1447                         if(strcmp(yyvsp[-3].id,"get")==0) {
1448                                 Node *node;
1449                                 Type *type = pop_type();
1450                                 g_free(yyvsp[-3].id);
1451                                 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1452                                                     (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1453                                                     NULL,0, yyvsp[-7].line);
1454                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1455                                 class_nodes = g_list_append(class_nodes,node);
1456                         } else if(strcmp(yyvsp[-3].id,"set")==0) {
1457                                 Node *node;
1458                                 Type *type = pop_type();
1459                                 g_free(yyvsp[-3].id);
1460                                 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1461                                                     NULL,0,(yyvsp[-1].cbuf)->str,
1462                                                     yyvsp[-2].line, yyvsp[-7].line);
1463                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1464                                 class_nodes = g_list_append(class_nodes,node);
1465                         } else {
1466                                 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1467                                 g_free(yyvsp[-4].id);
1468                                 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1469                                 g_string_free(yyvsp[-1].cbuf,TRUE);
1470                                 yyerror(_("parse error"));
1471                                 YYERROR;
1472                         }
1473                                                 ;
1474     break;}
1475 case 38:
1476 #line 507 "parse.y"
1477 {
1478                         Node *node;
1479                         char *get, *set = NULL;
1480                         Variable *var;
1481                         Type *type;
1482                         char *root;
1483                         
1484                         if(strcmp(yyvsp[0].id,"link")!=0 &&
1485                            strcmp(yyvsp[0].id,"stringlink")!=0 &&
1486                            strcmp(yyvsp[0].id,"objectlink")!=0) {
1487                                 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1488                                 g_free(yyvsp[-1].id);
1489                                 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1490                                 yyerror(_("parse error"));
1491                                 YYERROR;
1492                         }
1493
1494                         type = pop_type();
1495
1496                         var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1497                         if(var->scope == PRIVATE_SCOPE)
1498                                 root = "self->_priv";
1499                         else
1500                                 root = "self";
1501
1502                         if(strcmp(yyvsp[0].id,"link")==0) {
1503                                 set = g_strdup_printf("%s->%s = ARG;",
1504                                                       root, yyvsp[-1].id);
1505                         } else if(strcmp(yyvsp[0].id,"stringlink")==0) {
1506                                 set = g_strdup_printf("g_free(%s->%s); "
1507                                                       "%s->%s = g_strdup(ARG);",
1508                                                       root, yyvsp[-1].id,
1509                                                       root, yyvsp[-1].id);
1510                         } else if(strcmp(yyvsp[0].id,"objectlink")==0) {
1511                                 set = g_strdup_printf(
1512                                   "if(%s->%s) "
1513                                    "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1514                                   "%s->%s = ARG; "
1515                                   "if(%s->%s) "
1516                                    "gtk_object_ref(GTK_OBJECT(%s->%s)); ",
1517                                   root, yyvsp[-1].id,
1518                                   root, yyvsp[-1].id,
1519                                   root, yyvsp[-1].id,
1520                                   root, yyvsp[-1].id,
1521                                   root, yyvsp[-1].id);
1522                         } else {
1523                                 g_assert_not_reached();
1524                         }
1525
1526                         /* get is the same for everything */
1527                         get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1528
1529                         g_free(yyvsp[0].id);
1530
1531
1532                         if(!type)
1533                                 type = copy_type(var->vtype);
1534
1535                         node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1536                                             yyvsp[-1].id, get, yyvsp[-4].line,
1537                                             set, yyvsp[-4].line, yyvsp[-4].line);
1538                         class_nodes = g_list_append(class_nodes,node);
1539                                                 ;
1540     break;}
1541 case 39:
1542 #line 572 "parse.y"
1543 {
1544                         if(strcmp(yyvsp[-2].id,"type")!=0) {
1545                                 g_free(yyvsp[-4].id);
1546                                 g_free(yyvsp[-2].id);
1547                                 yyerror(_("parse error"));
1548                                 YYERROR;
1549                         }
1550                         yyval.id = yyvsp[-4].id;
1551                                                 ;
1552     break;}
1553 case 40:
1554 #line 581 "parse.y"
1555 {
1556                         yyval.id = yyvsp[0].id;
1557                         typestack = g_list_prepend(typestack,NULL);
1558                                                 ;
1559     break;}
1560 case 41:
1561 #line 587 "parse.y"
1562 { yyval.list = yyvsp[-1].list; ;
1563     break;}
1564 case 42:
1565 #line 588 "parse.y"
1566 { yyval.list = NULL; ;
1567     break;}
1568 case 43:
1569 #line 591 "parse.y"
1570 {
1571                         yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1572                                                 ;
1573     break;}
1574 case 44:
1575 #line 594 "parse.y"
1576 {
1577                         yyval.list = g_list_append(NULL,yyvsp[0].id);
1578                                                 ;
1579     break;}
1580 case 45:
1581 #line 600 "parse.y"
1582 { ; ;
1583     break;}
1584 case 46:
1585 #line 601 "parse.y"
1586 {
1587                         Type *type = typestack->data;
1588                         char *oldname = type->name;
1589                         type->name = g_strconcat("const ",oldname,NULL);
1590                         g_free(oldname);
1591                                                 ;
1592     break;}
1593 case 47:
1594 #line 609 "parse.y"
1595 {
1596                         Node *node = new_type(0,yyvsp[0].id,NULL);
1597                         typestack = g_list_prepend(typestack,node);
1598                                                 ;
1599     break;}
1600 case 48:
1601 #line 613 "parse.y"
1602 {
1603                         Node *node = new_type(stars,yyvsp[-1].id,NULL);
1604                         stars = 0;
1605                         typestack = g_list_prepend(typestack,node);
1606                                                 ;
1607     break;}
1608 case 49:
1609 #line 620 "parse.y"
1610 {
1611                         yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1612                                                 ;
1613     break;}
1614 case 50:
1615 #line 623 "parse.y"
1616 {
1617                         yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1618                                                 ;
1619     break;}
1620 case 51:
1621 #line 626 "parse.y"
1622 {
1623                         yyval.id = g_strdup(yyvsp[0].id);
1624                                                 ;
1625     break;}
1626 case 52:
1627 #line 629 "parse.y"
1628 {
1629                         yyval.id = g_strdup("unsigned char");
1630                                                 ;
1631     break;}
1632 case 53:
1633 #line 632 "parse.y"
1634 {
1635                         yyval.id = g_strdup("signed char");
1636                                                 ;
1637     break;}
1638 case 54:
1639 #line 635 "parse.y"
1640 {
1641                         yyval.id = g_strdup("char");
1642                                                 ;
1643     break;}
1644 case 55:
1645 #line 638 "parse.y"
1646 {
1647                         yyval.id = g_strdup("double");
1648                                                 ;
1649     break;}
1650 case 56:
1651 #line 641 "parse.y"
1652 {
1653                         yyval.id = g_strdup("float");
1654                                                 ;
1655     break;}
1656 case 57:
1657 #line 644 "parse.y"
1658 {
1659                         yyval.id = yyvsp[0].id;
1660                                                 ;
1661     break;}
1662 case 58:
1663 #line 647 "parse.y"
1664 {
1665                         yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1666                         g_free(yyvsp[0].id);
1667                                                 ;
1668     break;}
1669 case 59:
1670 #line 651 "parse.y"
1671 {
1672                         yyval.id = yyvsp[0].id;
1673                                                 ;
1674     break;}
1675 case 60:
1676 #line 654 "parse.y"
1677 {
1678                         yyval.id = g_strdup("void");
1679                                                 ;
1680     break;}
1681 case 61:
1682 #line 659 "parse.y"
1683 {
1684                         yyval.id = "long int";
1685                                                 ;
1686     break;}
1687 case 62:
1688 #line 662 "parse.y"
1689 {
1690                         yyval.id = "long";
1691                                                 ;
1692     break;}
1693 case 63:
1694 #line 665 "parse.y"
1695 {
1696                         yyval.id = "short int";
1697                                                 ;
1698     break;}
1699 case 64:
1700 #line 668 "parse.y"
1701 {
1702                         yyval.id = "short";
1703                                                 ;
1704     break;}
1705 case 65:
1706 #line 671 "parse.y"
1707 {
1708                         yyval.id = "int";
1709                                                 ;
1710     break;}
1711 case 66:
1712 #line 676 "parse.y"
1713 {
1714                         yyval.id = "enum ";
1715                                                 ;
1716     break;}
1717 case 67:
1718 #line 679 "parse.y"
1719 {
1720                         yyval.id = "union ";
1721                                                 ;
1722     break;}
1723 case 68:
1724 #line 682 "parse.y"
1725 {
1726                         yyval.id = "struct ";
1727                                                 ;
1728     break;}
1729 case 69:
1730 #line 687 "parse.y"
1731 { stars++; ;
1732     break;}
1733 case 70:
1734 #line 688 "parse.y"
1735 { stars++; ;
1736     break;}
1737 case 71:
1738 #line 692 "parse.y"
1739 {
1740                         if(strcmp(yyvsp[-1].id, "first")==0)
1741                                 yyval.sigtype = SIGNAL_FIRST_METHOD;
1742                         else if(strcmp(yyvsp[-1].id, "last")==0)
1743                                 yyval.sigtype = SIGNAL_LAST_METHOD;
1744                         else {
1745                                 yyerror(_("signal must be 'first' or 'last'"));
1746                                 g_free(yyvsp[-1].id);
1747                                 YYERROR;
1748                         }
1749                         g_free(yyvsp[-1].id);
1750                                         ;
1751     break;}
1752 case 72:
1753 #line 704 "parse.y"
1754 {
1755                         yyval.sigtype = SIGNAL_LAST_METHOD;
1756                                         ;
1757     break;}
1758 case 73:
1759 #line 710 "parse.y"
1760 {
1761                         if(strcmp(yyvsp[-1].id,"first")==0)
1762                                 yyval.sigtype = SIGNAL_FIRST_METHOD;
1763                         else if(strcmp(yyvsp[-1].id,"last")==0)
1764                                 yyval.sigtype = SIGNAL_LAST_METHOD;
1765                         else {
1766                                 yyerror(_("signal must be 'first' or 'last'"));
1767                                 g_free(yyvsp[-1].id);
1768                                 YYERROR;
1769                         }
1770                         g_free(yyvsp[-1].id);
1771                                         ;
1772     break;}
1773 case 74:
1774 #line 722 "parse.y"
1775 {
1776                         if(strcmp(yyvsp[-2].id,"first")==0)
1777                                 yyval.sigtype = SIGNAL_FIRST_METHOD;
1778                         else if(strcmp(yyvsp[-2].id,"last")==0)
1779                                 yyval.sigtype = SIGNAL_LAST_METHOD;
1780                         else {
1781                                 yyerror(_("signal must be 'first' or 'last'"));
1782                                 g_free(yyvsp[-2].id);
1783                                 YYERROR;
1784                         }
1785                         g_free(yyvsp[-2].id);
1786                                         ;
1787     break;}
1788 case 75:
1789 #line 734 "parse.y"
1790 {
1791                         yyval.sigtype = SIGNAL_LAST_METHOD;
1792                                         ;
1793     break;}
1794 case 76:
1795 #line 737 "parse.y"
1796 {
1797                         /* the_scope was default thus public */
1798                         the_scope = PUBLIC_SCOPE;
1799                                         ;
1800     break;}
1801 case 77:
1802 #line 743 "parse.y"
1803 {
1804                         gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1805                                                 ;
1806     break;}
1807 case 78:
1808 #line 748 "parse.y"
1809 {
1810                         gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1811                                                 ;
1812     break;}
1813 case 79:
1814 #line 751 "parse.y"
1815
1816                         gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1817                                                 ;
1818     break;}
1819 case 80:
1820 #line 756 "parse.y"
1821 { yyval.cbuf = yyvsp[0].cbuf; ;
1822     break;}
1823 case 81:
1824 #line 757 "parse.y"
1825 { yyval.cbuf = NULL; ;
1826     break;}
1827 case 82:
1828 #line 761 "parse.y"
1829 {
1830                         if(!has_self) {
1831                                 yyerror(_("signal without 'self' as "
1832                                           "first parameter"));
1833                                 free_all_global_state();
1834                                 YYERROR;
1835                         }
1836                         push_function(the_scope, yyvsp[-7].sigtype,NULL,
1837                                       yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1838                                       ccode_line, vararg, yyvsp[-8].list);
1839                                                                         ;
1840     break;}
1841 case 83:
1842 #line 772 "parse.y"
1843 {
1844                         if(!has_self) {
1845                                 yyerror(_("signal without 'self' as "
1846                                           "first parameter"));
1847                                 free_all_global_state();
1848                                 YYERROR;
1849                         }
1850                         push_function(the_scope, yyvsp[-7].sigtype, NULL,
1851                                       yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1852                                       ccode_line, vararg, yyvsp[-8].list);
1853                                                                         ;
1854     break;}
1855 case 84:
1856 #line 783 "parse.y"
1857 {
1858                         if(!has_self) {
1859                                 yyerror(_("virtual method without 'self' as "
1860                                           "first parameter"));
1861                                 free_all_global_state();
1862                                 YYERROR;
1863                         }
1864                         push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1865                                       yyvsp[0].cbuf, yyvsp[-8].line,
1866                                       ccode_line, vararg, NULL);
1867                                                                         ;
1868     break;}
1869 case 85:
1870 #line 794 "parse.y"
1871 {
1872                         if(!has_self) {
1873                                 yyerror(_("virtual method without 'self' as "
1874                                           "first parameter"));
1875                                 free_all_global_state();
1876                                 YYERROR;
1877                         }
1878                         push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1879                                       yyvsp[0].cbuf, yyvsp[-7].line,
1880                                       ccode_line, vararg, NULL);
1881                                                                         ;
1882     break;}
1883 case 86:
1884 #line 805 "parse.y"
1885 {
1886                         if(!has_self) {
1887                                 yyerror(_("virtual method without 'self' as "
1888                                           "first parameter"));
1889                                 free_all_global_state();
1890                                 YYERROR;
1891                         }
1892                         push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1893                                       yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
1894                                       ccode_line, vararg, NULL);
1895                                                                         ;
1896     break;}
1897 case 87:
1898 #line 816 "parse.y"
1899 {
1900                         push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
1901                                       yyvsp[-5].id, yyvsp[0].cbuf,
1902                                       yyvsp[-10].line, ccode_line,
1903                                       vararg, NULL);
1904                                                                         ;
1905     break;}
1906 case 88:
1907 #line 822 "parse.y"
1908 {
1909                         push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
1910                                       yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
1911                                       vararg, NULL);
1912                                                                 ;
1913     break;}
1914 case 89:
1915 #line 827 "parse.y"
1916 {
1917                         if(strcmp(yyvsp[-4].id, "init")==0) {
1918                                 push_init_arg(yyvsp[-2].id,FALSE);
1919                                 push_function(NO_SCOPE, INIT_METHOD, NULL,
1920                                               yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1921                                               ccode_line, FALSE, NULL);
1922                         } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
1923                                 push_init_arg(yyvsp[-2].id,TRUE);
1924                                 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
1925                                               yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
1926                                               ccode_line, FALSE, NULL);
1927                         } else {
1928                                 g_free(yyvsp[-4].id);
1929                                 g_free(yyvsp[-2].id);
1930                                 g_string_free(yyvsp[-2].cbuf,TRUE);
1931                                 yyerror(_("parse error"));
1932                                 YYERROR;
1933                         }
1934                                                 ;
1935     break;}
1936 case 90:
1937 #line 848 "parse.y"
1938 {
1939                         g_free(onerror); onerror = NULL;
1940                         g_free(defreturn); defreturn = NULL;
1941                         if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1942                                 g_free(yyvsp[-1].id);
1943                                 g_free(yyvsp[0].id);
1944                                 yyerror(_("parse error"));
1945                                 YYERROR;
1946                         }
1947                         g_free(yyvsp[-1].id);
1948                                         ;
1949     break;}
1950 case 91:
1951 #line 859 "parse.y"
1952 {
1953                         g_free(onerror); onerror = NULL;
1954                         g_free(defreturn); defreturn = NULL;
1955                         if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
1956                                 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1957                                 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1958                                 yyerror(_("parse error"));
1959                                 YYERROR;
1960                         }
1961                         if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
1962                                 onerror = defreturn = NULL;
1963                                 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
1964                                 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
1965                                 yyerror(_("parse error"));
1966                                 YYERROR;
1967                         }
1968                         g_free(yyvsp[-3].id);
1969                         g_free(yyvsp[-1].id);
1970                                                 ;
1971     break;}
1972 case 92:
1973 #line 878 "parse.y"
1974 {
1975                         g_free(onerror); onerror = NULL;
1976                         g_free(defreturn); defreturn = NULL;
1977                                         ;
1978     break;}
1979 case 93:
1980 #line 884 "parse.y"
1981 { yyval.id = yyvsp[0].id; ;
1982     break;}
1983 case 94:
1984 #line 885 "parse.y"
1985 {
1986                         yyval.id = (yyvsp[1].cbuf)->str;
1987                         g_string_free(yyvsp[1].cbuf, FALSE);
1988                                         ;
1989     break;}
1990 case 95:
1991 #line 891 "parse.y"
1992 { vararg = FALSE; has_self = FALSE; ;
1993     break;}
1994 case 96:
1995 #line 892 "parse.y"
1996 {
1997                         vararg = FALSE;
1998                         has_self = TRUE;
1999                         if(strcmp(yyvsp[0].id,"self")==0)
2000                                 push_self(yyvsp[0].id);
2001                         else {
2002                                 g_free(yyvsp[0].id);
2003                                 yyerror(_("parse error"));
2004                                 YYERROR;
2005                         }
2006                                         ;
2007     break;}
2008 case 97:
2009 #line 903 "parse.y"
2010 {
2011                         has_self = TRUE;
2012                         if(strcmp(yyvsp[-2].id,"self")==0)
2013                                 push_self(yyvsp[-2].id);
2014                         else {
2015                                 g_free(yyvsp[-2].id);
2016                                 yyerror(_("parse error"));
2017                                 YYERROR;
2018                         }
2019                                         ;
2020     break;}
2021 case 98:
2022 #line 913 "parse.y"
2023 { has_self = FALSE; ;
2024     break;}
2025 case 99:
2026 #line 916 "parse.y"
2027 { vararg = TRUE; ;
2028     break;}
2029 case 100:
2030 #line 917 "parse.y"
2031 { vararg = FALSE; ;
2032     break;}
2033 case 101:
2034 #line 920 "parse.y"
2035 { ; ;
2036     break;}
2037 case 102:
2038 #line 921 "parse.y"
2039 { ; ;
2040     break;}
2041 case 103:
2042 #line 924 "parse.y"
2043 {
2044                         push_funcarg(yyvsp[0].id,NULL);
2045                                                                 ;
2046     break;}
2047 case 104:
2048 #line 927 "parse.y"
2049 {
2050                         push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2051                                                                 ;
2052     break;}
2053 case 105:
2054 #line 930 "parse.y"
2055 {
2056                         if(strcmp(yyvsp[-2].id,"check")!=0) {
2057                                 yyerror(_("parse error"));
2058                                 YYERROR;
2059                         }
2060                         g_free(yyvsp[-2].id);
2061                         push_funcarg(yyvsp[-4].id,NULL);
2062                                                                 ;
2063     break;}
2064 case 106:
2065 #line 938 "parse.y"
2066 {
2067                         if(strcmp(yyvsp[-2].id,"check")!=0) {
2068                                 yyerror(_("parse error"));
2069                                 YYERROR;
2070                         }
2071                         g_free(yyvsp[-2].id);
2072                         push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2073                                                                 ;
2074     break;}
2075 case 107:
2076 #line 948 "parse.y"
2077 { ; ;
2078     break;}
2079 case 108:
2080 #line 949 "parse.y"
2081 { ; ;
2082     break;}
2083 case 109:
2084 #line 952 "parse.y"
2085 {
2086                         if(strcmp(yyvsp[0].id,"type")==0) {
2087                                 Node *node = new_check(TYPE_CHECK,NULL);
2088                                 checks = g_list_append(checks,node);
2089                         } else if(strcmp(yyvsp[0].id,"null")==0) {
2090                                 Node *node = new_check(NULL_CHECK,NULL);
2091                                 checks = g_list_append(checks,node);
2092                         } else {
2093                                 yyerror(_("parse error"));
2094                                 YYERROR;
2095                         }
2096                         g_free(yyvsp[0].id);
2097                                         ;
2098     break;}
2099 case 110:
2100 #line 965 "parse.y"
2101 {
2102                         Node *node = new_check(GT_CHECK,yyvsp[0].id);
2103                         checks = g_list_append(checks,node);
2104                                         ;
2105     break;}
2106 case 111:
2107 #line 969 "parse.y"
2108 {
2109                         Node *node = new_check(LT_CHECK,yyvsp[0].id);
2110                         checks = g_list_append(checks,node);
2111                                         ;
2112     break;}
2113 case 112:
2114 #line 973 "parse.y"
2115 {
2116                         Node *node = new_check(GE_CHECK,yyvsp[0].id);
2117                         checks = g_list_append(checks,node);
2118                                         ;
2119     break;}
2120 case 113:
2121 #line 977 "parse.y"
2122 {
2123                         Node *node = new_check(LE_CHECK,yyvsp[0].id);
2124                         checks = g_list_append(checks,node);
2125                                         ;
2126     break;}
2127 case 114:
2128 #line 981 "parse.y"
2129 {
2130                         Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2131                         checks = g_list_append(checks,node);
2132                                         ;
2133     break;}
2134 case 115:
2135 #line 985 "parse.y"
2136 {
2137                         Node *node = new_check(NE_CHECK,yyvsp[0].id);
2138                         checks = g_list_append(checks,node);
2139                                         ;
2140     break;}
2141 case 116:
2142 #line 991 "parse.y"
2143 { yyval.id = yyvsp[0].id; ;
2144     break;}
2145 case 117:
2146 #line 992 "parse.y"
2147 {
2148                         yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2149                         g_free(yyvsp[0].id);
2150                                         ;
2151     break;}
2152 case 118:
2153 #line 996 "parse.y"
2154 { yyval.id = yyvsp[0].id; ;
2155     break;}
2156 }
2157    /* the action file gets copied in in place of this dollarsign */
2158 #line 543 "/usr/lib/bison.simple"
2159 \f
2160   yyvsp -= yylen;
2161   yyssp -= yylen;
2162 #ifdef YYLSP_NEEDED
2163   yylsp -= yylen;
2164 #endif
2165
2166 #if YYDEBUG != 0
2167   if (yydebug)
2168     {
2169       short *ssp1 = yyss - 1;
2170       fprintf (stderr, "state stack now");
2171       while (ssp1 != yyssp)
2172         fprintf (stderr, " %d", *++ssp1);
2173       fprintf (stderr, "\n");
2174     }
2175 #endif
2176
2177   *++yyvsp = yyval;
2178
2179 #ifdef YYLSP_NEEDED
2180   yylsp++;
2181   if (yylen == 0)
2182     {
2183       yylsp->first_line = yylloc.first_line;
2184       yylsp->first_column = yylloc.first_column;
2185       yylsp->last_line = (yylsp-1)->last_line;
2186       yylsp->last_column = (yylsp-1)->last_column;
2187       yylsp->text = 0;
2188     }
2189   else
2190     {
2191       yylsp->last_line = (yylsp+yylen-1)->last_line;
2192       yylsp->last_column = (yylsp+yylen-1)->last_column;
2193     }
2194 #endif
2195
2196   /* Now "shift" the result of the reduction.
2197      Determine what state that goes to,
2198      based on the state we popped back to
2199      and the rule number reduced by.  */
2200
2201   yyn = yyr1[yyn];
2202
2203   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2204   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2205     yystate = yytable[yystate];
2206   else
2207     yystate = yydefgoto[yyn - YYNTBASE];
2208
2209   goto yynewstate;
2210
2211 yyerrlab:   /* here on detecting error */
2212
2213   if (! yyerrstatus)
2214     /* If not already recovering from an error, report this error.  */
2215     {
2216       ++yynerrs;
2217
2218 #ifdef YYERROR_VERBOSE
2219       yyn = yypact[yystate];
2220
2221       if (yyn > YYFLAG && yyn < YYLAST)
2222         {
2223           int size = 0;
2224           char *msg;
2225           int x, count;
2226
2227           count = 0;
2228           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
2229           for (x = (yyn < 0 ? -yyn : 0);
2230                x < (sizeof(yytname) / sizeof(char *)); x++)
2231             if (yycheck[x + yyn] == x)
2232               size += strlen(yytname[x]) + 15, count++;
2233           msg = (char *) malloc(size + 15);
2234           if (msg != 0)
2235             {
2236               strcpy(msg, "parse error");
2237
2238               if (count < 5)
2239                 {
2240                   count = 0;
2241                   for (x = (yyn < 0 ? -yyn : 0);
2242                        x < (sizeof(yytname) / sizeof(char *)); x++)
2243                     if (yycheck[x + yyn] == x)
2244                       {
2245                         strcat(msg, count == 0 ? ", expecting `" : " or `");
2246                         strcat(msg, yytname[x]);
2247                         strcat(msg, "'");
2248                         count++;
2249                       }
2250                 }
2251               yyerror(msg);
2252               free(msg);
2253             }
2254           else
2255             yyerror ("parse error; also virtual memory exceeded");
2256         }
2257       else
2258 #endif /* YYERROR_VERBOSE */
2259         yyerror("parse error");
2260     }
2261
2262   goto yyerrlab1;
2263 yyerrlab1:   /* here on error raised explicitly by an action */
2264
2265   if (yyerrstatus == 3)
2266     {
2267       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
2268
2269       /* return failure if at end of input */
2270       if (yychar == YYEOF)
2271         YYABORT;
2272
2273 #if YYDEBUG != 0
2274       if (yydebug)
2275         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2276 #endif
2277
2278       yychar = YYEMPTY;
2279     }
2280
2281   /* Else will try to reuse lookahead token
2282      after shifting the error token.  */
2283
2284   yyerrstatus = 3;              /* Each real token shifted decrements this */
2285
2286   goto yyerrhandle;
2287
2288 yyerrdefault:  /* current state does not do anything special for the error token. */
2289
2290 #if 0
2291   /* This is wrong; only states that explicitly want error tokens
2292      should shift them.  */
2293   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
2294   if (yyn) goto yydefault;
2295 #endif
2296
2297 yyerrpop:   /* pop the current state because it cannot handle the error token */
2298
2299   if (yyssp == yyss) YYABORT;
2300   yyvsp--;
2301   yystate = *--yyssp;
2302 #ifdef YYLSP_NEEDED
2303   yylsp--;
2304 #endif
2305
2306 #if YYDEBUG != 0
2307   if (yydebug)
2308     {
2309       short *ssp1 = yyss - 1;
2310       fprintf (stderr, "Error: state stack now");
2311       while (ssp1 != yyssp)
2312         fprintf (stderr, " %d", *++ssp1);
2313       fprintf (stderr, "\n");
2314     }
2315 #endif
2316
2317 yyerrhandle:
2318
2319   yyn = yypact[yystate];
2320   if (yyn == YYFLAG)
2321     goto yyerrdefault;
2322
2323   yyn += YYTERROR;
2324   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2325     goto yyerrdefault;
2326
2327   yyn = yytable[yyn];
2328   if (yyn < 0)
2329     {
2330       if (yyn == YYFLAG)
2331         goto yyerrpop;
2332       yyn = -yyn;
2333       goto yyreduce;
2334     }
2335   else if (yyn == 0)
2336     goto yyerrpop;
2337
2338   if (yyn == YYFINAL)
2339     YYACCEPT;
2340
2341 #if YYDEBUG != 0
2342   if (yydebug)
2343     fprintf(stderr, "Shifting error token, ");
2344 #endif
2345
2346   *++yyvsp = yylval;
2347 #ifdef YYLSP_NEEDED
2348   *++yylsp = yylloc;
2349 #endif
2350
2351   yystate = yyn;
2352   goto yynewstate;
2353
2354  yyacceptlab:
2355   /* YYACCEPT comes here.  */
2356   if (yyfree_stacks)
2357     {
2358       free (yyss);
2359       free (yyvs);
2360 #ifdef YYLSP_NEEDED
2361       free (yyls);
2362 #endif
2363     }
2364   return 0;
2365
2366  yyabortlab:
2367   /* YYABORT comes here.  */
2368   if (yyfree_stacks)
2369     {
2370       free (yyss);
2371       free (yyvs);
2372 #ifdef YYLSP_NEEDED
2373       free (yyls);
2374 #endif
2375     }
2376   return 1;
2377 }
2378 #line 999 "parse.y"
2379