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