grammar.tab.c revision 1.3 1 /* $NetBSD: grammar.tab.c,v 1.3 2017/06/05 18:54:30 christos Exp $ */
2
3 /* original parser id follows */
4 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
5 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
6
7 #define YYBYACC 1
8 #define YYMAJOR 1
9 #define YYMINOR 9
10 #define YYCHECK "yyyymmdd"
11
12 #define YYEMPTY (-1)
13 #define yyclearin (yychar = YYEMPTY)
14 #define yyerrok (yyerrflag = 0)
15 #define YYRECOVERING() (yyerrflag != 0)
16 #define YYENOMEM (-2)
17 #define YYEOF 0
18 #undef YYBTYACC
19 #define YYBTYACC 0
20 #define YYDEBUGSTR YYPREFIX "debug"
21
22 #ifndef yyparse
23 #define yyparse grammar_parse
24 #endif /* yyparse */
25
26 #ifndef yylex
27 #define yylex grammar_lex
28 #endif /* yylex */
29
30 #ifndef yyerror
31 #define yyerror grammar_error
32 #endif /* yyerror */
33
34 #ifndef yychar
35 #define yychar grammar_char
36 #endif /* yychar */
37
38 #ifndef yyval
39 #define yyval grammar_val
40 #endif /* yyval */
41
42 #ifndef yylval
43 #define yylval grammar_lval
44 #endif /* yylval */
45
46 #ifndef yydebug
47 #define yydebug grammar_debug
48 #endif /* yydebug */
49
50 #ifndef yynerrs
51 #define yynerrs grammar_nerrs
52 #endif /* yynerrs */
53
54 #ifndef yyerrflag
55 #define yyerrflag grammar_errflag
56 #endif /* yyerrflag */
57
58 #ifndef yylhs
59 #define yylhs grammar_lhs
60 #endif /* yylhs */
61
62 #ifndef yylen
63 #define yylen grammar_len
64 #endif /* yylen */
65
66 #ifndef yydefred
67 #define yydefred grammar_defred
68 #endif /* yydefred */
69
70 #ifndef yystos
71 #define yystos grammar_stos
72 #endif /* yystos */
73
74 #ifndef yydgoto
75 #define yydgoto grammar_dgoto
76 #endif /* yydgoto */
77
78 #ifndef yysindex
79 #define yysindex grammar_sindex
80 #endif /* yysindex */
81
82 #ifndef yyrindex
83 #define yyrindex grammar_rindex
84 #endif /* yyrindex */
85
86 #ifndef yygindex
87 #define yygindex grammar_gindex
88 #endif /* yygindex */
89
90 #ifndef yytable
91 #define yytable grammar_table
92 #endif /* yytable */
93
94 #ifndef yycheck
95 #define yycheck grammar_check
96 #endif /* yycheck */
97
98 #ifndef yyname
99 #define yyname grammar_name
100 #endif /* yyname */
101
102 #ifndef yyrule
103 #define yyrule grammar_rule
104 #endif /* yyrule */
105
106 #if YYBTYACC
107
108 #ifndef yycindex
109 #define yycindex grammar_cindex
110 #endif /* yycindex */
111
112 #ifndef yyctable
113 #define yyctable grammar_ctable
114 #endif /* yyctable */
115
116 #endif /* YYBTYACC */
117
118 #define YYPREFIX "grammar_"
119
120 #define YYPURE 0
121
122 #line 9 "grammar.y"
123 #ifdef YYBISON
124 #include <stdlib.h>
125 #define YYSTYPE_IS_DECLARED
126 #define yyerror yaccError
127 #endif
128
129 #if defined(YYBISON) || !defined(YYBYACC)
130 static void yyerror(const char *s);
131 #endif
132 #line 81 "grammar.y"
133 #include <stdio.h>
134 #include <ctype.h>
135 #include <string.h>
136
137 #define OPT_LINTLIBRARY 1
138
139 #ifndef TRUE
140 #define TRUE (1)
141 #endif
142
143 #ifndef FALSE
144 #define FALSE (0)
145 #endif
146
147 /* #include "cproto.h" */
148 #define MAX_TEXT_SIZE 1024
149
150 /* Prototype styles */
151 #if OPT_LINTLIBRARY
152 #define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
153 #define PROTO_LINTLIBRARY -1 /* form lint-library source */
154 #endif
155 #define PROTO_NONE 0 /* do not output any prototypes */
156 #define PROTO_TRADITIONAL 1 /* comment out parameters */
157 #define PROTO_ABSTRACT 2 /* comment out parameter names */
158 #define PROTO_ANSI 3 /* ANSI C prototype */
159
160 typedef int PrototypeStyle;
161
162 typedef char boolean;
163
164 extern boolean types_out;
165 extern PrototypeStyle proto_style;
166
167 #define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
168 #define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY)
169 #define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
170
171 #if OPT_LINTLIBRARY
172 #define FUNC_UNKNOWN -1 /* unspecified */
173 #else
174 #define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
175 #endif
176 #define FUNC_NONE 0 /* not a function definition */
177 #define FUNC_TRADITIONAL 1 /* traditional style */
178 #define FUNC_ANSI 2 /* ANSI style */
179 #define FUNC_BOTH 3 /* both styles */
180
181 typedef int FuncDefStyle;
182
183 /* Source file text */
184 typedef struct text {
185 char text[MAX_TEXT_SIZE]; /* source text */
186 long begin; /* offset in temporary file */
187 } Text;
188
189 /* Declaration specifier flags */
190 #define DS_NONE 0 /* default */
191 #define DS_EXTERN 1 /* contains "extern" specifier */
192 #define DS_STATIC 2 /* contains "static" specifier */
193 #define DS_CHAR 4 /* contains "char" type specifier */
194 #define DS_SHORT 8 /* contains "short" type specifier */
195 #define DS_FLOAT 16 /* contains "float" type specifier */
196 #define DS_INLINE 32 /* contains "inline" specifier */
197 #define DS_JUNK 64 /* we're not interested in this declaration */
198
199 /* This structure stores information about a declaration specifier. */
200 typedef struct decl_spec {
201 unsigned short flags; /* flags defined above */
202 char *text; /* source text */
203 long begin; /* offset in temporary file */
204 } DeclSpec;
205
206 /* This is a list of function parameters. */
207 typedef struct _ParameterList {
208 struct parameter *first; /* pointer to first parameter in list */
209 struct parameter *last; /* pointer to last parameter in list */
210 long begin_comment; /* begin offset of comment */
211 long end_comment; /* end offset of comment */
212 char *comment; /* comment at start of parameter list */
213 } ParameterList;
214
215 /* This structure stores information about a declarator. */
216 typedef struct _Declarator {
217 char *name; /* name of variable or function */
218 char *text; /* source text */
219 long begin; /* offset in temporary file */
220 long begin_comment; /* begin offset of comment */
221 long end_comment; /* end offset of comment */
222 FuncDefStyle func_def; /* style of function definition */
223 ParameterList params; /* function parameters */
224 boolean pointer; /* TRUE if it declares a pointer */
225 struct _Declarator *head; /* head function declarator */
226 struct _Declarator *func_stack; /* stack of function declarators */
227 struct _Declarator *next; /* next declarator in list */
228 } Declarator;
229
230 /* This structure stores information about a function parameter. */
231 typedef struct parameter {
232 struct parameter *next; /* next parameter in list */
233 DeclSpec decl_spec;
234 Declarator *declarator;
235 char *comment; /* comment following the parameter */
236 } Parameter;
237
238 /* This is a list of declarators. */
239 typedef struct declarator_list {
240 Declarator *first; /* pointer to first declarator in list */
241 Declarator *last; /* pointer to last declarator in list */
242 } DeclaratorList;
243
244 /* #include "symbol.h" */
245 typedef struct symbol {
246 struct symbol *next; /* next symbol in list */
247 char *name; /* name of symbol */
248 char *value; /* value of symbol (for defines) */
249 short flags; /* symbol attributes */
250 } Symbol;
251
252 /* parser stack entry type */
253 typedef union {
254 Text text;
255 DeclSpec decl_spec;
256 Parameter *parameter;
257 ParameterList param_list;
258 Declarator *declarator;
259 DeclaratorList decl_list;
260 } YYSTYPE;
261
262 /* The hash table length should be a prime number. */
263 #define SYM_MAX_HASH 251
264
265 typedef struct symbol_table {
266 Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
267 } SymbolTable;
268
269 extern SymbolTable *new_symbol_table /* Create symbol table */
270 (void);
271 extern void free_symbol_table /* Destroy symbol table */
272 (SymbolTable *s);
273 extern Symbol *find_symbol /* Lookup symbol name */
274 (SymbolTable *s, const char *n);
275 extern Symbol *new_symbol /* Define new symbol */
276 (SymbolTable *s, const char *n, const char *v, int f);
277
278 /* #include "semantic.h" */
279 extern void new_decl_spec (DeclSpec *, const char *, long, int);
280 extern void free_decl_spec (DeclSpec *);
281 extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
282 extern void check_untagged (DeclSpec *);
283 extern Declarator *new_declarator (const char *, const char *, long);
284 extern void free_declarator (Declarator *);
285 extern void new_decl_list (DeclaratorList *, Declarator *);
286 extern void free_decl_list (DeclaratorList *);
287 extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
288 extern Parameter *new_parameter (DeclSpec *, Declarator *);
289 extern void free_parameter (Parameter *);
290 extern void new_param_list (ParameterList *, Parameter *);
291 extern void free_param_list (ParameterList *);
292 extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
293 extern void new_ident_list (ParameterList *);
294 extern void add_ident_list (ParameterList *, ParameterList *, const char *);
295 extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
296 extern void gen_declarations (DeclSpec *, DeclaratorList *);
297 extern void gen_prototype (DeclSpec *, Declarator *);
298 extern void gen_func_declarator (Declarator *);
299 extern void gen_func_definition (DeclSpec *, Declarator *);
300
301 extern void init_parser (void);
302 extern void process_file (FILE *infile, char *name);
303 extern char *cur_text (void);
304 extern char *cur_file_name (void);
305 extern char *implied_typedef (void);
306 extern void include_file (char *name, int convert);
307 extern char *supply_parm (int count);
308 extern char *xstrdup (const char *);
309 extern int already_declared (char *name);
310 extern int is_actual_func (Declarator *d);
311 extern int lint_ellipsis (Parameter *p);
312 extern int want_typedef (void);
313 extern void begin_tracking (void);
314 extern void begin_typedef (void);
315 extern void copy_typedef (char *s);
316 extern void ellipsis_varargs (Declarator *d);
317 extern void end_typedef (void);
318 extern void flush_varargs (void);
319 extern void fmt_library (int code);
320 extern void imply_typedef (const char *s);
321 extern void indent (FILE *outf);
322 extern void put_blankline (FILE *outf);
323 extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
324 extern void put_char (FILE *outf, int c);
325 extern void put_error (void);
326 extern void put_newline (FILE *outf);
327 extern void put_padded (FILE *outf, const char *s);
328 extern void put_string (FILE *outf, const char *s);
329 extern void track_in (void);
330
331 extern boolean file_comments;
332 extern FuncDefStyle func_style;
333 extern char base_file[];
334
335 extern int yylex (void);
336
337 /* declaration specifier attributes for the typedef statement currently being
338 * scanned
339 */
340 static int cur_decl_spec_flags;
341
342 /* pointer to parameter list for the current function definition */
343 static ParameterList *func_params;
344
345 /* A parser semantic action sets this pointer to the current declarator in
346 * a function parameter declaration in order to catch any comments following
347 * the parameter declaration on the same line. If the lexer scans a comment
348 * and <cur_declarator> is not NULL, then the comment is attached to the
349 * declarator. To ignore subsequent comments, the lexer sets this to NULL
350 * after scanning a comment or end of line.
351 */
352 static Declarator *cur_declarator;
353
354 /* temporary string buffer */
355 static char buf[MAX_TEXT_SIZE];
356
357 /* table of typedef names */
358 static SymbolTable *typedef_names;
359
360 /* table of define names */
361 static SymbolTable *define_names;
362
363 /* table of type qualifiers */
364 static SymbolTable *type_qualifiers;
365
366 /* information about the current input file */
367 typedef struct {
368 char *base_name; /* base input file name */
369 char *file_name; /* current file name */
370 FILE *file; /* input file */
371 unsigned line_num; /* current line number in input file */
372 FILE *tmp_file; /* temporary file */
373 long begin_comment; /* tmp file offset after last written ) or ; */
374 long end_comment; /* tmp file offset after last comment */
375 boolean convert; /* if TRUE, convert function definitions */
376 boolean changed; /* TRUE if conversion done in this file */
377 } IncludeStack;
378
379 static IncludeStack *cur_file; /* current input file */
380
381 /* #include "yyerror.c" */
382
383 static int haveAnsiParam (void);
384
385
386 /* Flags to enable us to find if a procedure returns a value.
387 */
388 static int return_val; /* nonzero on BRACES iff return-expression found */
389
390 static const char *
391 dft_decl_spec (void)
392 {
393 return (lintLibrary() && !return_val) ? "void" : "int";
394 }
395
396 static int
397 haveAnsiParam (void)
398 {
399 Parameter *p;
400 if (func_params != 0) {
401 for (p = func_params->first; p != 0; p = p->next) {
402 if (p->declarator->func_def == FUNC_ANSI) {
403 return TRUE;
404 }
405 }
406 }
407 return FALSE;
408 }
409 #line 408 "grammar.tab.c"
410
411 /* compatibility with bison */
412 #ifdef YYPARSE_PARAM
413 /* compatibility with FreeBSD */
414 # ifdef YYPARSE_PARAM_TYPE
415 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
416 # else
417 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
418 # endif
419 #else
420 # define YYPARSE_DECL() yyparse(void)
421 #endif
422
423 /* Parameters sent to lex. */
424 #ifdef YYLEX_PARAM
425 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
426 # define YYLEX yylex(YYLEX_PARAM)
427 #else
428 # define YYLEX_DECL() yylex(void)
429 # define YYLEX yylex()
430 #endif
431
432 /* Parameters sent to yyerror. */
433 #ifndef YYERROR_DECL
434 #define YYERROR_DECL() yyerror(const char *s)
435 #endif
436 #ifndef YYERROR_CALL
437 #define YYERROR_CALL(msg) yyerror(msg)
438 #endif
439
440 extern int YYPARSE_DECL();
441
442 #define T_IDENTIFIER 257
443 #define T_TYPEDEF_NAME 258
444 #define T_DEFINE_NAME 259
445 #define T_AUTO 260
446 #define T_EXTERN 261
447 #define T_REGISTER 262
448 #define T_STATIC 263
449 #define T_TYPEDEF 264
450 #define T_INLINE 265
451 #define T_EXTENSION 266
452 #define T_CHAR 267
453 #define T_DOUBLE 268
454 #define T_FLOAT 269
455 #define T_INT 270
456 #define T_VOID 271
457 #define T_LONG 272
458 #define T_SHORT 273
459 #define T_SIGNED 274
460 #define T_UNSIGNED 275
461 #define T_ENUM 276
462 #define T_STRUCT 277
463 #define T_UNION 278
464 #define T_Bool 279
465 #define T_Complex 280
466 #define T_Imaginary 281
467 #define T_TYPE_QUALIFIER 282
468 #define T_BRACKETS 283
469 #define T_LBRACE 284
470 #define T_MATCHRBRACE 285
471 #define T_ELLIPSIS 286
472 #define T_INITIALIZER 287
473 #define T_STRING_LITERAL 288
474 #define T_ASM 289
475 #define T_ASMARG 290
476 #define T_VA_DCL 291
477 #define YYERRCODE 256
478 typedef short YYINT;
479 static const YYINT grammar_lhs[] = { -1,
480 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
481 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
482 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
483 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
484 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
485 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
486 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
487 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
488 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
489 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
490 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
491 13, 13, 13, 13,
492 };
493 static const YYINT grammar_len[] = { 2,
494 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
495 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
496 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
497 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
498 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
500 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
501 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
502 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
503 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
504 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
505 4, 3, 3, 2,
506 };
507 static const YYINT grammar_defred[] = { 0,
508 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
509 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
510 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
511 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
512 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
513 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
514 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
515 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
516 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
517 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
518 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
519 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
520 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
521 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
522 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
523 };
524 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
525 static const YYINT grammar_stos[] = { 0,
526 256, 40, 42, 38, 257, 258, 259, 260, 261, 262,
527 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
528 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
529 289, 59, 293, 294, 295, 296, 297, 298, 299, 300,
530 303, 304, 312, 313, 316, 317, 318, 319, 320, 321,
531 322, 323, 325, 285, 59, 258, 303, 298, 314, 315,
532 316, 288, 264, 290, 261, 266, 59, 295, 301, 302,
533 303, 332, 40, 283, 284, 316, 324, 304, 316, 324,
534 320, 258, 294, 41, 313, 298, 294, 321, 324, 59,
535 59, 44, 61, 330, 291, 321, 329, 333, 294, 307,
536 308, 309, 310, 311, 316, 285, 324, 324, 327, 303,
537 302, 334, 329, 284, 321, 40, 283, 303, 305, 306,
538 313, 41, 44, 41, 44, 303, 326, 328, 287, 284,
539 285, 41, 305, 307, 40, 283, 306, 286, 309, 316,
540 59, 44, 331, 41, 41, 41, 307, 303, 285, 41,
541 };
542 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
543 static const YYINT grammar_dgoto[] = { 33,
544 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
545 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
546 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
547 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
548 112,
549 };
550 static const YYINT grammar_sindex[] = { -2,
551 -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
552 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
554 -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
555 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
556 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
557 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
558 -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
559 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
560 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
561 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
562 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
563 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
564 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
565 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
566 };
567 static const YYINT grammar_rindex[] = { 99,
568 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
569 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
570 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
571 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
572 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
573 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
574 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
575 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
576 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
577 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
578 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
579 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
580 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
581 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
582 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
583 };
584 #if YYBTYACC
585 static const YYINT grammar_cindex[] = { 0,
586 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
587 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
588 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
589 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
590 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
591 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
592 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
593 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
594 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
596 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
597 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
598 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
599 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
600 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
601 };
602 #endif
603 static const YYINT grammar_gindex[] = { 0,
604 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
605 -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
606 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
607 -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
608 0,
609 };
610 #define YYTABLESIZE 924
611 static const YYINT grammar_table[] = { 58,
612 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
613 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
614 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
615 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
616 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
617 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
618 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
619 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
620 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
621 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
622 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
623 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
624 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
625 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
626 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
627 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
628 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
629 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
630 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
631 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
632 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
633 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
634 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
635 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
636 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
637 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
638 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
639 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
640 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
641 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
642 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
643 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
644 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
645 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
646 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
647 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
648 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
649 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
650 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
651 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
652 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
653 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
654 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
655 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
656 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
657 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
658 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
659 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
660 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
661 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
662 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
663 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
664 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
665 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
666 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
667 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
668 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
669 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
670 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
671 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
672 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
674 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
675 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
676 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
677 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
678 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
679 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
680 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
681 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
682 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
683 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
684 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
685 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
686 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
687 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
688 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
689 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
690 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
691 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
692 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
693 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
694 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
695 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
696 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
697 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
698 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
699 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
700 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
701 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
702 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
703 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
704 27, 28, 29, 30,
705 };
706 static const YYINT grammar_check[] = { 38,
707 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
708 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
709 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
710 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
711 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
712 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
713 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
714 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
715 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
716 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
717 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
718 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
719 -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
720 -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
721 -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
722 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
723 -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
724 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
725 -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
726 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
727 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
728 -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
729 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
730 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
731 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
732 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
733 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
734 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
735 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
736 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
737 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
738 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
739 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
740 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
741 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
742 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
743 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
744 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
745 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
746 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
747 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
748 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
749 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
750 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
751 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
752 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
753 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
754 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
755 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
756 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
757 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
758 -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
759 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
760 -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
761 -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
762 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
763 -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
765 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
766 -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
767 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
768 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
769 -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
770 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
771 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
772 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
773 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
774 -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
775 -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
776 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
777 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
778 -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
779 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
780 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
781 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
782 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
783 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
784 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
785 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
786 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
787 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
788 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
789 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
790 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
791 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
792 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
793 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
794 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
795 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
796 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
797 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
798 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
799 279, 280, 281, 282,
800 };
801 #if YYBTYACC
802 static const YYINT grammar_ctable[] = { -1,
803 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
804 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
805 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
806 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
807 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
808 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
809 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
810 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
811 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
812 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
813 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
814 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
815 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
816 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
817 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
818 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
819 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
820 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
821 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
822 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
823 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
824 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
825 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
826 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
827 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
828 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
829 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
830 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
831 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
832 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
833 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
834 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
835 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
836 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
837 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
838 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
839 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
840 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
841 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
842 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
843 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
844 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
845 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
846 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
847 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
848 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
849 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
850 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
851 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
852 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
853 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
854 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
855 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
856 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
857 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
858 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
859 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
860 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
861 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
862 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
863 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
864 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
865 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
866 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
867 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
868 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
869 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
870 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
871 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
872 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
873 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
874 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
875 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
876 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
877 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
878 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
879 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
880 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
881 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
882 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
883 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
884 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
885 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
886 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
887 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
888 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
889 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
890 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
891 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
892 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
893 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
894 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
895 -1, -1, -1,
896 };
897 #endif
898 #define YYFINAL 33
899 #ifndef YYDEBUG
900 #define YYDEBUG 0
901 #endif
902 #define YYMAXTOKEN 291
903 #define YYUNDFTOKEN 335
904 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
905 #if YYDEBUG
906 static const char *const grammar_name[] = {
907
908 "$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
909 0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,"'='",0,
910 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
911 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
912 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
913 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
914 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error",
915 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
916 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
917 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
918 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
919 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
920 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL","$accept",
921 "program","decl_specifiers","decl_specifier","storage_class","type_specifier",
922 "type_qualifier","struct_or_union_specifier","enum_specifier",
923 "init_declarator_list","init_declarator","declarator","direct_declarator",
924 "abs_declarator","direct_abs_declarator","parameter_type_list","parameter_list",
925 "parameter_declaration","opt_identifier_list","identifier_list",
926 "struct_or_union","pointer","opt_type_qualifiers","type_qualifier_list",
927 "any_id","identifier_or_ref","enumeration","translation_unit",
928 "external_declaration","declaration","function_definition",
929 "linkage_specification","braces","any_typedef","opt_declarator_list","$$1",
930 "declarator_list","opt_declaration_list","$$2","$$3","$$4","declaration_list",
931 "$$5","illegal-symbol",
932 };
933 static const char *const grammar_rule[] = {
934 "$accept : program",
935 "program :",
936 "program : translation_unit",
937 "translation_unit : external_declaration",
938 "translation_unit : translation_unit external_declaration",
939 "external_declaration : declaration",
940 "external_declaration : function_definition",
941 "external_declaration : ';'",
942 "external_declaration : linkage_specification",
943 "external_declaration : T_ASM T_ASMARG ';'",
944 "external_declaration : error T_MATCHRBRACE",
945 "external_declaration : error ';'",
946 "braces : T_LBRACE T_MATCHRBRACE",
947 "linkage_specification : T_EXTERN T_STRING_LITERAL braces",
948 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
949 "declaration : decl_specifiers ';'",
950 "declaration : decl_specifiers init_declarator_list ';'",
951 "$$1 :",
952 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
953 "any_typedef : T_EXTENSION T_TYPEDEF",
954 "any_typedef : T_TYPEDEF",
955 "opt_declarator_list :",
956 "opt_declarator_list : declarator_list",
957 "declarator_list : declarator",
958 "declarator_list : declarator_list ',' declarator",
959 "$$2 :",
960 "$$3 :",
961 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
962 "$$4 :",
963 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
964 "opt_declaration_list :",
965 "opt_declaration_list : T_VA_DCL",
966 "opt_declaration_list : declaration_list",
967 "declaration_list : declaration",
968 "declaration_list : declaration_list declaration",
969 "decl_specifiers : decl_specifier",
970 "decl_specifiers : decl_specifiers decl_specifier",
971 "decl_specifier : storage_class",
972 "decl_specifier : type_specifier",
973 "decl_specifier : type_qualifier",
974 "storage_class : T_AUTO",
975 "storage_class : T_EXTERN",
976 "storage_class : T_REGISTER",
977 "storage_class : T_STATIC",
978 "storage_class : T_INLINE",
979 "storage_class : T_EXTENSION",
980 "type_specifier : T_CHAR",
981 "type_specifier : T_DOUBLE",
982 "type_specifier : T_FLOAT",
983 "type_specifier : T_INT",
984 "type_specifier : T_LONG",
985 "type_specifier : T_SHORT",
986 "type_specifier : T_SIGNED",
987 "type_specifier : T_UNSIGNED",
988 "type_specifier : T_VOID",
989 "type_specifier : T_Bool",
990 "type_specifier : T_Complex",
991 "type_specifier : T_Imaginary",
992 "type_specifier : T_TYPEDEF_NAME",
993 "type_specifier : struct_or_union_specifier",
994 "type_specifier : enum_specifier",
995 "type_qualifier : T_TYPE_QUALIFIER",
996 "type_qualifier : T_DEFINE_NAME",
997 "struct_or_union_specifier : struct_or_union any_id braces",
998 "struct_or_union_specifier : struct_or_union braces",
999 "struct_or_union_specifier : struct_or_union any_id",
1000 "struct_or_union : T_STRUCT",
1001 "struct_or_union : T_UNION",
1002 "init_declarator_list : init_declarator",
1003 "init_declarator_list : init_declarator_list ',' init_declarator",
1004 "init_declarator : declarator",
1005 "$$5 :",
1006 "init_declarator : declarator '=' $$5 T_INITIALIZER",
1007 "enum_specifier : enumeration any_id braces",
1008 "enum_specifier : enumeration braces",
1009 "enum_specifier : enumeration any_id",
1010 "enumeration : T_ENUM",
1011 "any_id : T_IDENTIFIER",
1012 "any_id : T_TYPEDEF_NAME",
1013 "declarator : pointer direct_declarator",
1014 "declarator : direct_declarator",
1015 "direct_declarator : identifier_or_ref",
1016 "direct_declarator : '(' declarator ')'",
1017 "direct_declarator : direct_declarator T_BRACKETS",
1018 "direct_declarator : direct_declarator '(' parameter_type_list ')'",
1019 "direct_declarator : direct_declarator '(' opt_identifier_list ')'",
1020 "pointer : '*' opt_type_qualifiers",
1021 "pointer : '*' opt_type_qualifiers pointer",
1022 "opt_type_qualifiers :",
1023 "opt_type_qualifiers : type_qualifier_list",
1024 "type_qualifier_list : type_qualifier",
1025 "type_qualifier_list : type_qualifier_list type_qualifier",
1026 "parameter_type_list : parameter_list",
1027 "parameter_type_list : parameter_list ',' T_ELLIPSIS",
1028 "parameter_list : parameter_declaration",
1029 "parameter_list : parameter_list ',' parameter_declaration",
1030 "parameter_declaration : decl_specifiers declarator",
1031 "parameter_declaration : decl_specifiers abs_declarator",
1032 "parameter_declaration : decl_specifiers",
1033 "opt_identifier_list :",
1034 "opt_identifier_list : identifier_list",
1035 "identifier_list : any_id",
1036 "identifier_list : identifier_list ',' any_id",
1037 "identifier_or_ref : any_id",
1038 "identifier_or_ref : '&' any_id",
1039 "abs_declarator : pointer",
1040 "abs_declarator : pointer direct_abs_declarator",
1041 "abs_declarator : direct_abs_declarator",
1042 "direct_abs_declarator : '(' abs_declarator ')'",
1043 "direct_abs_declarator : direct_abs_declarator T_BRACKETS",
1044 "direct_abs_declarator : T_BRACKETS",
1045 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
1046 "direct_abs_declarator : direct_abs_declarator '(' ')'",
1047 "direct_abs_declarator : '(' parameter_type_list ')'",
1048 "direct_abs_declarator : '(' ')'",
1049
1050 };
1051 #endif
1052
1053 int yydebug;
1054 int yynerrs;
1055
1056 int yyerrflag;
1057 int yychar;
1058 YYSTYPE yyval;
1059 YYSTYPE yylval;
1060 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1061 YYLTYPE yyloc; /* position returned by actions */
1062 YYLTYPE yylloc; /* position from the lexer */
1063 #endif
1064
1065 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1066 #ifndef YYLLOC_DEFAULT
1067 #define YYLLOC_DEFAULT(loc, rhs, n) \
1068 do \
1069 { \
1070 if (n == 0) \
1071 { \
1072 (loc).first_line = ((rhs)[-1]).last_line; \
1073 (loc).first_column = ((rhs)[-1]).last_column; \
1074 (loc).last_line = ((rhs)[-1]).last_line; \
1075 (loc).last_column = ((rhs)[-1]).last_column; \
1076 } \
1077 else \
1078 { \
1079 (loc).first_line = ((rhs)[ 0 ]).first_line; \
1080 (loc).first_column = ((rhs)[ 0 ]).first_column; \
1081 (loc).last_line = ((rhs)[n-1]).last_line; \
1082 (loc).last_column = ((rhs)[n-1]).last_column; \
1083 } \
1084 } while (0)
1085 #endif /* YYLLOC_DEFAULT */
1086 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1087 #if YYBTYACC
1088
1089 #ifndef YYLVQUEUEGROWTH
1090 #define YYLVQUEUEGROWTH 32
1091 #endif
1092 #endif /* YYBTYACC */
1093
1094 /* define the initial stack-sizes */
1095 #ifdef YYSTACKSIZE
1096 #undef YYMAXDEPTH
1097 #define YYMAXDEPTH YYSTACKSIZE
1098 #else
1099 #ifdef YYMAXDEPTH
1100 #define YYSTACKSIZE YYMAXDEPTH
1101 #else
1102 #define YYSTACKSIZE 10000
1103 #define YYMAXDEPTH 10000
1104 #endif
1105 #endif
1106
1107 #ifndef YYINITSTACKSIZE
1108 #define YYINITSTACKSIZE 200
1109 #endif
1110
1111 typedef struct {
1112 unsigned stacksize;
1113 YYINT *s_base;
1114 YYINT *s_mark;
1115 YYINT *s_last;
1116 YYSTYPE *l_base;
1117 YYSTYPE *l_mark;
1118 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1119 YYLTYPE *p_base;
1120 YYLTYPE *p_mark;
1121 #endif
1122 } YYSTACKDATA;
1123 #if YYBTYACC
1124
1125 struct YYParseState_s
1126 {
1127 struct YYParseState_s *save; /* Previously saved parser state */
1128 YYSTACKDATA yystack; /* saved parser stack */
1129 int state; /* saved parser state */
1130 int errflag; /* saved error recovery status */
1131 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
1132 YYINT ctry; /* saved index in yyctable[] for this conflict */
1133 };
1134 typedef struct YYParseState_s YYParseState;
1135 #endif /* YYBTYACC */
1136 /* variables for the parser stack */
1137 static YYSTACKDATA yystack;
1138 #if YYBTYACC
1139
1140 /* Current parser state */
1141 static YYParseState *yyps = 0;
1142
1143 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
1144 static YYParseState *yypath = 0;
1145
1146 /* Base of the lexical value queue */
1147 static YYSTYPE *yylvals = 0;
1148
1149 /* Current position at lexical value queue */
1150 static YYSTYPE *yylvp = 0;
1151
1152 /* End position of lexical value queue */
1153 static YYSTYPE *yylve = 0;
1154
1155 /* The last allocated position at the lexical value queue */
1156 static YYSTYPE *yylvlim = 0;
1157
1158 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1159 /* Base of the lexical position queue */
1160 static YYLTYPE *yylpsns = 0;
1161
1162 /* Current position at lexical position queue */
1163 static YYLTYPE *yylpp = 0;
1164
1165 /* End position of lexical position queue */
1166 static YYLTYPE *yylpe = 0;
1167
1168 /* The last allocated position at the lexical position queue */
1169 static YYLTYPE *yylplim = 0;
1170 #endif
1171
1172 /* Current position at lexical token queue */
1173 static YYINT *yylexp = 0;
1174
1175 static YYINT *yylexemes = 0;
1176 #endif /* YYBTYACC */
1177 #line 1014 "grammar.y"
1178
1179 /* lex.yy.c */
1180 #define BEGIN yy_start = 1 + 2 *
1181
1182 #define CPP1 1
1183 #define INIT1 2
1184 #define INIT2 3
1185 #define CURLY 4
1186 #define LEXYACC 5
1187 #define ASM 6
1188 #define CPP_INLINE 7
1189
1190 extern char *yytext;
1191 extern FILE *yyin, *yyout;
1192
1193 static int curly; /* number of curly brace nesting levels */
1194 static int ly_count; /* number of occurances of %% */
1195 static int inc_depth; /* include nesting level */
1196 static SymbolTable *included_files; /* files already included */
1197 static int yy_start = 0; /* start state number */
1198
1199 #define grammar_error(s) yaccError(s)
1200
1201 static void
1202 yaccError (const char *msg)
1203 {
1204 func_params = NULL;
1205 put_error(); /* tell what line we're on, and what file */
1206 fprintf(stderr, "%s at token '%s'\n", msg, yytext);
1207 }
1208
1209 /* Initialize the table of type qualifier keywords recognized by the lexical
1210 * analyzer.
1211 */
1212 void
1213 init_parser (void)
1214 {
1215 static const char *keywords[] = {
1216 "const",
1217 "restrict",
1218 "volatile",
1219 "interrupt",
1220 #ifdef vms
1221 "noshare",
1222 "readonly",
1223 #endif
1224 #if defined(MSDOS) || defined(OS2)
1225 "__cdecl",
1226 "__export",
1227 "__far",
1228 "__fastcall",
1229 "__fortran",
1230 "__huge",
1231 "__inline",
1232 "__interrupt",
1233 "__loadds",
1234 "__near",
1235 "__pascal",
1236 "__saveregs",
1237 "__segment",
1238 "__stdcall",
1239 "__syscall",
1240 "_cdecl",
1241 "_cs",
1242 "_ds",
1243 "_es",
1244 "_export",
1245 "_far",
1246 "_fastcall",
1247 "_fortran",
1248 "_huge",
1249 "_interrupt",
1250 "_loadds",
1251 "_near",
1252 "_pascal",
1253 "_saveregs",
1254 "_seg",
1255 "_segment",
1256 "_ss",
1257 "cdecl",
1258 "far",
1259 "huge",
1260 "near",
1261 "pascal",
1262 #ifdef OS2
1263 "__far16",
1264 #endif
1265 #endif
1266 #ifdef __GNUC__
1267 /* gcc aliases */
1268 "__builtin_va_arg",
1269 "__builtin_va_list",
1270 "__const",
1271 "__const__",
1272 "__inline",
1273 "__inline__",
1274 "__restrict",
1275 "__restrict__",
1276 "__volatile",
1277 "__volatile__",
1278 #endif
1279 };
1280 unsigned i;
1281
1282 /* Initialize type qualifier table. */
1283 type_qualifiers = new_symbol_table();
1284 for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
1285 new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
1286 }
1287 }
1288
1289 /* Process the C source file. Write function prototypes to the standard
1290 * output. Convert function definitions and write the converted source
1291 * code to a temporary file.
1292 */
1293 void
1294 process_file (FILE *infile, char *name)
1295 {
1296 char *s;
1297
1298 if (strlen(name) > 2) {
1299 s = name + strlen(name) - 2;
1300 if (*s == '.') {
1301 ++s;
1302 if (*s == 'l' || *s == 'y')
1303 BEGIN LEXYACC;
1304 #if defined(MSDOS) || defined(OS2)
1305 if (*s == 'L' || *s == 'Y')
1306 BEGIN LEXYACC;
1307 #endif
1308 }
1309 }
1310
1311 included_files = new_symbol_table();
1312 typedef_names = new_symbol_table();
1313 define_names = new_symbol_table();
1314 inc_depth = -1;
1315 curly = 0;
1316 ly_count = 0;
1317 func_params = NULL;
1318 yyin = infile;
1319 include_file(strcpy(base_file, name), func_style != FUNC_NONE);
1320 if (file_comments) {
1321 #if OPT_LINTLIBRARY
1322 if (lintLibrary()) {
1323 put_blankline(stdout);
1324 begin_tracking();
1325 }
1326 #endif
1327 put_string(stdout, "/* ");
1328 put_string(stdout, cur_file_name());
1329 put_string(stdout, " */\n");
1330 }
1331 yyparse();
1332 free_symbol_table(define_names);
1333 free_symbol_table(typedef_names);
1334 free_symbol_table(included_files);
1335 }
1336
1337 #ifdef NO_LEAKS
1338 void
1339 free_parser(void)
1340 {
1341 free_symbol_table (type_qualifiers);
1342 #ifdef FLEX_SCANNER
1343 if (yy_current_buffer != 0)
1344 yy_delete_buffer(yy_current_buffer);
1345 #endif
1346 }
1347 #endif
1348 #line 1347 "grammar.tab.c"
1349
1350 /* For use in generated program */
1351 #define yydepth (int)(yystack.s_mark - yystack.s_base)
1352 #if YYBTYACC
1353 #define yytrial (yyps->save)
1354 #endif /* YYBTYACC */
1355
1356 #if YYDEBUG
1357 #include <stdio.h> /* needed for printf */
1358 #endif
1359
1360 #include <stdlib.h> /* needed for malloc, etc */
1361 #include <string.h> /* needed for memset */
1362
1363 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1364 static int yygrowstack(YYSTACKDATA *data)
1365 {
1366 int i;
1367 unsigned newsize;
1368 YYINT *newss;
1369 YYSTYPE *newvs;
1370 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1371 YYLTYPE *newps;
1372 #endif
1373
1374 if ((newsize = data->stacksize) == 0)
1375 newsize = YYINITSTACKSIZE;
1376 else if (newsize >= YYMAXDEPTH)
1377 return YYENOMEM;
1378 else if ((newsize *= 2) > YYMAXDEPTH)
1379 newsize = YYMAXDEPTH;
1380
1381 i = (int) (data->s_mark - data->s_base);
1382 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1383 if (newss == 0)
1384 return YYENOMEM;
1385
1386 data->s_base = newss;
1387 data->s_mark = newss + i;
1388
1389 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1390 if (newvs == 0)
1391 return YYENOMEM;
1392
1393 data->l_base = newvs;
1394 data->l_mark = newvs + i;
1395
1396 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1397 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
1398 if (newps == 0)
1399 return YYENOMEM;
1400
1401 data->p_base = newps;
1402 data->p_mark = newps + i;
1403 #endif
1404
1405 data->stacksize = newsize;
1406 data->s_last = data->s_base + newsize - 1;
1407
1408 #if YYDEBUG
1409 if (yydebug)
1410 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
1411 #endif
1412 return 0;
1413 }
1414
1415 #if YYPURE || defined(YY_NO_LEAKS)
1416 static void yyfreestack(YYSTACKDATA *data)
1417 {
1418 free(data->s_base);
1419 free(data->l_base);
1420 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1421 free(data->p_base);
1422 #endif
1423 memset(data, 0, sizeof(*data));
1424 }
1425 #else
1426 #define yyfreestack(data) /* nothing */
1427 #endif /* YYPURE || defined(YY_NO_LEAKS) */
1428 #if YYBTYACC
1429
1430 static YYParseState *
1431 yyNewState(unsigned size)
1432 {
1433 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
1434 if (p == NULL) return NULL;
1435
1436 p->yystack.stacksize = size;
1437 if (size == 0)
1438 {
1439 p->yystack.s_base = NULL;
1440 p->yystack.l_base = NULL;
1441 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1442 p->yystack.p_base = NULL;
1443 #endif
1444 return p;
1445 }
1446 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
1447 if (p->yystack.s_base == NULL) return NULL;
1448 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
1449 if (p->yystack.l_base == NULL) return NULL;
1450 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
1451 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1452 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
1453 if (p->yystack.p_base == NULL) return NULL;
1454 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
1455 #endif
1456
1457 return p;
1458 }
1459
1460 static void
1461 yyFreeState(YYParseState *p)
1462 {
1463 yyfreestack(&p->yystack);
1464 free(p);
1465 }
1466 #endif /* YYBTYACC */
1467
1468 #define YYABORT goto yyabort
1469 #define YYREJECT goto yyabort
1470 #define YYACCEPT goto yyaccept
1471 #define YYERROR goto yyerrlab
1472 #if YYBTYACC
1473 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
1474 #define YYVALID_NESTED do { if (yyps->save && \
1475 yyps->save->save == 0) goto yyvalid; } while(0)
1476 #endif /* YYBTYACC */
1477
1478 int
1479 YYPARSE_DECL()
1480 {
1481 int yym, yyn, yystate, yyresult;
1482 #if YYBTYACC
1483 int yynewerrflag;
1484 YYParseState *yyerrctx = NULL;
1485 #endif /* YYBTYACC */
1486 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1487 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
1488 #endif
1489 #if YYDEBUG
1490 const char *yys;
1491
1492 if ((yys = getenv("YYDEBUG")) != 0)
1493 {
1494 yyn = *yys;
1495 if (yyn >= '0' && yyn <= '9')
1496 yydebug = yyn - '0';
1497 }
1498 if (yydebug)
1499 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
1500 #endif
1501 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1502 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
1503 #endif
1504
1505 #if YYBTYACC
1506 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
1507 yyps->save = 0;
1508 #endif /* YYBTYACC */
1509 yym = 0;
1510 yyn = 0;
1511 yynerrs = 0;
1512 yyerrflag = 0;
1513 yychar = YYEMPTY;
1514 yystate = 0;
1515
1516 #if YYPURE
1517 memset(&yystack, 0, sizeof(yystack));
1518 #endif
1519
1520 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1521 yystack.s_mark = yystack.s_base;
1522 yystack.l_mark = yystack.l_base;
1523 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1524 yystack.p_mark = yystack.p_base;
1525 #endif
1526 yystate = 0;
1527 *yystack.s_mark = 0;
1528
1529 yyloop:
1530 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1531 if (yychar < 0)
1532 {
1533 #if YYBTYACC
1534 do {
1535 if (yylvp < yylve)
1536 {
1537 /* we're currently re-reading tokens */
1538 yylval = *yylvp++;
1539 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1540 yylloc = *yylpp++;
1541 #endif
1542 yychar = *yylexp++;
1543 break;
1544 }
1545 if (yyps->save)
1546 {
1547 /* in trial mode; save scanner results for future parse attempts */
1548 if (yylvp == yylvlim)
1549 { /* Enlarge lexical value queue */
1550 size_t p = (size_t) (yylvp - yylvals);
1551 size_t s = (size_t) (yylvlim - yylvals);
1552
1553 s += YYLVQUEUEGROWTH;
1554 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
1555 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1556 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1557 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1558 #endif
1559 yylvp = yylve = yylvals + p;
1560 yylvlim = yylvals + s;
1561 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1562 yylpp = yylpe = yylpsns + p;
1563 yylplim = yylpsns + s;
1564 #endif
1565 yylexp = yylexemes + p;
1566 }
1567 *yylexp = (YYINT) YYLEX;
1568 *yylvp++ = yylval;
1569 yylve++;
1570 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1571 *yylpp++ = yylloc;
1572 yylpe++;
1573 #endif
1574 yychar = *yylexp++;
1575 break;
1576 }
1577 /* normal operation, no conflict encountered */
1578 #endif /* YYBTYACC */
1579 yychar = YYLEX;
1580 #if YYBTYACC
1581 } while (0);
1582 #endif /* YYBTYACC */
1583 if (yychar < 0) yychar = YYEOF;
1584 #if YYDEBUG
1585 if (yydebug)
1586 {
1587 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1588 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
1589 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1590 #ifdef YYSTYPE_TOSTRING
1591 #if YYBTYACC
1592 if (!yytrial)
1593 #endif /* YYBTYACC */
1594 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
1595 #endif
1596 fputc('\n', stderr);
1597 }
1598 #endif
1599 }
1600 #if YYBTYACC
1601
1602 /* Do we have a conflict? */
1603 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1604 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1605 {
1606 YYINT ctry;
1607
1608 if (yypath)
1609 {
1610 YYParseState *save;
1611 #if YYDEBUG
1612 if (yydebug)
1613 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
1614 YYDEBUGSTR, yydepth, yystate);
1615 #endif
1616 /* Switch to the next conflict context */
1617 save = yypath;
1618 yypath = save->save;
1619 save->save = NULL;
1620 ctry = save->ctry;
1621 if (save->state != yystate) YYABORT;
1622 yyFreeState(save);
1623
1624 }
1625 else
1626 {
1627
1628 /* Unresolved conflict - start/continue trial parse */
1629 YYParseState *save;
1630 #if YYDEBUG
1631 if (yydebug)
1632 {
1633 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
1634 if (yyps->save)
1635 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
1636 else
1637 fputs("Starting trial parse.\n", stderr);
1638 }
1639 #endif
1640 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1641 if (save == NULL) goto yyenomem;
1642 save->save = yyps->save;
1643 save->state = yystate;
1644 save->errflag = yyerrflag;
1645 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1646 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1647 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1648 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1649 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1650 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1651 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1652 #endif
1653 ctry = yytable[yyn];
1654 if (yyctable[ctry] == -1)
1655 {
1656 #if YYDEBUG
1657 if (yydebug && yychar >= YYEOF)
1658 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1659 #endif
1660 ctry++;
1661 }
1662 save->ctry = ctry;
1663 if (yyps->save == NULL)
1664 {
1665 /* If this is a first conflict in the stack, start saving lexemes */
1666 if (!yylexemes)
1667 {
1668 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
1669 if (yylexemes == NULL) goto yyenomem;
1670 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
1671 if (yylvals == NULL) goto yyenomem;
1672 yylvlim = yylvals + YYLVQUEUEGROWTH;
1673 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1674 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
1675 if (yylpsns == NULL) goto yyenomem;
1676 yylplim = yylpsns + YYLVQUEUEGROWTH;
1677 #endif
1678 }
1679 if (yylvp == yylve)
1680 {
1681 yylvp = yylve = yylvals;
1682 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1683 yylpp = yylpe = yylpsns;
1684 #endif
1685 yylexp = yylexemes;
1686 if (yychar >= YYEOF)
1687 {
1688 *yylve++ = yylval;
1689 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1690 *yylpe++ = yylloc;
1691 #endif
1692 *yylexp = (YYINT) yychar;
1693 yychar = YYEMPTY;
1694 }
1695 }
1696 }
1697 if (yychar >= YYEOF)
1698 {
1699 yylvp--;
1700 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1701 yylpp--;
1702 #endif
1703 yylexp--;
1704 yychar = YYEMPTY;
1705 }
1706 save->lexeme = (int) (yylvp - yylvals);
1707 yyps->save = save;
1708 }
1709 if (yytable[yyn] == ctry)
1710 {
1711 #if YYDEBUG
1712 if (yydebug)
1713 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1714 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1715 #endif
1716 if (yychar < 0)
1717 {
1718 yylvp++;
1719 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1720 yylpp++;
1721 #endif
1722 yylexp++;
1723 }
1724 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1725 goto yyoverflow;
1726 yystate = yyctable[ctry];
1727 *++yystack.s_mark = (YYINT) yystate;
1728 *++yystack.l_mark = yylval;
1729 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1730 *++yystack.p_mark = yylloc;
1731 #endif
1732 yychar = YYEMPTY;
1733 if (yyerrflag > 0) --yyerrflag;
1734 goto yyloop;
1735 }
1736 else
1737 {
1738 yyn = yyctable[ctry];
1739 goto yyreduce;
1740 }
1741 } /* End of code dealing with conflicts */
1742 #endif /* YYBTYACC */
1743 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1744 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1745 {
1746 #if YYDEBUG
1747 if (yydebug)
1748 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1749 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1750 #endif
1751 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1752 yystate = yytable[yyn];
1753 *++yystack.s_mark = yytable[yyn];
1754 *++yystack.l_mark = yylval;
1755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1756 *++yystack.p_mark = yylloc;
1757 #endif
1758 yychar = YYEMPTY;
1759 if (yyerrflag > 0) --yyerrflag;
1760 goto yyloop;
1761 }
1762 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1763 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1764 {
1765 yyn = yytable[yyn];
1766 goto yyreduce;
1767 }
1768 if (yyerrflag != 0) goto yyinrecovery;
1769 #if YYBTYACC
1770
1771 yynewerrflag = 1;
1772 goto yyerrhandler;
1773 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1774
1775 yyerrlab:
1776 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1777 * before looking for error recovery */
1778 yystack.s_mark -= yym;
1779 yystate = *yystack.s_mark;
1780 yystack.l_mark -= yym;
1781 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1782 yystack.p_mark -= yym;
1783 #endif
1784
1785 yynewerrflag = 0;
1786 yyerrhandler:
1787 while (yyps->save)
1788 {
1789 int ctry;
1790 YYParseState *save = yyps->save;
1791 #if YYDEBUG
1792 if (yydebug)
1793 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1794 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1795 (int)(yylvp - yylvals - yyps->save->lexeme));
1796 #endif
1797 /* Memorize most forward-looking error state in case it's really an error. */
1798 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1799 {
1800 /* Free old saved error context state */
1801 if (yyerrctx) yyFreeState(yyerrctx);
1802 /* Create and fill out new saved error context state */
1803 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1804 if (yyerrctx == NULL) goto yyenomem;
1805 yyerrctx->save = yyps->save;
1806 yyerrctx->state = yystate;
1807 yyerrctx->errflag = yyerrflag;
1808 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1809 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1810 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1811 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1812 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1813 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1814 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1815 #endif
1816 yyerrctx->lexeme = (int) (yylvp - yylvals);
1817 }
1818 yylvp = yylvals + save->lexeme;
1819 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1820 yylpp = yylpsns + save->lexeme;
1821 #endif
1822 yylexp = yylexemes + save->lexeme;
1823 yychar = YYEMPTY;
1824 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1825 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1826 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1827 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1828 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1829 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1830 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1831 #endif
1832 ctry = ++save->ctry;
1833 yystate = save->state;
1834 /* We tried shift, try reduce now */
1835 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1836 yyps->save = save->save;
1837 save->save = NULL;
1838 yyFreeState(save);
1839
1840 /* Nothing left on the stack -- error */
1841 if (!yyps->save)
1842 {
1843 #if YYDEBUG
1844 if (yydebug)
1845 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1846 YYPREFIX, yydepth);
1847 #endif
1848 /* Restore state as it was in the most forward-advanced error */
1849 yylvp = yylvals + yyerrctx->lexeme;
1850 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1851 yylpp = yylpsns + yyerrctx->lexeme;
1852 #endif
1853 yylexp = yylexemes + yyerrctx->lexeme;
1854 yychar = yylexp[-1];
1855 yylval = yylvp[-1];
1856 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1857 yylloc = yylpp[-1];
1858 #endif
1859 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1860 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1861 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1862 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1863 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1864 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1865 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1866 #endif
1867 yystate = yyerrctx->state;
1868 yyFreeState(yyerrctx);
1869 yyerrctx = NULL;
1870 }
1871 yynewerrflag = 1;
1872 }
1873 if (yynewerrflag == 0) goto yyinrecovery;
1874 #endif /* YYBTYACC */
1875
1876 YYERROR_CALL("syntax error");
1877 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1878 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1879 #endif
1880
1881 #if !YYBTYACC
1882 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1883 yyerrlab:
1884 #endif
1885 ++yynerrs;
1886
1887 yyinrecovery:
1888 if (yyerrflag < 3)
1889 {
1890 yyerrflag = 3;
1891 for (;;)
1892 {
1893 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1894 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1895 {
1896 #if YYDEBUG
1897 if (yydebug)
1898 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1899 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1900 #endif
1901 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1902 yystate = yytable[yyn];
1903 *++yystack.s_mark = yytable[yyn];
1904 *++yystack.l_mark = yylval;
1905 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1906 /* lookahead position is error end position */
1907 yyerror_loc_range[1] = yylloc;
1908 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1909 *++yystack.p_mark = yyloc;
1910 #endif
1911 goto yyloop;
1912 }
1913 else
1914 {
1915 #if YYDEBUG
1916 if (yydebug)
1917 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1918 YYDEBUGSTR, yydepth, *yystack.s_mark);
1919 #endif
1920 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1921 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1922 /* the current TOS position is the error start position */
1923 yyerror_loc_range[0] = *yystack.p_mark;
1924 #endif
1925 #if defined(YYDESTRUCT_CALL)
1926 #if YYBTYACC
1927 if (!yytrial)
1928 #endif /* YYBTYACC */
1929 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1930 YYDESTRUCT_CALL("error: discarding state",
1931 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1932 #else
1933 YYDESTRUCT_CALL("error: discarding state",
1934 yystos[*yystack.s_mark], yystack.l_mark);
1935 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1936 #endif /* defined(YYDESTRUCT_CALL) */
1937 --yystack.s_mark;
1938 --yystack.l_mark;
1939 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1940 --yystack.p_mark;
1941 #endif
1942 }
1943 }
1944 }
1945 else
1946 {
1947 if (yychar == YYEOF) goto yyabort;
1948 #if YYDEBUG
1949 if (yydebug)
1950 {
1951 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1952 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1953 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1954 }
1955 #endif
1956 #if defined(YYDESTRUCT_CALL)
1957 #if YYBTYACC
1958 if (!yytrial)
1959 #endif /* YYBTYACC */
1960 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1961 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1962 #else
1963 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1964 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1965 #endif /* defined(YYDESTRUCT_CALL) */
1966 yychar = YYEMPTY;
1967 goto yyloop;
1968 }
1969
1970 yyreduce:
1971 yym = yylen[yyn];
1972 #if YYDEBUG
1973 if (yydebug)
1974 {
1975 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1976 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1977 #ifdef YYSTYPE_TOSTRING
1978 #if YYBTYACC
1979 if (!yytrial)
1980 #endif /* YYBTYACC */
1981 if (yym > 0)
1982 {
1983 int i;
1984 fputc('<', stderr);
1985 for (i = yym; i > 0; i--)
1986 {
1987 if (i != yym) fputs(", ", stderr);
1988 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1989 yystack.l_mark[1-i]), stderr);
1990 }
1991 fputc('>', stderr);
1992 }
1993 #endif
1994 fputc('\n', stderr);
1995 }
1996 #endif
1997 if (yym > 0)
1998 yyval = yystack.l_mark[1-yym];
1999 else
2000 memset(&yyval, 0, sizeof yyval);
2001 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2002
2003 /* Perform position reduction */
2004 memset(&yyloc, 0, sizeof(yyloc));
2005 #if YYBTYACC
2006 if (!yytrial)
2007 #endif /* YYBTYACC */
2008 {
2009 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
2010 /* just in case YYERROR is invoked within the action, save
2011 the start of the rhs as the error start position */
2012 yyerror_loc_range[0] = yystack.p_mark[1-yym];
2013 }
2014 #endif
2015
2016 switch (yyn)
2017 {
2018 case 10:
2019 #line 377 "grammar.y"
2020 {
2021 yyerrok;
2022 }
2023 break;
2024 case 11:
2025 #line 381 "grammar.y"
2026 {
2027 yyerrok;
2028 }
2029 break;
2030 case 13:
2031 #line 392 "grammar.y"
2032 {
2033 /* Provide an empty action here so bison will not complain about
2034 * incompatible types in the default action it normally would
2035 * have generated.
2036 */
2037 }
2038 break;
2039 case 14:
2040 #line 399 "grammar.y"
2041 {
2042 /* empty */
2043 }
2044 break;
2045 case 15:
2046 #line 406 "grammar.y"
2047 {
2048 #if OPT_LINTLIBRARY
2049 if (types_out && want_typedef()) {
2050 gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
2051 flush_varargs();
2052 }
2053 #endif
2054 free_decl_spec(&yystack.l_mark[-1].decl_spec);
2055 end_typedef();
2056 }
2057 break;
2058 case 16:
2059 #line 417 "grammar.y"
2060 {
2061 if (func_params != NULL) {
2062 set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
2063 } else {
2064 gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
2065 #if OPT_LINTLIBRARY
2066 flush_varargs();
2067 #endif
2068 free_decl_list(&yystack.l_mark[-1].decl_list);
2069 }
2070 free_decl_spec(&yystack.l_mark[-2].decl_spec);
2071 end_typedef();
2072 }
2073 break;
2074 case 17:
2075 #line 431 "grammar.y"
2076 {
2077 cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
2078 free_decl_spec(&yystack.l_mark[0].decl_spec);
2079 }
2080 break;
2081 case 18:
2082 #line 436 "grammar.y"
2083 {
2084 end_typedef();
2085 }
2086 break;
2087 case 19:
2088 #line 443 "grammar.y"
2089 {
2090 begin_typedef();
2091 }
2092 break;
2093 case 20:
2094 #line 447 "grammar.y"
2095 {
2096 begin_typedef();
2097 }
2098 break;
2099 case 23:
2100 #line 459 "grammar.y"
2101 {
2102 int flags = cur_decl_spec_flags;
2103
2104 /* If the typedef is a pointer type, then reset the short type
2105 * flags so it does not get promoted.
2106 */
2107 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
2108 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
2109 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
2110 free_declarator(yystack.l_mark[0].declarator);
2111 }
2112 break;
2113 case 24:
2114 #line 471 "grammar.y"
2115 {
2116 int flags = cur_decl_spec_flags;
2117
2118 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
2119 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
2120 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
2121 free_declarator(yystack.l_mark[0].declarator);
2122 }
2123 break;
2124 case 25:
2125 #line 483 "grammar.y"
2126 {
2127 check_untagged(&yystack.l_mark[-1].decl_spec);
2128 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
2129 yyerror("syntax error");
2130 YYERROR;
2131 }
2132 func_params = &(yystack.l_mark[0].declarator->head->params);
2133 func_params->begin_comment = cur_file->begin_comment;
2134 func_params->end_comment = cur_file->end_comment;
2135 }
2136 break;
2137 case 26:
2138 #line 494 "grammar.y"
2139 {
2140 /* If we're converting to K&R and we've got a nominally K&R
2141 * function which has a parameter which is ANSI (i.e., a prototyped
2142 * function pointer), then we must override the deciphered value of
2143 * 'func_def' so that the parameter will be converted.
2144 */
2145 if (func_style == FUNC_TRADITIONAL
2146 && haveAnsiParam()
2147 && yystack.l_mark[-3].declarator->head->func_def == func_style) {
2148 yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH;
2149 }
2150
2151 func_params = NULL;
2152
2153 if (cur_file->convert)
2154 gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
2155 gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
2156 #if OPT_LINTLIBRARY
2157 flush_varargs();
2158 #endif
2159 free_decl_spec(&yystack.l_mark[-4].decl_spec);
2160 free_declarator(yystack.l_mark[-3].declarator);
2161 }
2162 break;
2163 case 28:
2164 #line 519 "grammar.y"
2165 {
2166 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
2167 yyerror("syntax error");
2168 YYERROR;
2169 }
2170 func_params = &(yystack.l_mark[0].declarator->head->params);
2171 func_params->begin_comment = cur_file->begin_comment;
2172 func_params->end_comment = cur_file->end_comment;
2173 }
2174 break;
2175 case 29:
2176 #line 529 "grammar.y"
2177 {
2178 DeclSpec decl_spec;
2179
2180 func_params = NULL;
2181
2182 new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE);
2183 if (cur_file->convert)
2184 gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
2185 gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
2186 #if OPT_LINTLIBRARY
2187 flush_varargs();
2188 #endif
2189 free_decl_spec(&decl_spec);
2190 free_declarator(yystack.l_mark[-4].declarator);
2191 }
2192 break;
2193 case 36:
2194 #line 560 "grammar.y"
2195 {
2196 join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
2197 free(yystack.l_mark[-1].decl_spec.text);
2198 free(yystack.l_mark[0].decl_spec.text);
2199 }
2200 break;
2201 case 40:
2202 #line 575 "grammar.y"
2203 {
2204 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2205 }
2206 break;
2207 case 41:
2208 #line 579 "grammar.y"
2209 {
2210 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
2211 }
2212 break;
2213 case 42:
2214 #line 583 "grammar.y"
2215 {
2216 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2217 }
2218 break;
2219 case 43:
2220 #line 587 "grammar.y"
2221 {
2222 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
2223 }
2224 break;
2225 case 44:
2226 #line 591 "grammar.y"
2227 {
2228 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
2229 }
2230 break;
2231 case 45:
2232 #line 595 "grammar.y"
2233 {
2234 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
2235 }
2236 break;
2237 case 46:
2238 #line 602 "grammar.y"
2239 {
2240 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
2241 }
2242 break;
2243 case 47:
2244 #line 606 "grammar.y"
2245 {
2246 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2247 }
2248 break;
2249 case 48:
2250 #line 610 "grammar.y"
2251 {
2252 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
2253 }
2254 break;
2255 case 49:
2256 #line 614 "grammar.y"
2257 {
2258 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2259 }
2260 break;
2261 case 50:
2262 #line 618 "grammar.y"
2263 {
2264 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2265 }
2266 break;
2267 case 51:
2268 #line 622 "grammar.y"
2269 {
2270 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
2271 }
2272 break;
2273 case 52:
2274 #line 626 "grammar.y"
2275 {
2276 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2277 }
2278 break;
2279 case 53:
2280 #line 630 "grammar.y"
2281 {
2282 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2283 }
2284 break;
2285 case 54:
2286 #line 634 "grammar.y"
2287 {
2288 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2289 }
2290 break;
2291 case 55:
2292 #line 638 "grammar.y"
2293 {
2294 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
2295 }
2296 break;
2297 case 56:
2298 #line 642 "grammar.y"
2299 {
2300 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2301 }
2302 break;
2303 case 57:
2304 #line 646 "grammar.y"
2305 {
2306 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2307 }
2308 break;
2309 case 58:
2310 #line 650 "grammar.y"
2311 {
2312 Symbol *s;
2313 s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
2314 if (s != NULL)
2315 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
2316 }
2317 break;
2318 case 61:
2319 #line 662 "grammar.y"
2320 {
2321 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2322 }
2323 break;
2324 case 62:
2325 #line 666 "grammar.y"
2326 {
2327 /* This rule allows the <pointer> nonterminal to scan #define
2328 * names as if they were type modifiers.
2329 */
2330 Symbol *s;
2331 s = find_symbol(define_names, yystack.l_mark[0].text.text);
2332 if (s != NULL)
2333 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
2334 }
2335 break;
2336 case 63:
2337 #line 679 "grammar.y"
2338 {
2339 char *s;
2340 if ((s = implied_typedef()) == 0)
2341 (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text);
2342 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
2343 }
2344 break;
2345 case 64:
2346 #line 686 "grammar.y"
2347 {
2348 char *s;
2349 if ((s = implied_typedef()) == 0)
2350 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
2351 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
2352 }
2353 break;
2354 case 65:
2355 #line 693 "grammar.y"
2356 {
2357 (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
2358 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
2359 }
2360 break;
2361 case 66:
2362 #line 701 "grammar.y"
2363 {
2364 imply_typedef(yyval.text.text);
2365 }
2366 break;
2367 case 67:
2368 #line 705 "grammar.y"
2369 {
2370 imply_typedef(yyval.text.text);
2371 }
2372 break;
2373 case 68:
2374 #line 712 "grammar.y"
2375 {
2376 new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
2377 }
2378 break;
2379 case 69:
2380 #line 716 "grammar.y"
2381 {
2382 add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
2383 }
2384 break;
2385 case 70:
2386 #line 723 "grammar.y"
2387 {
2388 if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
2389 func_style == FUNC_TRADITIONAL && cur_file->convert) {
2390 gen_func_declarator(yystack.l_mark[0].declarator);
2391 fputs(cur_text(), cur_file->tmp_file);
2392 }
2393 cur_declarator = yyval.declarator;
2394 }
2395 break;
2396 case 71:
2397 #line 732 "grammar.y"
2398 {
2399 if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
2400 func_style == FUNC_TRADITIONAL && cur_file->convert) {
2401 gen_func_declarator(yystack.l_mark[-1].declarator);
2402 fputs(" =", cur_file->tmp_file);
2403 }
2404 }
2405 break;
2406 case 73:
2407 #line 744 "grammar.y"
2408 {
2409 char *s;
2410 if ((s = implied_typedef()) == 0)
2411 (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text);
2412 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
2413 }
2414 break;
2415 case 74:
2416 #line 751 "grammar.y"
2417 {
2418 char *s;
2419 if ((s = implied_typedef()) == 0)
2420 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
2421 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
2422 }
2423 break;
2424 case 75:
2425 #line 758 "grammar.y"
2426 {
2427 (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
2428 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
2429 }
2430 break;
2431 case 76:
2432 #line 766 "grammar.y"
2433 {
2434 imply_typedef("enum");
2435 yyval.text = yystack.l_mark[0].text;
2436 }
2437 break;
2438 case 79:
2439 #line 779 "grammar.y"
2440 {
2441 yyval.declarator = yystack.l_mark[0].declarator;
2442 (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
2443 free(yyval.declarator->text);
2444 yyval.declarator->text = xstrdup(buf);
2445 yyval.declarator->begin = yystack.l_mark[-1].text.begin;
2446 yyval.declarator->pointer = TRUE;
2447 }
2448 break;
2449 case 81:
2450 #line 792 "grammar.y"
2451 {
2452 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
2453 }
2454 break;
2455 case 82:
2456 #line 796 "grammar.y"
2457 {
2458 yyval.declarator = yystack.l_mark[-1].declarator;
2459 (void)sprintf(buf, "(%s)", yyval.declarator->text);
2460 free(yyval.declarator->text);
2461 yyval.declarator->text = xstrdup(buf);
2462 yyval.declarator->begin = yystack.l_mark[-2].text.begin;
2463 }
2464 break;
2465 case 83:
2466 #line 804 "grammar.y"
2467 {
2468 yyval.declarator = yystack.l_mark[-1].declarator;
2469 (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
2470 free(yyval.declarator->text);
2471 yyval.declarator->text = xstrdup(buf);
2472 }
2473 break;
2474 case 84:
2475 #line 811 "grammar.y"
2476 {
2477 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
2478 yyval.declarator->params = yystack.l_mark[-1].param_list;
2479 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2480 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2481 yyval.declarator->func_def = FUNC_ANSI;
2482 }
2483 break;
2484 case 85:
2485 #line 819 "grammar.y"
2486 {
2487 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
2488 yyval.declarator->params = yystack.l_mark[-1].param_list;
2489 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2490 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2491 yyval.declarator->func_def = FUNC_TRADITIONAL;
2492 }
2493 break;
2494 case 86:
2495 #line 830 "grammar.y"
2496 {
2497 (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
2498 yyval.text.begin = yystack.l_mark[-1].text.begin;
2499 }
2500 break;
2501 case 87:
2502 #line 835 "grammar.y"
2503 {
2504 (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
2505 yyval.text.begin = yystack.l_mark[-2].text.begin;
2506 }
2507 break;
2508 case 88:
2509 #line 843 "grammar.y"
2510 {
2511 strcpy(yyval.text.text, "");
2512 yyval.text.begin = 0L;
2513 }
2514 break;
2515 case 90:
2516 #line 852 "grammar.y"
2517 {
2518 (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
2519 yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
2520 free(yystack.l_mark[0].decl_spec.text);
2521 }
2522 break;
2523 case 91:
2524 #line 858 "grammar.y"
2525 {
2526 (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
2527 yyval.text.begin = yystack.l_mark[-1].text.begin;
2528 free(yystack.l_mark[0].decl_spec.text);
2529 }
2530 break;
2531 case 93:
2532 #line 868 "grammar.y"
2533 {
2534 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
2535 }
2536 break;
2537 case 94:
2538 #line 875 "grammar.y"
2539 {
2540 new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
2541 }
2542 break;
2543 case 95:
2544 #line 879 "grammar.y"
2545 {
2546 add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
2547 }
2548 break;
2549 case 96:
2550 #line 886 "grammar.y"
2551 {
2552 check_untagged(&yystack.l_mark[-1].decl_spec);
2553 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
2554 }
2555 break;
2556 case 97:
2557 #line 891 "grammar.y"
2558 {
2559 check_untagged(&yystack.l_mark[-1].decl_spec);
2560 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
2561 }
2562 break;
2563 case 98:
2564 #line 896 "grammar.y"
2565 {
2566 check_untagged(&yystack.l_mark[0].decl_spec);
2567 yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
2568 }
2569 break;
2570 case 99:
2571 #line 904 "grammar.y"
2572 {
2573 new_ident_list(&yyval.param_list);
2574 }
2575 break;
2576 case 101:
2577 #line 912 "grammar.y"
2578 {
2579 new_ident_list(&yyval.param_list);
2580 add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
2581 }
2582 break;
2583 case 102:
2584 #line 917 "grammar.y"
2585 {
2586 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
2587 }
2588 break;
2589 case 103:
2590 #line 924 "grammar.y"
2591 {
2592 yyval.text = yystack.l_mark[0].text;
2593 }
2594 break;
2595 case 104:
2596 #line 928 "grammar.y"
2597 {
2598 #if OPT_LINTLIBRARY
2599 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
2600 yyval.text = yystack.l_mark[0].text;
2601 } else
2602 #endif
2603 (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
2604 yyval.text.begin = yystack.l_mark[-1].text.begin;
2605 }
2606 break;
2607 case 105:
2608 #line 941 "grammar.y"
2609 {
2610 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
2611 }
2612 break;
2613 case 106:
2614 #line 945 "grammar.y"
2615 {
2616 yyval.declarator = yystack.l_mark[0].declarator;
2617 (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
2618 free(yyval.declarator->text);
2619 yyval.declarator->text = xstrdup(buf);
2620 yyval.declarator->begin = yystack.l_mark[-1].text.begin;
2621 }
2622 break;
2623 case 108:
2624 #line 957 "grammar.y"
2625 {
2626 yyval.declarator = yystack.l_mark[-1].declarator;
2627 (void)sprintf(buf, "(%s)", yyval.declarator->text);
2628 free(yyval.declarator->text);
2629 yyval.declarator->text = xstrdup(buf);
2630 yyval.declarator->begin = yystack.l_mark[-2].text.begin;
2631 }
2632 break;
2633 case 109:
2634 #line 965 "grammar.y"
2635 {
2636 yyval.declarator = yystack.l_mark[-1].declarator;
2637 (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
2638 free(yyval.declarator->text);
2639 yyval.declarator->text = xstrdup(buf);
2640 }
2641 break;
2642 case 110:
2643 #line 972 "grammar.y"
2644 {
2645 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
2646 }
2647 break;
2648 case 111:
2649 #line 976 "grammar.y"
2650 {
2651 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
2652 yyval.declarator->params = yystack.l_mark[-1].param_list;
2653 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2654 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2655 yyval.declarator->func_def = FUNC_ANSI;
2656 }
2657 break;
2658 case 112:
2659 #line 984 "grammar.y"
2660 {
2661 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
2662 yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
2663 yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
2664 yyval.declarator->func_def = FUNC_ANSI;
2665 }
2666 break;
2667 case 113:
2668 #line 991 "grammar.y"
2669 {
2670 Declarator *d;
2671
2672 d = new_declarator("", "", yystack.l_mark[-2].text.begin);
2673 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin);
2674 yyval.declarator->params = yystack.l_mark[-1].param_list;
2675 yyval.declarator->func_stack = d;
2676 yyval.declarator->head = yyval.declarator;
2677 yyval.declarator->func_def = FUNC_ANSI;
2678 }
2679 break;
2680 case 114:
2681 #line 1002 "grammar.y"
2682 {
2683 Declarator *d;
2684
2685 d = new_declarator("", "", yystack.l_mark[-1].text.begin);
2686 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin);
2687 yyval.declarator->func_stack = d;
2688 yyval.declarator->head = yyval.declarator;
2689 yyval.declarator->func_def = FUNC_ANSI;
2690 }
2691 break;
2692 #line 2691 "grammar.tab.c"
2693 default:
2694 break;
2695 }
2696 yystack.s_mark -= yym;
2697 yystate = *yystack.s_mark;
2698 yystack.l_mark -= yym;
2699 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2700 yystack.p_mark -= yym;
2701 #endif
2702 yym = yylhs[yyn];
2703 if (yystate == 0 && yym == 0)
2704 {
2705 #if YYDEBUG
2706 if (yydebug)
2707 {
2708 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2709 #ifdef YYSTYPE_TOSTRING
2710 #if YYBTYACC
2711 if (!yytrial)
2712 #endif /* YYBTYACC */
2713 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
2714 #endif
2715 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
2716 }
2717 #endif
2718 yystate = YYFINAL;
2719 *++yystack.s_mark = YYFINAL;
2720 *++yystack.l_mark = yyval;
2721 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2722 *++yystack.p_mark = yyloc;
2723 #endif
2724 if (yychar < 0)
2725 {
2726 #if YYBTYACC
2727 do {
2728 if (yylvp < yylve)
2729 {
2730 /* we're currently re-reading tokens */
2731 yylval = *yylvp++;
2732 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2733 yylloc = *yylpp++;
2734 #endif
2735 yychar = *yylexp++;
2736 break;
2737 }
2738 if (yyps->save)
2739 {
2740 /* in trial mode; save scanner results for future parse attempts */
2741 if (yylvp == yylvlim)
2742 { /* Enlarge lexical value queue */
2743 size_t p = (size_t) (yylvp - yylvals);
2744 size_t s = (size_t) (yylvlim - yylvals);
2745
2746 s += YYLVQUEUEGROWTH;
2747 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
2748 goto yyenomem;
2749 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2750 goto yyenomem;
2751 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2752 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
2753 goto yyenomem;
2754 #endif
2755 yylvp = yylve = yylvals + p;
2756 yylvlim = yylvals + s;
2757 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2758 yylpp = yylpe = yylpsns + p;
2759 yylplim = yylpsns + s;
2760 #endif
2761 yylexp = yylexemes + p;
2762 }
2763 *yylexp = (YYINT) YYLEX;
2764 *yylvp++ = yylval;
2765 yylve++;
2766 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2767 *yylpp++ = yylloc;
2768 yylpe++;
2769 #endif
2770 yychar = *yylexp++;
2771 break;
2772 }
2773 /* normal operation, no conflict encountered */
2774 #endif /* YYBTYACC */
2775 yychar = YYLEX;
2776 #if YYBTYACC
2777 } while (0);
2778 #endif /* YYBTYACC */
2779 if (yychar < 0) yychar = YYEOF;
2780 #if YYDEBUG
2781 if (yydebug)
2782 {
2783 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
2784 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
2785 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
2786 }
2787 #endif
2788 }
2789 if (yychar == YYEOF) goto yyaccept;
2790 goto yyloop;
2791 }
2792 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
2793 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
2794 yystate = yytable[yyn];
2795 else
2796 yystate = yydgoto[yym];
2797 #if YYDEBUG
2798 if (yydebug)
2799 {
2800 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2801 #ifdef YYSTYPE_TOSTRING
2802 #if YYBTYACC
2803 if (!yytrial)
2804 #endif /* YYBTYACC */
2805 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
2806 #endif
2807 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
2808 }
2809 #endif
2810 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
2811 *++yystack.s_mark = (YYINT) yystate;
2812 *++yystack.l_mark = yyval;
2813 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2814 *++yystack.p_mark = yyloc;
2815 #endif
2816 goto yyloop;
2817 #if YYBTYACC
2818
2819 /* Reduction declares that this path is valid. Set yypath and do a full parse */
2820 yyvalid:
2821 if (yypath) YYABORT;
2822 while (yyps->save)
2823 {
2824 YYParseState *save = yyps->save;
2825 yyps->save = save->save;
2826 save->save = yypath;
2827 yypath = save;
2828 }
2829 #if YYDEBUG
2830 if (yydebug)
2831 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
2832 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
2833 #endif
2834 if (yyerrctx)
2835 {
2836 yyFreeState(yyerrctx);
2837 yyerrctx = NULL;
2838 }
2839 yylvp = yylvals + yypath->lexeme;
2840 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2841 yylpp = yylpsns + yypath->lexeme;
2842 #endif
2843 yylexp = yylexemes + yypath->lexeme;
2844 yychar = YYEMPTY;
2845 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2846 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
2847 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2848 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2849 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2850 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2851 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2852 #endif
2853 yystate = yypath->state;
2854 goto yyloop;
2855 #endif /* YYBTYACC */
2856
2857 yyoverflow:
2858 YYERROR_CALL("yacc stack overflow");
2859 #if YYBTYACC
2860 goto yyabort_nomem;
2861 yyenomem:
2862 YYERROR_CALL("memory exhausted");
2863 yyabort_nomem:
2864 #endif /* YYBTYACC */
2865 yyresult = 2;
2866 goto yyreturn;
2867
2868 yyabort:
2869 yyresult = 1;
2870 goto yyreturn;
2871
2872 yyaccept:
2873 #if YYBTYACC
2874 if (yyps->save) goto yyvalid;
2875 #endif /* YYBTYACC */
2876 yyresult = 0;
2877
2878 yyreturn:
2879 #if defined(YYDESTRUCT_CALL)
2880 if (yychar != YYEOF && yychar != YYEMPTY)
2881 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2882 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
2883 #else
2884 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
2885 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2886
2887 {
2888 YYSTYPE *pv;
2889 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2890 YYLTYPE *pp;
2891
2892 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
2893 YYDESTRUCT_CALL("cleanup: discarding state",
2894 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
2895 #else
2896 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
2897 YYDESTRUCT_CALL("cleanup: discarding state",
2898 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
2899 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2900 }
2901 #endif /* defined(YYDESTRUCT_CALL) */
2902
2903 #if YYBTYACC
2904 if (yyerrctx)
2905 {
2906 yyFreeState(yyerrctx);
2907 yyerrctx = NULL;
2908 }
2909 while (yyps)
2910 {
2911 YYParseState *save = yyps;
2912 yyps = save->save;
2913 save->save = NULL;
2914 yyFreeState(save);
2915 }
2916 while (yypath)
2917 {
2918 YYParseState *save = yypath;
2919 yypath = save->save;
2920 save->save = NULL;
2921 yyFreeState(save);
2922 }
2923 #endif /* YYBTYACC */
2924 yyfreestack(&yystack);
2925 return (yyresult);
2926 }
2927