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