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