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