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