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