1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYCHECK "yyyymmdd"
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
18 #define YYDEBUGSTR YYPREFIX "debug"
21 #define yyparse grammar_parse
25 #define yylex grammar_lex
29 #define yyerror grammar_error
33 #define yychar grammar_char
37 #define yyval grammar_val
41 #define yylval grammar_lval
45 #define yydebug grammar_debug
49 #define yynerrs grammar_nerrs
53 #define yyerrflag grammar_errflag
54 #endif /* yyerrflag */
57 #define yylhs grammar_lhs
61 #define yylen grammar_len
65 #define yydefred grammar_defred
69 #define yystos grammar_stos
73 #define yydgoto grammar_dgoto
77 #define yysindex grammar_sindex
81 #define yyrindex grammar_rindex
85 #define yygindex grammar_gindex
89 #define yytable grammar_table
93 #define yycheck grammar_check
97 #define yyname grammar_name
101 #define yyrule grammar_rule
107 #define yycindex grammar_cindex
108 #endif /* yycindex */
111 #define yyctable grammar_ctable
112 #endif /* yyctable */
114 #endif /* YYBTYACC */
116 #define YYPREFIX "grammar_"
123 #define YYSTYPE_IS_DECLARED
124 #define yyerror yaccError
127 #if defined(YYBISON) || !defined(YYBYACC)
128 static void yyerror(const char *s);
135 #define OPT_LINTLIBRARY 1
145 /* #include "cproto.h" */
146 #define MAX_TEXT_SIZE 1024
148 /* Prototype styles */
150 #define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
151 #define PROTO_LINTLIBRARY -1 /* form lint-library source */
153 #define PROTO_NONE 0 /* do not output any prototypes */
154 #define PROTO_TRADITIONAL 1 /* comment out parameters */
155 #define PROTO_ABSTRACT 2 /* comment out parameter names */
156 #define PROTO_ANSI 3 /* ANSI C prototype */
158 typedef int PrototypeStyle;
160 typedef char boolean;
162 extern boolean types_out;
163 extern PrototypeStyle proto_style;
165 #define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
166 #define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY)
167 #define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
170 #define FUNC_UNKNOWN -1 /* unspecified */
172 #define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
174 #define FUNC_NONE 0 /* not a function definition */
175 #define FUNC_TRADITIONAL 1 /* traditional style */
176 #define FUNC_ANSI 2 /* ANSI style */
177 #define FUNC_BOTH 3 /* both styles */
179 typedef int FuncDefStyle;
181 /* Source file text */
182 typedef struct text {
183 char text[MAX_TEXT_SIZE]; /* source text */
184 long begin; /* offset in temporary file */
187 /* Declaration specifier flags */
188 #define DS_NONE 0 /* default */
189 #define DS_EXTERN 1 /* contains "extern" specifier */
190 #define DS_STATIC 2 /* contains "static" specifier */
191 #define DS_CHAR 4 /* contains "char" type specifier */
192 #define DS_SHORT 8 /* contains "short" type specifier */
193 #define DS_FLOAT 16 /* contains "float" type specifier */
194 #define DS_INLINE 32 /* contains "inline" specifier */
195 #define DS_JUNK 64 /* we're not interested in this declaration */
197 /* This structure stores information about a declaration specifier. */
198 typedef struct decl_spec {
199 unsigned short flags; /* flags defined above */
200 char *text; /* source text */
201 long begin; /* offset in temporary file */
204 /* This is a list of function parameters. */
205 typedef struct _ParameterList {
206 struct parameter *first; /* pointer to first parameter in list */
207 struct parameter *last; /* pointer to last parameter in list */
208 long begin_comment; /* begin offset of comment */
209 long end_comment; /* end offset of comment */
210 char *comment; /* comment at start of parameter list */
213 /* This structure stores information about a declarator. */
214 typedef struct _Declarator {
215 char *name; /* name of variable or function */
216 char *text; /* source text */
217 long begin; /* offset in temporary file */
218 long begin_comment; /* begin offset of comment */
219 long end_comment; /* end offset of comment */
220 FuncDefStyle func_def; /* style of function definition */
221 ParameterList params; /* function parameters */
222 boolean pointer; /* TRUE if it declares a pointer */
223 struct _Declarator *head; /* head function declarator */
224 struct _Declarator *func_stack; /* stack of function declarators */
225 struct _Declarator *next; /* next declarator in list */
228 /* This structure stores information about a function parameter. */
229 typedef struct parameter {
230 struct parameter *next; /* next parameter in list */
232 Declarator *declarator;
233 char *comment; /* comment following the parameter */
236 /* This is a list of declarators. */
237 typedef struct declarator_list {
238 Declarator *first; /* pointer to first declarator in list */
239 Declarator *last; /* pointer to last declarator in list */
242 /* #include "symbol.h" */
243 typedef struct symbol {
244 struct symbol *next; /* next symbol in list */
245 char *name; /* name of symbol */
246 char *value; /* value of symbol (for defines) */
247 short flags; /* symbol attributes */
250 /* parser stack entry type */
254 Parameter *parameter;
255 ParameterList param_list;
256 Declarator *declarator;
257 DeclaratorList decl_list;
260 /* The hash table length should be a prime number. */
261 #define SYM_MAX_HASH 251
263 typedef struct symbol_table {
264 Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
267 extern SymbolTable *new_symbol_table /* Create symbol table */
269 extern void free_symbol_table /* Destroy symbol table */
271 extern Symbol *find_symbol /* Lookup symbol name */
272 (SymbolTable *s, const char *n);
273 extern Symbol *new_symbol /* Define new symbol */
274 (SymbolTable *s, const char *n, const char *v, int f);
276 /* #include "semantic.h" */
277 extern void new_decl_spec (DeclSpec *, const char *, long, int);
278 extern void free_decl_spec (DeclSpec *);
279 extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
280 extern void check_untagged (DeclSpec *);
281 extern Declarator *new_declarator (const char *, const char *, long);
282 extern void free_declarator (Declarator *);
283 extern void new_decl_list (DeclaratorList *, Declarator *);
284 extern void free_decl_list (DeclaratorList *);
285 extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
286 extern Parameter *new_parameter (DeclSpec *, Declarator *);
287 extern void free_parameter (Parameter *);
288 extern void new_param_list (ParameterList *, Parameter *);
289 extern void free_param_list (ParameterList *);
290 extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
291 extern void new_ident_list (ParameterList *);
292 extern void add_ident_list (ParameterList *, ParameterList *, const char *);
293 extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
294 extern void gen_declarations (DeclSpec *, DeclaratorList *);
295 extern void gen_prototype (DeclSpec *, Declarator *);
296 extern void gen_func_declarator (Declarator *);
297 extern void gen_func_definition (DeclSpec *, Declarator *);
299 extern void init_parser (void);
300 extern void process_file (FILE *infile, char *name);
301 extern char *cur_text (void);
302 extern char *cur_file_name (void);
303 extern char *implied_typedef (void);
304 extern void include_file (char *name, int convert);
305 extern char *supply_parm (int count);
306 extern char *xstrdup (const char *);
307 extern int already_declared (char *name);
308 extern int is_actual_func (Declarator *d);
309 extern int lint_ellipsis (Parameter *p);
310 extern int want_typedef (void);
311 extern void begin_tracking (void);
312 extern void begin_typedef (void);
313 extern void copy_typedef (char *s);
314 extern void ellipsis_varargs (Declarator *d);
315 extern void end_typedef (void);
316 extern void flush_varargs (void);
317 extern void fmt_library (int code);
318 extern void imply_typedef (const char *s);
319 extern void indent (FILE *outf);
320 extern void put_blankline (FILE *outf);
321 extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
322 extern void put_char (FILE *outf, int c);
323 extern void put_error (void);
324 extern void put_newline (FILE *outf);
325 extern void put_padded (FILE *outf, const char *s);
326 extern void put_string (FILE *outf, const char *s);
327 extern void track_in (void);
329 extern boolean file_comments;
330 extern FuncDefStyle func_style;
331 extern char base_file[];
333 extern int yylex (void);
335 /* declaration specifier attributes for the typedef statement currently being
338 static int cur_decl_spec_flags;
340 /* pointer to parameter list for the current function definition */
341 static ParameterList *func_params;
343 /* A parser semantic action sets this pointer to the current declarator in
344 * a function parameter declaration in order to catch any comments following
345 * the parameter declaration on the same line. If the lexer scans a comment
346 * and <cur_declarator> is not NULL, then the comment is attached to the
347 * declarator. To ignore subsequent comments, the lexer sets this to NULL
348 * after scanning a comment or end of line.
350 static Declarator *cur_declarator;
352 /* temporary string buffer */
353 static char buf[MAX_TEXT_SIZE];
355 /* table of typedef names */
356 static SymbolTable *typedef_names;
358 /* table of define names */
359 static SymbolTable *define_names;
361 /* table of type qualifiers */
362 static SymbolTable *type_qualifiers;
364 /* information about the current input file */
366 char *base_name; /* base input file name */
367 char *file_name; /* current file name */
368 FILE *file; /* input file */
369 unsigned line_num; /* current line number in input file */
370 FILE *tmp_file; /* temporary file */
371 long begin_comment; /* tmp file offset after last written ) or ; */
372 long end_comment; /* tmp file offset after last comment */
373 boolean convert; /* if TRUE, convert function definitions */
374 boolean changed; /* TRUE if conversion done in this file */
377 static IncludeStack *cur_file; /* current input file */
379 /* #include "yyerror.c" */
381 static int haveAnsiParam (void);
384 /* Flags to enable us to find if a procedure returns a value.
386 static int return_val; /* nonzero on BRACES iff return-expression found */
391 return (lintLibrary() && !return_val) ? "void" : "int";
398 if (func_params != 0) {
399 for (p = func_params->first; p != 0; p = p->next) {
400 if (p->declarator->func_def == FUNC_ANSI) {
407 #line 408 "grammar.tab.c"
409 /* compatibility with bison */
411 /* compatibility with FreeBSD */
412 # ifdef YYPARSE_PARAM_TYPE
413 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
415 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
418 # define YYPARSE_DECL() yyparse(void)
421 /* Parameters sent to lex. */
423 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
424 # define YYLEX yylex(YYLEX_PARAM)
426 # define YYLEX_DECL() yylex(void)
427 # define YYLEX yylex()
430 /* Parameters sent to yyerror. */
432 #define YYERROR_DECL() yyerror(const char *s)
435 #define YYERROR_CALL(msg) yyerror(msg)
438 extern int YYPARSE_DECL();
440 #define T_IDENTIFIER 257
441 #define T_TYPEDEF_NAME 258
442 #define T_DEFINE_NAME 259
445 #define T_REGISTER 262
447 #define T_TYPEDEF 264
449 #define T_EXTENSION 266
458 #define T_UNSIGNED 275
463 #define T_Complex 280
464 #define T_Imaginary 281
465 #define T_TYPE_QUALIFIER 282
466 #define T_BRACKETS 283
468 #define T_MATCHRBRACE 285
469 #define T_ELLIPSIS 286
470 #define T_INITIALIZER 287
471 #define T_STRING_LITERAL 288
475 #define YYERRCODE 256
477 static const YYINT grammar_lhs[] = { -1,
478 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
479 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
480 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
481 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
482 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
483 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
484 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
485 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
486 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
487 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
488 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
491 static const YYINT grammar_len[] = { 2,
492 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
493 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
494 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
495 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
496 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
497 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
499 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
500 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
501 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
502 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
505 static const YYINT grammar_defred[] = { 0,
506 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
507 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
508 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
509 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
510 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
511 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
512 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
513 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
514 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
515 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
516 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
517 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
518 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
519 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
520 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
522 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
523 static const YYINT grammar_stos[] = { 0,
524 256, 40, 42, 38, 257, 258, 259, 260, 261, 262,
525 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
526 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
527 289, 59, 293, 294, 295, 296, 297, 298, 299, 300,
528 303, 304, 312, 313, 316, 317, 318, 319, 320, 321,
529 322, 323, 325, 285, 59, 258, 303, 298, 314, 315,
530 316, 288, 264, 290, 261, 266, 59, 295, 301, 302,
531 303, 332, 40, 283, 284, 316, 324, 304, 316, 324,
532 320, 258, 294, 41, 313, 298, 294, 321, 324, 59,
533 59, 44, 61, 330, 291, 321, 329, 333, 294, 307,
534 308, 309, 310, 311, 316, 285, 324, 324, 327, 303,
535 302, 334, 329, 284, 321, 40, 283, 303, 305, 306,
536 313, 41, 44, 41, 44, 303, 326, 328, 287, 284,
537 285, 41, 305, 307, 40, 283, 306, 286, 309, 316,
538 59, 44, 331, 41, 41, 41, 307, 303, 285, 41,
540 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
541 static const YYINT grammar_dgoto[] = { 33,
542 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
543 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
544 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
545 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
548 static const YYINT grammar_sindex[] = { -2,
549 -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
550 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
551 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
552 -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
553 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
554 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
555 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
556 -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
557 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
558 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
559 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
560 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
561 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
562 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
563 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
565 static const YYINT grammar_rindex[] = { 99,
566 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
567 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
568 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
569 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
570 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
571 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
572 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
573 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
574 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
575 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
576 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
577 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
578 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
579 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
580 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
583 static const YYINT grammar_cindex[] = { 0,
584 0, 0, 0, 0, 0, 0, 0, 0, 0, 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,
601 static const YYINT grammar_gindex[] = { 0,
602 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
603 -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
604 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
605 -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
608 #define YYTABLESIZE 924
609 static const YYINT grammar_table[] = { 58,
610 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
611 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
612 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
613 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
614 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
615 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
616 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
617 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
618 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
619 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
620 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
621 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
622 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
623 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
624 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
625 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
626 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
627 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
628 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
629 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
630 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
631 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
632 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
633 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
634 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
635 3, 17, 78, 1, 5, 6, 7, 8, 9, 10,
636 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
637 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
638 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
639 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
640 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
641 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
642 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
643 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
644 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
645 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
646 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
647 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
648 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
649 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
650 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
651 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
652 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
653 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
654 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
655 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
656 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
657 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
658 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
659 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
660 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
661 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
662 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
663 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
664 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
665 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
666 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
667 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
668 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
669 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
670 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
671 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
672 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
673 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
674 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
675 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
676 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
677 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
678 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
679 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
680 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
681 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
682 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
683 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
684 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
685 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
686 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
687 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
688 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
689 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
690 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
691 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
692 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
693 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
694 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
695 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
696 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
697 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
698 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
699 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
700 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
701 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
704 static const YYINT grammar_check[] = { 38,
705 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
706 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
707 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
708 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
709 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
710 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
711 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
712 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
713 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
714 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
715 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
716 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
717 -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
718 -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
719 -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
720 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
721 -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
722 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
723 -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
724 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
725 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
726 -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
727 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
728 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
729 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
730 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
731 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
732 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
733 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
734 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
735 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
736 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
737 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
738 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
739 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
740 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
741 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
742 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
743 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
744 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
745 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
746 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
747 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
748 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
749 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
750 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
751 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
752 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
753 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
754 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
755 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
756 -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
757 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
758 -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
759 -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
760 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
761 -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
762 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
763 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
764 -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
765 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
766 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
767 -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
768 -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
769 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
770 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
771 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
772 -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
773 -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
774 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
775 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
776 -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
777 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
778 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
779 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
780 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
781 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
782 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
783 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
784 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
785 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
786 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
787 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
788 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
789 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
790 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
791 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
792 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
793 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
794 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
795 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
796 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
800 static const YYINT grammar_ctable[] = { -1,
801 -1, -1, -1, -1, -1, -1, -1, -1, -1, -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,
900 #define YYMAXTOKEN 291
901 #define YYUNDFTOKEN 335
902 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
904 static const char *const grammar_name[] = {
906 "$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,
907 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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
909 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,"error",
913 "T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
914 "T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
915 "T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
916 "T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
917 "T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
918 "T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL","$accept",
919 "program","decl_specifiers","decl_specifier","storage_class","type_specifier",
920 "type_qualifier","struct_or_union_specifier","enum_specifier",
921 "init_declarator_list","init_declarator","declarator","direct_declarator",
922 "abs_declarator","direct_abs_declarator","parameter_type_list","parameter_list",
923 "parameter_declaration","opt_identifier_list","identifier_list",
924 "struct_or_union","pointer","opt_type_qualifiers","type_qualifier_list",
925 "any_id","identifier_or_ref","enumeration","translation_unit",
926 "external_declaration","declaration","function_definition",
927 "linkage_specification","braces","any_typedef","opt_declarator_list","$$1",
928 "declarator_list","opt_declaration_list","$$2","$$3","$$4","declaration_list",
929 "$$5","illegal-symbol",
931 static const char *const grammar_rule[] = {
934 "program : translation_unit",
935 "translation_unit : external_declaration",
936 "translation_unit : translation_unit external_declaration",
937 "external_declaration : declaration",
938 "external_declaration : function_definition",
939 "external_declaration : ';'",
940 "external_declaration : linkage_specification",
941 "external_declaration : T_ASM T_ASMARG ';'",
942 "external_declaration : error T_MATCHRBRACE",
943 "external_declaration : error ';'",
944 "braces : T_LBRACE T_MATCHRBRACE",
945 "linkage_specification : T_EXTERN T_STRING_LITERAL braces",
946 "linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
947 "declaration : decl_specifiers ';'",
948 "declaration : decl_specifiers init_declarator_list ';'",
950 "declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
951 "any_typedef : T_EXTENSION T_TYPEDEF",
952 "any_typedef : T_TYPEDEF",
953 "opt_declarator_list :",
954 "opt_declarator_list : declarator_list",
955 "declarator_list : declarator",
956 "declarator_list : declarator_list ',' declarator",
959 "function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
961 "function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
962 "opt_declaration_list :",
963 "opt_declaration_list : T_VA_DCL",
964 "opt_declaration_list : declaration_list",
965 "declaration_list : declaration",
966 "declaration_list : declaration_list declaration",
967 "decl_specifiers : decl_specifier",
968 "decl_specifiers : decl_specifiers decl_specifier",
969 "decl_specifier : storage_class",
970 "decl_specifier : type_specifier",
971 "decl_specifier : type_qualifier",
972 "storage_class : T_AUTO",
973 "storage_class : T_EXTERN",
974 "storage_class : T_REGISTER",
975 "storage_class : T_STATIC",
976 "storage_class : T_INLINE",
977 "storage_class : T_EXTENSION",
978 "type_specifier : T_CHAR",
979 "type_specifier : T_DOUBLE",
980 "type_specifier : T_FLOAT",
981 "type_specifier : T_INT",
982 "type_specifier : T_LONG",
983 "type_specifier : T_SHORT",
984 "type_specifier : T_SIGNED",
985 "type_specifier : T_UNSIGNED",
986 "type_specifier : T_VOID",
987 "type_specifier : T_Bool",
988 "type_specifier : T_Complex",
989 "type_specifier : T_Imaginary",
990 "type_specifier : T_TYPEDEF_NAME",
991 "type_specifier : struct_or_union_specifier",
992 "type_specifier : enum_specifier",
993 "type_qualifier : T_TYPE_QUALIFIER",
994 "type_qualifier : T_DEFINE_NAME",
995 "struct_or_union_specifier : struct_or_union any_id braces",
996 "struct_or_union_specifier : struct_or_union braces",
997 "struct_or_union_specifier : struct_or_union any_id",
998 "struct_or_union : T_STRUCT",
999 "struct_or_union : T_UNION",
1000 "init_declarator_list : init_declarator",
1001 "init_declarator_list : init_declarator_list ',' init_declarator",
1002 "init_declarator : declarator",
1004 "init_declarator : declarator '=' $$5 T_INITIALIZER",
1005 "enum_specifier : enumeration any_id braces",
1006 "enum_specifier : enumeration braces",
1007 "enum_specifier : enumeration any_id",
1008 "enumeration : T_ENUM",
1009 "any_id : T_IDENTIFIER",
1010 "any_id : T_TYPEDEF_NAME",
1011 "declarator : pointer direct_declarator",
1012 "declarator : direct_declarator",
1013 "direct_declarator : identifier_or_ref",
1014 "direct_declarator : '(' declarator ')'",
1015 "direct_declarator : direct_declarator T_BRACKETS",
1016 "direct_declarator : direct_declarator '(' parameter_type_list ')'",
1017 "direct_declarator : direct_declarator '(' opt_identifier_list ')'",
1018 "pointer : '*' opt_type_qualifiers",
1019 "pointer : '*' opt_type_qualifiers pointer",
1020 "opt_type_qualifiers :",
1021 "opt_type_qualifiers : type_qualifier_list",
1022 "type_qualifier_list : type_qualifier",
1023 "type_qualifier_list : type_qualifier_list type_qualifier",
1024 "parameter_type_list : parameter_list",
1025 "parameter_type_list : parameter_list ',' T_ELLIPSIS",
1026 "parameter_list : parameter_declaration",
1027 "parameter_list : parameter_list ',' parameter_declaration",
1028 "parameter_declaration : decl_specifiers declarator",
1029 "parameter_declaration : decl_specifiers abs_declarator",
1030 "parameter_declaration : decl_specifiers",
1031 "opt_identifier_list :",
1032 "opt_identifier_list : identifier_list",
1033 "identifier_list : any_id",
1034 "identifier_list : identifier_list ',' any_id",
1035 "identifier_or_ref : any_id",
1036 "identifier_or_ref : '&' any_id",
1037 "abs_declarator : pointer",
1038 "abs_declarator : pointer direct_abs_declarator",
1039 "abs_declarator : direct_abs_declarator",
1040 "direct_abs_declarator : '(' abs_declarator ')'",
1041 "direct_abs_declarator : direct_abs_declarator T_BRACKETS",
1042 "direct_abs_declarator : T_BRACKETS",
1043 "direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
1044 "direct_abs_declarator : direct_abs_declarator '(' ')'",
1045 "direct_abs_declarator : '(' parameter_type_list ')'",
1046 "direct_abs_declarator : '(' ')'",
1058 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1059 YYLTYPE yyloc; /* position returned by actions */
1060 YYLTYPE yylloc; /* position from the lexer */
1063 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1064 #ifndef YYLLOC_DEFAULT
1065 #define YYLLOC_DEFAULT(loc, rhs, n) \
1070 (loc).first_line = ((rhs)[-1]).last_line; \
1071 (loc).first_column = ((rhs)[-1]).last_column; \
1072 (loc).last_line = ((rhs)[-1]).last_line; \
1073 (loc).last_column = ((rhs)[-1]).last_column; \
1077 (loc).first_line = ((rhs)[ 0 ]).first_line; \
1078 (loc).first_column = ((rhs)[ 0 ]).first_column; \
1079 (loc).last_line = ((rhs)[n-1]).last_line; \
1080 (loc).last_column = ((rhs)[n-1]).last_column; \
1083 #endif /* YYLLOC_DEFAULT */
1084 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1087 #ifndef YYLVQUEUEGROWTH
1088 #define YYLVQUEUEGROWTH 32
1090 #endif /* YYBTYACC */
1092 /* define the initial stack-sizes */
1095 #define YYMAXDEPTH YYSTACKSIZE
1098 #define YYSTACKSIZE YYMAXDEPTH
1100 #define YYSTACKSIZE 10000
1101 #define YYMAXDEPTH 10000
1105 #ifndef YYINITSTACKSIZE
1106 #define YYINITSTACKSIZE 200
1116 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1123 struct YYParseState_s
1125 struct YYParseState_s *save; /* Previously saved parser state */
1126 YYSTACKDATA yystack; /* saved parser stack */
1127 int state; /* saved parser state */
1128 int errflag; /* saved error recovery status */
1129 int lexeme; /* saved index of the conflict lexeme in the lexical queue */
1130 YYINT ctry; /* saved index in yyctable[] for this conflict */
1132 typedef struct YYParseState_s YYParseState;
1133 #endif /* YYBTYACC */
1134 /* variables for the parser stack */
1135 static YYSTACKDATA yystack;
1138 /* Current parser state */
1139 static YYParseState *yyps = 0;
1141 /* yypath != NULL: do the full parse, starting at *yypath parser state. */
1142 static YYParseState *yypath = 0;
1144 /* Base of the lexical value queue */
1145 static YYSTYPE *yylvals = 0;
1147 /* Current position at lexical value queue */
1148 static YYSTYPE *yylvp = 0;
1150 /* End position of lexical value queue */
1151 static YYSTYPE *yylve = 0;
1153 /* The last allocated position at the lexical value queue */
1154 static YYSTYPE *yylvlim = 0;
1156 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1157 /* Base of the lexical position queue */
1158 static YYLTYPE *yylpsns = 0;
1160 /* Current position at lexical position queue */
1161 static YYLTYPE *yylpp = 0;
1163 /* End position of lexical position queue */
1164 static YYLTYPE *yylpe = 0;
1166 /* The last allocated position at the lexical position queue */
1167 static YYLTYPE *yylplim = 0;
1170 /* Current position at lexical token queue */
1171 static YYINT *yylexp = 0;
1173 static YYINT *yylexemes = 0;
1174 #endif /* YYBTYACC */
1175 #line 1014 "grammar.y"
1178 #define BEGIN yy_start = 1 + 2 *
1186 #define CPP_INLINE 7
1188 extern char *yytext;
1189 extern FILE *yyin, *yyout;
1191 static int curly; /* number of curly brace nesting levels */
1192 static int ly_count; /* number of occurances of %% */
1193 static int inc_depth; /* include nesting level */
1194 static SymbolTable *included_files; /* files already included */
1195 static int yy_start = 0; /* start state number */
1197 #define grammar_error(s) yaccError(s)
1200 yaccError (const char *msg)
1203 put_error(); /* tell what line we're on, and what file */
1204 fprintf(stderr, "%s at token '%s'\n", msg, yytext);
1207 /* Initialize the table of type qualifier keywords recognized by the lexical
1213 static const char *keywords[] = {
1222 #if defined(MSDOS) || defined(OS2)
1267 "__builtin_va_list",
1280 /* Initialize type qualifier table. */
1281 type_qualifiers = new_symbol_table();
1282 for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
1283 new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
1287 /* Process the C source file. Write function prototypes to the standard
1288 * output. Convert function definitions and write the converted source
1289 * code to a temporary file.
1292 process_file (FILE *infile, char *name)
1296 if (strlen(name) > 2) {
1297 s = name + strlen(name) - 2;
1300 if (*s == 'l' || *s == 'y')
1302 #if defined(MSDOS) || defined(OS2)
1303 if (*s == 'L' || *s == 'Y')
1309 included_files = new_symbol_table();
1310 typedef_names = new_symbol_table();
1311 define_names = new_symbol_table();
1317 include_file(strcpy(base_file, name), func_style != FUNC_NONE);
1318 if (file_comments) {
1320 if (lintLibrary()) {
1321 put_blankline(stdout);
1325 put_string(stdout, "/* ");
1326 put_string(stdout, cur_file_name());
1327 put_string(stdout, " */\n");
1330 free_symbol_table(define_names);
1331 free_symbol_table(typedef_names);
1332 free_symbol_table(included_files);
1339 free_symbol_table (type_qualifiers);
1341 if (yy_current_buffer != 0)
1342 yy_delete_buffer(yy_current_buffer);
1346 #line 1347 "grammar.tab.c"
1348 /* For use in generated program */
1349 #define yydepth (int)(yystack.s_mark - yystack.s_base)
1351 #define yytrial (yyps->save)
1352 #endif /* YYBTYACC */
1355 #include <stdio.h> /* needed for printf */
1358 #include <stdlib.h> /* needed for malloc, etc */
1359 #include <string.h> /* needed for memset */
1361 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
1362 static int yygrowstack(YYSTACKDATA *data)
1368 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1372 if ((newsize = data->stacksize) == 0)
1373 newsize = YYINITSTACKSIZE;
1374 else if (newsize >= YYMAXDEPTH)
1376 else if ((newsize *= 2) > YYMAXDEPTH)
1377 newsize = YYMAXDEPTH;
1379 i = (int) (data->s_mark - data->s_base);
1380 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
1384 data->s_base = newss;
1385 data->s_mark = newss + i;
1387 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
1391 data->l_base = newvs;
1392 data->l_mark = newvs + i;
1394 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1395 newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
1399 data->p_base = newps;
1400 data->p_mark = newps + i;
1403 data->stacksize = newsize;
1404 data->s_last = data->s_base + newsize - 1;
1408 fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
1413 #if YYPURE || defined(YY_NO_LEAKS)
1414 static void yyfreestack(YYSTACKDATA *data)
1418 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1421 memset(data, 0, sizeof(*data));
1424 #define yyfreestack(data) /* nothing */
1425 #endif /* YYPURE || defined(YY_NO_LEAKS) */
1428 static YYParseState *
1429 yyNewState(unsigned size)
1431 YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
1432 if (p == NULL) return NULL;
1434 p->yystack.stacksize = size;
1437 p->yystack.s_base = NULL;
1438 p->yystack.l_base = NULL;
1439 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1440 p->yystack.p_base = NULL;
1444 p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT));
1445 if (p->yystack.s_base == NULL) return NULL;
1446 p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
1447 if (p->yystack.l_base == NULL) return NULL;
1448 memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
1449 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1450 p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
1451 if (p->yystack.p_base == NULL) return NULL;
1452 memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
1459 yyFreeState(YYParseState *p)
1461 yyfreestack(&p->yystack);
1464 #endif /* YYBTYACC */
1466 #define YYABORT goto yyabort
1467 #define YYREJECT goto yyabort
1468 #define YYACCEPT goto yyaccept
1469 #define YYERROR goto yyerrlab
1471 #define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
1472 #define YYVALID_NESTED do { if (yyps->save && \
1473 yyps->save->save == 0) goto yyvalid; } while(0)
1474 #endif /* YYBTYACC */
1479 int yym, yyn, yystate, yyresult;
1482 YYParseState *yyerrctx = NULL;
1483 #endif /* YYBTYACC */
1484 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1485 YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
1490 if ((yys = getenv("YYDEBUG")) != 0)
1493 if (yyn >= '0' && yyn <= '9')
1494 yydebug = yyn - '0';
1497 fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
1499 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1500 memset(yyerror_loc_range, 0, sizeof(yyerror_loc_range));
1504 yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
1506 #endif /* YYBTYACC */
1515 memset(&yystack, 0, sizeof(yystack));
1518 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1519 yystack.s_mark = yystack.s_base;
1520 yystack.l_mark = yystack.l_base;
1521 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1522 yystack.p_mark = yystack.p_base;
1525 *yystack.s_mark = 0;
1528 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
1535 /* we're currently re-reading tokens */
1537 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1545 /* in trial mode; save scanner results for future parse attempts */
1546 if (yylvp == yylvlim)
1547 { /* Enlarge lexical value queue */
1548 size_t p = (size_t) (yylvp - yylvals);
1549 size_t s = (size_t) (yylvlim - yylvals);
1551 s += YYLVQUEUEGROWTH;
1552 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem;
1553 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
1554 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1555 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
1557 yylvp = yylve = yylvals + p;
1558 yylvlim = yylvals + s;
1559 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1560 yylpp = yylpe = yylpsns + p;
1561 yylplim = yylpsns + s;
1563 yylexp = yylexemes + p;
1565 *yylexp = (YYINT) YYLEX;
1568 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1575 /* normal operation, no conflict encountered */
1576 #endif /* YYBTYACC */
1580 #endif /* YYBTYACC */
1581 if (yychar < 0) yychar = YYEOF;
1585 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1586 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
1587 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1588 #ifdef YYSTYPE_TOSTRING
1591 #endif /* YYBTYACC */
1592 fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
1594 fputc('\n', stderr);
1600 /* Do we have a conflict? */
1601 if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1602 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1611 fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
1612 YYDEBUGSTR, yydepth, yystate);
1614 /* Switch to the next conflict context */
1616 yypath = save->save;
1619 if (save->state != yystate) YYABORT;
1626 /* Unresolved conflict - start/continue trial parse */
1631 fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
1633 fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
1635 fputs("Starting trial parse.\n", stderr);
1638 save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1639 if (save == NULL) goto yyenomem;
1640 save->save = yyps->save;
1641 save->state = yystate;
1642 save->errflag = yyerrflag;
1643 save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
1644 memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1645 save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
1646 memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1647 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1648 save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
1649 memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1651 ctry = yytable[yyn];
1652 if (yyctable[ctry] == -1)
1655 if (yydebug && yychar >= YYEOF)
1656 fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
1661 if (yyps->save == NULL)
1663 /* If this is a first conflict in the stack, start saving lexemes */
1666 yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT));
1667 if (yylexemes == NULL) goto yyenomem;
1668 yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
1669 if (yylvals == NULL) goto yyenomem;
1670 yylvlim = yylvals + YYLVQUEUEGROWTH;
1671 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1672 yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
1673 if (yylpsns == NULL) goto yyenomem;
1674 yylplim = yylpsns + YYLVQUEUEGROWTH;
1679 yylvp = yylve = yylvals;
1680 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1681 yylpp = yylpe = yylpsns;
1684 if (yychar >= YYEOF)
1687 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1690 *yylexp = (YYINT) yychar;
1695 if (yychar >= YYEOF)
1698 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1704 save->lexeme = (int) (yylvp - yylvals);
1707 if (yytable[yyn] == ctry)
1711 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1712 YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
1717 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1722 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1724 yystate = yyctable[ctry];
1725 *++yystack.s_mark = (YYINT) yystate;
1726 *++yystack.l_mark = yylval;
1727 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1728 *++yystack.p_mark = yylloc;
1731 if (yyerrflag > 0) --yyerrflag;
1736 yyn = yyctable[ctry];
1739 } /* End of code dealing with conflicts */
1740 #endif /* YYBTYACC */
1741 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1742 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1746 fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
1747 YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
1749 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1750 yystate = yytable[yyn];
1751 *++yystack.s_mark = yytable[yyn];
1752 *++yystack.l_mark = yylval;
1753 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1754 *++yystack.p_mark = yylloc;
1757 if (yyerrflag > 0) --yyerrflag;
1760 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
1761 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
1766 if (yyerrflag != 0) goto yyinrecovery;
1771 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1774 /* explicit YYERROR from an action -- pop the rhs of the rule reduced
1775 * before looking for error recovery */
1776 yystack.s_mark -= yym;
1777 yystate = *yystack.s_mark;
1778 yystack.l_mark -= yym;
1779 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1780 yystack.p_mark -= yym;
1788 YYParseState *save = yyps->save;
1791 fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
1792 YYDEBUGSTR, yydepth, yystate, yyps->save->state,
1793 (int)(yylvp - yylvals - yyps->save->lexeme));
1795 /* Memorize most forward-looking error state in case it's really an error. */
1796 if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
1798 /* Free old saved error context state */
1799 if (yyerrctx) yyFreeState(yyerrctx);
1800 /* Create and fill out new saved error context state */
1801 yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
1802 if (yyerrctx == NULL) goto yyenomem;
1803 yyerrctx->save = yyps->save;
1804 yyerrctx->state = yystate;
1805 yyerrctx->errflag = yyerrflag;
1806 yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
1807 memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1808 yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
1809 memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1810 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1811 yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
1812 memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1814 yyerrctx->lexeme = (int) (yylvp - yylvals);
1816 yylvp = yylvals + save->lexeme;
1817 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1818 yylpp = yylpsns + save->lexeme;
1820 yylexp = yylexemes + save->lexeme;
1822 yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
1823 memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1824 yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
1825 memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1826 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1827 yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
1828 memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1830 ctry = ++save->ctry;
1831 yystate = save->state;
1832 /* We tried shift, try reduce now */
1833 if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
1834 yyps->save = save->save;
1838 /* Nothing left on the stack -- error */
1843 fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
1846 /* Restore state as it was in the most forward-advanced error */
1847 yylvp = yylvals + yyerrctx->lexeme;
1848 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1849 yylpp = yylpsns + yyerrctx->lexeme;
1851 yylexp = yylexemes + yyerrctx->lexeme;
1852 yychar = yylexp[-1];
1854 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1857 yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
1858 memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
1859 yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
1860 memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
1861 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1862 yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
1863 memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
1865 yystate = yyerrctx->state;
1866 yyFreeState(yyerrctx);
1871 if (yynewerrflag == 0) goto yyinrecovery;
1872 #endif /* YYBTYACC */
1874 YYERROR_CALL("syntax error");
1875 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1876 yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
1880 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
1891 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
1892 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
1896 fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
1897 YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
1899 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1900 yystate = yytable[yyn];
1901 *++yystack.s_mark = yytable[yyn];
1902 *++yystack.l_mark = yylval;
1903 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1904 /* lookahead position is error end position */
1905 yyerror_loc_range[1] = yylloc;
1906 YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
1907 *++yystack.p_mark = yyloc;
1915 fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
1916 YYDEBUGSTR, yydepth, *yystack.s_mark);
1918 if (yystack.s_mark <= yystack.s_base) goto yyabort;
1919 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1920 /* the current TOS position is the error start position */
1921 yyerror_loc_range[0] = *yystack.p_mark;
1923 #if defined(YYDESTRUCT_CALL)
1926 #endif /* YYBTYACC */
1927 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1928 YYDESTRUCT_CALL("error: discarding state",
1929 yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
1931 YYDESTRUCT_CALL("error: discarding state",
1932 yystos[*yystack.s_mark], yystack.l_mark);
1933 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1934 #endif /* defined(YYDESTRUCT_CALL) */
1937 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1945 if (yychar == YYEOF) goto yyabort;
1949 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1950 fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
1951 YYDEBUGSTR, yydepth, yystate, yychar, yys);
1954 #if defined(YYDESTRUCT_CALL)
1957 #endif /* YYBTYACC */
1958 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
1959 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
1961 YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
1962 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
1963 #endif /* defined(YYDESTRUCT_CALL) */
1973 fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
1974 YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
1975 #ifdef YYSTYPE_TOSTRING
1978 #endif /* YYBTYACC */
1983 for (i = yym; i > 0; i--)
1985 if (i != yym) fputs(", ", stderr);
1986 fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
1987 yystack.l_mark[1-i]), stderr);
1992 fputc('\n', stderr);
1996 yyval = yystack.l_mark[1-yym];
1998 memset(&yyval, 0, sizeof yyval);
1999 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2001 /* Perform position reduction */
2002 memset(&yyloc, 0, sizeof(yyloc));
2005 #endif /* YYBTYACC */
2007 YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
2008 /* just in case YYERROR is invoked within the action, save
2009 the start of the rhs as the error start position */
2010 yyerror_loc_range[0] = yystack.p_mark[1-yym];
2017 #line 377 "grammar.y"
2023 #line 381 "grammar.y"
2029 #line 392 "grammar.y"
2031 /* Provide an empty action here so bison will not complain about
2032 * incompatible types in the default action it normally would
2038 #line 399 "grammar.y"
2044 #line 406 "grammar.y"
2047 if (types_out && want_typedef()) {
2048 gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
2052 free_decl_spec(&yystack.l_mark[-1].decl_spec);
2057 #line 417 "grammar.y"
2059 if (func_params != NULL) {
2060 set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
2062 gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
2066 free_decl_list(&yystack.l_mark[-1].decl_list);
2068 free_decl_spec(&yystack.l_mark[-2].decl_spec);
2073 #line 431 "grammar.y"
2075 cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
2076 free_decl_spec(&yystack.l_mark[0].decl_spec);
2080 #line 436 "grammar.y"
2086 #line 443 "grammar.y"
2092 #line 447 "grammar.y"
2098 #line 459 "grammar.y"
2100 int flags = cur_decl_spec_flags;
2102 /* If the typedef is a pointer type, then reset the short type
2103 * flags so it does not get promoted.
2105 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
2106 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
2107 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
2108 free_declarator(yystack.l_mark[0].declarator);
2112 #line 471 "grammar.y"
2114 int flags = cur_decl_spec_flags;
2116 if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
2117 flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
2118 new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
2119 free_declarator(yystack.l_mark[0].declarator);
2123 #line 483 "grammar.y"
2125 check_untagged(&yystack.l_mark[-1].decl_spec);
2126 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
2127 yyerror("syntax error");
2130 func_params = &(yystack.l_mark[0].declarator->head->params);
2131 func_params->begin_comment = cur_file->begin_comment;
2132 func_params->end_comment = cur_file->end_comment;
2136 #line 494 "grammar.y"
2138 /* If we're converting to K&R and we've got a nominally K&R
2139 * function which has a parameter which is ANSI (i.e., a prototyped
2140 * function pointer), then we must override the deciphered value of
2141 * 'func_def' so that the parameter will be converted.
2143 if (func_style == FUNC_TRADITIONAL
2145 && yystack.l_mark[-3].declarator->head->func_def == func_style) {
2146 yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH;
2151 if (cur_file->convert)
2152 gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
2153 gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
2157 free_decl_spec(&yystack.l_mark[-4].decl_spec);
2158 free_declarator(yystack.l_mark[-3].declarator);
2162 #line 519 "grammar.y"
2164 if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
2165 yyerror("syntax error");
2168 func_params = &(yystack.l_mark[0].declarator->head->params);
2169 func_params->begin_comment = cur_file->begin_comment;
2170 func_params->end_comment = cur_file->end_comment;
2174 #line 529 "grammar.y"
2180 new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE);
2181 if (cur_file->convert)
2182 gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
2183 gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
2187 free_decl_spec(&decl_spec);
2188 free_declarator(yystack.l_mark[-4].declarator);
2192 #line 560 "grammar.y"
2194 join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
2195 free(yystack.l_mark[-1].decl_spec.text);
2196 free(yystack.l_mark[0].decl_spec.text);
2200 #line 575 "grammar.y"
2202 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2206 #line 579 "grammar.y"
2208 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
2212 #line 583 "grammar.y"
2214 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2218 #line 587 "grammar.y"
2220 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
2224 #line 591 "grammar.y"
2226 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
2230 #line 595 "grammar.y"
2232 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
2236 #line 602 "grammar.y"
2238 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
2242 #line 606 "grammar.y"
2244 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2248 #line 610 "grammar.y"
2250 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
2254 #line 614 "grammar.y"
2256 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2260 #line 618 "grammar.y"
2262 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2266 #line 622 "grammar.y"
2268 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
2272 #line 626 "grammar.y"
2274 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2278 #line 630 "grammar.y"
2280 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2284 #line 634 "grammar.y"
2286 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2290 #line 638 "grammar.y"
2292 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
2296 #line 642 "grammar.y"
2298 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2302 #line 646 "grammar.y"
2304 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2308 #line 650 "grammar.y"
2311 s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
2313 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
2317 #line 662 "grammar.y"
2319 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
2323 #line 666 "grammar.y"
2325 /* This rule allows the <pointer> nonterminal to scan #define
2326 * names as if they were type modifiers.
2329 s = find_symbol(define_names, yystack.l_mark[0].text.text);
2331 new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
2335 #line 679 "grammar.y"
2338 if ((s = implied_typedef()) == 0)
2339 (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text);
2340 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
2344 #line 686 "grammar.y"
2347 if ((s = implied_typedef()) == 0)
2348 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
2349 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
2353 #line 693 "grammar.y"
2355 (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
2356 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
2360 #line 701 "grammar.y"
2362 imply_typedef(yyval.text.text);
2366 #line 705 "grammar.y"
2368 imply_typedef(yyval.text.text);
2372 #line 712 "grammar.y"
2374 new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
2378 #line 716 "grammar.y"
2380 add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
2384 #line 723 "grammar.y"
2386 if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
2387 func_style == FUNC_TRADITIONAL && cur_file->convert) {
2388 gen_func_declarator(yystack.l_mark[0].declarator);
2389 fputs(cur_text(), cur_file->tmp_file);
2391 cur_declarator = yyval.declarator;
2395 #line 732 "grammar.y"
2397 if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
2398 func_style == FUNC_TRADITIONAL && cur_file->convert) {
2399 gen_func_declarator(yystack.l_mark[-1].declarator);
2400 fputs(" =", cur_file->tmp_file);
2405 #line 744 "grammar.y"
2408 if ((s = implied_typedef()) == 0)
2409 (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text);
2410 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
2414 #line 751 "grammar.y"
2417 if ((s = implied_typedef()) == 0)
2418 (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
2419 new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
2423 #line 758 "grammar.y"
2425 (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
2426 new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
2430 #line 766 "grammar.y"
2432 imply_typedef("enum");
2433 yyval.text = yystack.l_mark[0].text;
2437 #line 779 "grammar.y"
2439 yyval.declarator = yystack.l_mark[0].declarator;
2440 (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
2441 free(yyval.declarator->text);
2442 yyval.declarator->text = xstrdup(buf);
2443 yyval.declarator->begin = yystack.l_mark[-1].text.begin;
2444 yyval.declarator->pointer = TRUE;
2448 #line 792 "grammar.y"
2450 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
2454 #line 796 "grammar.y"
2456 yyval.declarator = yystack.l_mark[-1].declarator;
2457 (void)sprintf(buf, "(%s)", yyval.declarator->text);
2458 free(yyval.declarator->text);
2459 yyval.declarator->text = xstrdup(buf);
2460 yyval.declarator->begin = yystack.l_mark[-2].text.begin;
2464 #line 804 "grammar.y"
2466 yyval.declarator = yystack.l_mark[-1].declarator;
2467 (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
2468 free(yyval.declarator->text);
2469 yyval.declarator->text = xstrdup(buf);
2473 #line 811 "grammar.y"
2475 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
2476 yyval.declarator->params = yystack.l_mark[-1].param_list;
2477 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2478 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2479 yyval.declarator->func_def = FUNC_ANSI;
2483 #line 819 "grammar.y"
2485 yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
2486 yyval.declarator->params = yystack.l_mark[-1].param_list;
2487 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2488 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2489 yyval.declarator->func_def = FUNC_TRADITIONAL;
2493 #line 830 "grammar.y"
2495 (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
2496 yyval.text.begin = yystack.l_mark[-1].text.begin;
2500 #line 835 "grammar.y"
2502 (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
2503 yyval.text.begin = yystack.l_mark[-2].text.begin;
2507 #line 843 "grammar.y"
2509 strcpy(yyval.text.text, "");
2510 yyval.text.begin = 0L;
2514 #line 852 "grammar.y"
2516 (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
2517 yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
2518 free(yystack.l_mark[0].decl_spec.text);
2522 #line 858 "grammar.y"
2524 (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
2525 yyval.text.begin = yystack.l_mark[-1].text.begin;
2526 free(yystack.l_mark[0].decl_spec.text);
2530 #line 868 "grammar.y"
2532 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
2536 #line 875 "grammar.y"
2538 new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
2542 #line 879 "grammar.y"
2544 add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
2548 #line 886 "grammar.y"
2550 check_untagged(&yystack.l_mark[-1].decl_spec);
2551 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
2555 #line 891 "grammar.y"
2557 check_untagged(&yystack.l_mark[-1].decl_spec);
2558 yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
2562 #line 896 "grammar.y"
2564 check_untagged(&yystack.l_mark[0].decl_spec);
2565 yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
2569 #line 904 "grammar.y"
2571 new_ident_list(&yyval.param_list);
2575 #line 912 "grammar.y"
2577 new_ident_list(&yyval.param_list);
2578 add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
2582 #line 917 "grammar.y"
2584 add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
2588 #line 924 "grammar.y"
2590 yyval.text = yystack.l_mark[0].text;
2594 #line 928 "grammar.y"
2597 if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
2598 yyval.text = yystack.l_mark[0].text;
2601 (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
2602 yyval.text.begin = yystack.l_mark[-1].text.begin;
2606 #line 941 "grammar.y"
2608 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
2612 #line 945 "grammar.y"
2614 yyval.declarator = yystack.l_mark[0].declarator;
2615 (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
2616 free(yyval.declarator->text);
2617 yyval.declarator->text = xstrdup(buf);
2618 yyval.declarator->begin = yystack.l_mark[-1].text.begin;
2622 #line 957 "grammar.y"
2624 yyval.declarator = yystack.l_mark[-1].declarator;
2625 (void)sprintf(buf, "(%s)", yyval.declarator->text);
2626 free(yyval.declarator->text);
2627 yyval.declarator->text = xstrdup(buf);
2628 yyval.declarator->begin = yystack.l_mark[-2].text.begin;
2632 #line 965 "grammar.y"
2634 yyval.declarator = yystack.l_mark[-1].declarator;
2635 (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
2636 free(yyval.declarator->text);
2637 yyval.declarator->text = xstrdup(buf);
2641 #line 972 "grammar.y"
2643 yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
2647 #line 976 "grammar.y"
2649 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
2650 yyval.declarator->params = yystack.l_mark[-1].param_list;
2651 yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
2652 yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
2653 yyval.declarator->func_def = FUNC_ANSI;
2657 #line 984 "grammar.y"
2659 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
2660 yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
2661 yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
2662 yyval.declarator->func_def = FUNC_ANSI;
2666 #line 991 "grammar.y"
2670 d = new_declarator("", "", yystack.l_mark[-2].text.begin);
2671 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin);
2672 yyval.declarator->params = yystack.l_mark[-1].param_list;
2673 yyval.declarator->func_stack = d;
2674 yyval.declarator->head = yyval.declarator;
2675 yyval.declarator->func_def = FUNC_ANSI;
2679 #line 1002 "grammar.y"
2683 d = new_declarator("", "", yystack.l_mark[-1].text.begin);
2684 yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin);
2685 yyval.declarator->func_stack = d;
2686 yyval.declarator->head = yyval.declarator;
2687 yyval.declarator->func_def = FUNC_ANSI;
2690 #line 2691 "grammar.tab.c"
2694 yystack.s_mark -= yym;
2695 yystate = *yystack.s_mark;
2696 yystack.l_mark -= yym;
2697 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2698 yystack.p_mark -= yym;
2701 if (yystate == 0 && yym == 0)
2706 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2707 #ifdef YYSTYPE_TOSTRING
2710 #endif /* YYBTYACC */
2711 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
2713 fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
2717 *++yystack.s_mark = YYFINAL;
2718 *++yystack.l_mark = yyval;
2719 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2720 *++yystack.p_mark = yyloc;
2728 /* we're currently re-reading tokens */
2730 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2738 /* in trial mode; save scanner results for future parse attempts */
2739 if (yylvp == yylvlim)
2740 { /* Enlarge lexical value queue */
2741 size_t p = (size_t) (yylvp - yylvals);
2742 size_t s = (size_t) (yylvlim - yylvals);
2744 s += YYLVQUEUEGROWTH;
2745 if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL)
2747 if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
2749 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2750 if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
2753 yylvp = yylve = yylvals + p;
2754 yylvlim = yylvals + s;
2755 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2756 yylpp = yylpe = yylpsns + p;
2757 yylplim = yylpsns + s;
2759 yylexp = yylexemes + p;
2761 *yylexp = (YYINT) YYLEX;
2764 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2771 /* normal operation, no conflict encountered */
2772 #endif /* YYBTYACC */
2776 #endif /* YYBTYACC */
2777 if (yychar < 0) yychar = YYEOF;
2781 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
2782 fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n",
2783 YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
2787 if (yychar == YYEOF) goto yyaccept;
2790 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
2791 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
2792 yystate = yytable[yyn];
2794 yystate = yydgoto[yym];
2798 fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
2799 #ifdef YYSTYPE_TOSTRING
2802 #endif /* YYBTYACC */
2803 fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
2805 fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
2808 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
2809 *++yystack.s_mark = (YYINT) yystate;
2810 *++yystack.l_mark = yyval;
2811 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2812 *++yystack.p_mark = yyloc;
2817 /* Reduction declares that this path is valid. Set yypath and do a full parse */
2819 if (yypath) YYABORT;
2822 YYParseState *save = yyps->save;
2823 yyps->save = save->save;
2824 save->save = yypath;
2829 fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
2830 YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
2834 yyFreeState(yyerrctx);
2837 yylvp = yylvals + yypath->lexeme;
2838 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2839 yylpp = yylpsns + yypath->lexeme;
2841 yylexp = yylexemes + yypath->lexeme;
2843 yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
2844 memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT));
2845 yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
2846 memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
2847 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2848 yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
2849 memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
2851 yystate = yypath->state;
2853 #endif /* YYBTYACC */
2856 YYERROR_CALL("yacc stack overflow");
2860 YYERROR_CALL("memory exhausted");
2862 #endif /* YYBTYACC */
2872 if (yyps->save) goto yyvalid;
2873 #endif /* YYBTYACC */
2877 #if defined(YYDESTRUCT_CALL)
2878 if (yychar != YYEOF && yychar != YYEMPTY)
2879 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2880 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
2882 YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
2883 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2887 #if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
2890 for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
2891 YYDESTRUCT_CALL("cleanup: discarding state",
2892 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
2894 for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
2895 YYDESTRUCT_CALL("cleanup: discarding state",
2896 yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
2897 #endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
2899 #endif /* defined(YYDESTRUCT_CALL) */
2904 yyFreeState(yyerrctx);
2909 YYParseState *save = yyps;
2916 YYParseState *save = yypath;
2917 yypath = save->save;
2921 #endif /* YYBTYACC */
2922 yyfreestack(&yystack);