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